Remove obsolete compiler flag -Xuse-ir

This commit is contained in:
Alexander Udalov
2023-05-19 17:06:34 +02:00
committed by Space Team
parent 2951e0b955
commit 60016d3e5b
18 changed files with 3 additions and 77 deletions
@@ -77,7 +77,6 @@ fun copyK2JVMCompilerArguments(from: K2JVMCompilerArguments, to: K2JVMCompilerAr
to.suppressMissingBuiltinsError = from.suppressMissingBuiltinsError to.suppressMissingBuiltinsError = from.suppressMissingBuiltinsError
to.typeEnhancementImprovementsInStrictMode = from.typeEnhancementImprovementsInStrictMode to.typeEnhancementImprovementsInStrictMode = from.typeEnhancementImprovementsInStrictMode
to.useFastJarFileSystem = from.useFastJarFileSystem to.useFastJarFileSystem = from.useFastJarFileSystem
to.useIR = from.useIR
to.useJavac = from.useJavac to.useJavac = from.useJavac
to.useOldBackend = from.useOldBackend to.useOldBackend = from.useOldBackend
to.useOldClassFilesReading = from.useOldClassFilesReading to.useOldClassFilesReading = from.useOldClassFilesReading
@@ -145,16 +145,6 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
// Advanced options // Advanced options
@Argument(
value = "-Xuse-ir",
description = "Use the IR backend. This option has no effect unless the language version less than 1.5 is used"
)
var useIR = false
set(value) {
checkFrozen()
field = value
}
@Argument(value = "-Xuse-old-backend", description = "Use the old JVM backend") @Argument(value = "-Xuse-old-backend", description = "Use the old JVM backend")
var useOldBackend = false var useOldBackend = false
set(value) { set(value) {
@@ -246,14 +246,8 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
put(JVMConfigurationKeys.PARAMETERS_METADATA, arguments.javaParameters) put(JVMConfigurationKeys.PARAMETERS_METADATA, arguments.javaParameters)
// TODO: ignore previous configuration value when we do not need old backend in scripting by default val useOldBackend = arguments.useOldBackend
val useOldBackend = arguments.useOldBackend || (!arguments.useIR && get(JVMConfigurationKeys.IR) == false) val useIR = arguments.useK2 || languageVersionSettings.languageVersion.usesK2 || !useOldBackend
val useIR = arguments.useK2 || languageVersionSettings.languageVersion.usesK2 ||
if (languageVersionSettings.supportsFeature(LanguageFeature.JvmIrEnabledByDefault)) {
!useOldBackend
} else {
arguments.useIR && !useOldBackend
}
messageCollector.report(LOGGING, "Using ${if (useIR) "JVM IR" else "old JVM"} backend") messageCollector.report(LOGGING, "Using ${if (useIR) "JVM IR" else "old JVM"} backend")
@@ -16,7 +16,6 @@ internal val LANGUAGE_VERSION_K1: String = System.getProperty("fir.bench.languag
class FE1FullPipelineModularizedTest : AbstractFullPipelineModularizedTest() { class FE1FullPipelineModularizedTest : AbstractFullPipelineModularizedTest() {
override fun configureArguments(args: K2JVMCompilerArguments, moduleData: ModuleData) { override fun configureArguments(args: K2JVMCompilerArguments, moduleData: ModuleData) {
args.useK2 = false args.useK2 = false
args.useIR = true
args.languageVersion = LANGUAGE_VERSION_K1 args.languageVersion = LANGUAGE_VERSION_K1
// TODO: Remove when support for old modularized tests is removed // TODO: Remove when support for old modularized tests is removed
if (moduleData.arguments == null) { if (moduleData.arguments == null) {
@@ -18,7 +18,6 @@ internal val LANGUAGE_VERSION_K2: String = System.getProperty("fir.bench.languag
class FullPipelineModularizedTest : AbstractFullPipelineModularizedTest() { class FullPipelineModularizedTest : AbstractFullPipelineModularizedTest() {
override fun configureArguments(args: K2JVMCompilerArguments, moduleData: ModuleData) { override fun configureArguments(args: K2JVMCompilerArguments, moduleData: ModuleData) {
args.useIR = true
args.languageVersion = LANGUAGE_VERSION_K2 args.languageVersion = LANGUAGE_VERSION_K2
// TODO: Remove when support for old modularized tests is removed // TODO: Remove when support for old modularized tests is removed
@@ -14,7 +14,6 @@ abstract class AbstractIncrementalFirICLightTreeJvmCompilerRunnerTest : Abstract
super.createCompilerArguments(destinationDir, testDir).apply { super.createCompilerArguments(destinationDir, testDir).apply {
useK2 = true useK2 = true
languageVersion = "2.0" languageVersion = "2.0"
useIR = true
useFirIC = true useFirIC = true
useFirLT = true useFirLT = true
} }
@@ -25,7 +25,6 @@ abstract class AbstractIncrementalFirJvmCompilerRunnerTest : AbstractIncremental
super.createCompilerArguments(destinationDir, testDir).apply { super.createCompilerArguments(destinationDir, testDir).apply {
useK2 = true useK2 = true
languageVersion = "2.0" languageVersion = "2.0"
useIR = true
} }
override val buildLogFinder: BuildLogFinder override val buildLogFinder: BuildLogFinder
@@ -14,7 +14,6 @@ abstract class AbstractIncrementalFirLightTreeJvmCompilerRunnerTest : AbstractIn
super.createCompilerArguments(destinationDir, testDir).apply { super.createCompilerArguments(destinationDir, testDir).apply {
useK2 = true useK2 = true
languageVersion = "2.0" languageVersion = "2.0"
useIR = true
useFirIC = false useFirIC = false
useFirLT = true useFirLT = true
} }
-1
View File
@@ -141,7 +141,6 @@ where advanced options include:
including freshly supported reading of the type use annotations from class files. including freshly supported reading of the type use annotations from class files.
See KT-45671 for more details See KT-45671 for more details
-Xuse-fast-jar-file-system Use fast implementation on Jar FS. This may speed up compilation time, but currently it's an experimental mode -Xuse-fast-jar-file-system Use fast implementation on Jar FS. This may speed up compilation time, but currently it's an experimental mode
-Xuse-ir Use the IR backend. This option has no effect unless the language version less than 1.5 is used
-Xuse-javac Use javac for Java source and class files analysis -Xuse-javac Use javac for Java source and class files analysis
-Xuse-old-backend Use the old JVM backend -Xuse-old-backend Use the old JVM backend
-Xuse-old-class-files-reading Use old class files reading implementation. This may slow down the build and cause problems with Groovy interop. -Xuse-old-class-files-reading Use old class files reading implementation. This may slow down the build and cause problems with Groovy interop.
@@ -620,11 +620,6 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/jvm/inlineCycle.args"); runTest("compiler/testData/cli/jvm/inlineCycle.args");
} }
@TestMetadata("inlineCycle_ir.args")
public void testInlineCycle_ir() throws Exception {
runTest("compiler/testData/cli/jvm/inlineCycle_ir.args");
}
@TestMetadata("instanceAccessBeforeSuperCall.args") @TestMetadata("instanceAccessBeforeSuperCall.args")
public void testInstanceAccessBeforeSuperCall() throws Exception { public void testInstanceAccessBeforeSuperCall() throws Exception {
runTest("compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.args"); runTest("compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.args");
@@ -685,11 +680,6 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/jvm/invalidMetadataVersion.args"); runTest("compiler/testData/cli/jvm/invalidMetadataVersion.args");
} }
@TestMetadata("irSupported.args")
public void testIrSupported() throws Exception {
runTest("compiler/testData/cli/jvm/irSupported.args");
}
@TestMetadata("javaSealedClass.args") @TestMetadata("javaSealedClass.args")
public void testJavaSealedClass() throws Exception { public void testJavaSealedClass() throws Exception {
runTest("compiler/testData/cli/jvm/javaSealedClass.args"); runTest("compiler/testData/cli/jvm/javaSealedClass.args");
@@ -995,11 +985,6 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/jvm/nonLocalDisabled.args"); runTest("compiler/testData/cli/jvm/nonLocalDisabled.args");
} }
@TestMetadata("nonLocalDisabled_ir.args")
public void testNonLocalDisabled_ir() throws Exception {
runTest("compiler/testData/cli/jvm/nonLocalDisabled_ir.args");
}
@TestMetadata("nonexistentPathInModule.args") @TestMetadata("nonexistentPathInModule.args")
public void testNonexistentPathInModule() throws Exception { public void testNonexistentPathInModule() throws Exception {
runTest("compiler/testData/cli/jvm/nonexistentPathInModule.args"); runTest("compiler/testData/cli/jvm/nonexistentPathInModule.args");
@@ -141,7 +141,6 @@ class CompilerArgumentsContentProspectorTest {
K2JVMCompilerArguments::noStdlib, K2JVMCompilerArguments::noStdlib,
K2JVMCompilerArguments::noReflect, K2JVMCompilerArguments::noReflect,
K2JVMCompilerArguments::javaParameters, K2JVMCompilerArguments::javaParameters,
K2JVMCompilerArguments::useIR,
K2JVMCompilerArguments::allowUnstableDependencies, K2JVMCompilerArguments::allowUnstableDependencies,
K2JVMCompilerArguments::doNotClearBindingContext, K2JVMCompilerArguments::doNotClearBindingContext,
K2JVMCompilerArguments::noCallAssertions, K2JVMCompilerArguments::noCallAssertions,
@@ -6,19 +6,11 @@
package org.jetbrains.kotlin.jps.build package org.jetbrains.kotlin.jps.build
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder
import org.jetbrains.kotlin.jps.model.k2JvmCompilerArguments
abstract class AbstractIncrementalK2FirICLightTreeJvmJpsTest( abstract class AbstractIncrementalK2FirICLightTreeJvmJpsTest(
allowNoFilesWithSuffixInTestData: Boolean = false allowNoFilesWithSuffixInTestData: Boolean = false
) : AbstractIncrementalJpsTest(allowNoFilesWithSuffixInTestData = allowNoFilesWithSuffixInTestData) { ) : AbstractIncrementalJpsTest(allowNoFilesWithSuffixInTestData = allowNoFilesWithSuffixInTestData) {
override fun overrideModuleSettings() {
myProject.k2JvmCompilerArguments = K2JVMCompilerArguments().also {
it.useIR = true
}
}
override fun updateCommandLineArguments(arguments: CommonCompilerArguments) { override fun updateCommandLineArguments(arguments: CommonCompilerArguments) {
additionalCommandLineArguments = additionalCommandLineArguments + listOf("-Xuse-k2", "-Xuse-fir-ic", "-Xuse-fir-lt") additionalCommandLineArguments = additionalCommandLineArguments + listOf("-Xuse-k2", "-Xuse-fir-ic", "-Xuse-fir-lt")
super.updateCommandLineArguments(arguments) super.updateCommandLineArguments(arguments)
@@ -6,19 +6,11 @@
package org.jetbrains.kotlin.jps.build package org.jetbrains.kotlin.jps.build
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder
import org.jetbrains.kotlin.jps.model.k2JvmCompilerArguments
abstract class AbstractIncrementalK2JvmJpsTest( abstract class AbstractIncrementalK2JvmJpsTest(
allowNoFilesWithSuffixInTestData: Boolean = false allowNoFilesWithSuffixInTestData: Boolean = false
) : AbstractIncrementalJpsTest(allowNoFilesWithSuffixInTestData = allowNoFilesWithSuffixInTestData) { ) : AbstractIncrementalJpsTest(allowNoFilesWithSuffixInTestData = allowNoFilesWithSuffixInTestData) {
override fun overrideModuleSettings() {
myProject.k2JvmCompilerArguments = K2JVMCompilerArguments().also {
it.useIR = true
}
}
override fun updateCommandLineArguments(arguments: CommonCompilerArguments) { override fun updateCommandLineArguments(arguments: CommonCompilerArguments) {
additionalCommandLineArguments = additionalCommandLineArguments + listOf("-Xuse-k2", "-Xuse-fir-lt=false") additionalCommandLineArguments = additionalCommandLineArguments + listOf("-Xuse-k2", "-Xuse-fir-lt=false")
super.updateCommandLineArguments(arguments) super.updateCommandLineArguments(arguments)
@@ -6,19 +6,11 @@
package org.jetbrains.kotlin.jps.build package org.jetbrains.kotlin.jps.build
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder
import org.jetbrains.kotlin.jps.model.k2JvmCompilerArguments
abstract class AbstractIncrementalK2LightTreeJvmJpsTest( abstract class AbstractIncrementalK2LightTreeJvmJpsTest(
allowNoFilesWithSuffixInTestData: Boolean = false allowNoFilesWithSuffixInTestData: Boolean = false
) : AbstractIncrementalJpsTest(allowNoFilesWithSuffixInTestData = allowNoFilesWithSuffixInTestData) { ) : AbstractIncrementalJpsTest(allowNoFilesWithSuffixInTestData = allowNoFilesWithSuffixInTestData) {
override fun overrideModuleSettings() {
myProject.k2JvmCompilerArguments = K2JVMCompilerArguments().also {
it.useIR = true
}
}
override fun updateCommandLineArguments(arguments: CommonCompilerArguments) { override fun updateCommandLineArguments(arguments: CommonCompilerArguments) {
additionalCommandLineArguments = additionalCommandLineArguments + listOf("-Xuse-k2", "-Xuse-fir-lt") additionalCommandLineArguments = additionalCommandLineArguments + listOf("-Xuse-k2", "-Xuse-fir-lt")
super.updateCommandLineArguments(arguments) super.updateCommandLineArguments(arguments)
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.daemon.common.configureDaemonJVMOptions
import org.jetbrains.kotlin.daemon.common.filterExtractProps import org.jetbrains.kotlin.daemon.common.filterExtractProps
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtensionOrNull import org.jetbrains.kotlin.gradle.dsl.multiplatformExtensionOrNull
import org.jetbrains.kotlin.gradle.internal.ClassLoadersCachingBuildService import org.jetbrains.kotlin.gradle.internal.ClassLoadersCachingBuildService
import org.jetbrains.kotlin.gradle.logging.kotlinDebug import org.jetbrains.kotlin.gradle.logging.kotlinDebug
@@ -46,7 +47,6 @@ import org.jetbrains.kotlin.statistics.metrics.BooleanMetrics
import org.jetbrains.kotlin.statistics.metrics.StringMetrics import org.jetbrains.kotlin.statistics.metrics.StringMetrics
import java.io.File import java.io.File
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
const val CREATED_CLIENT_FILE_PREFIX = "Created client-is-alive flag file: " const val CREATED_CLIENT_FILE_PREFIX = "Created client-is-alive flag file: "
@@ -169,7 +169,6 @@ internal open class GradleCompilerRunner(
KotlinBuildStatsService.getInstance()?.apply { KotlinBuildStatsService.getInstance()?.apply {
val args = K2JVMCompilerArguments() val args = K2JVMCompilerArguments()
parseCommandLineArguments(argsArray.toList(), args) parseCommandLineArguments(argsArray.toList(), args)
report(BooleanMetrics.JVM_COMPILER_IR_MODE, args.useIR)
report(StringMetrics.JVM_DEFAULTS, args.jvmDefault) report(StringMetrics.JVM_DEFAULTS, args.jvmDefault)
report(StringMetrics.USE_FIR, args.useK2.toString()) report(StringMetrics.USE_FIR, args.useK2.toString())
@@ -40,7 +40,6 @@ enum class BooleanMetrics(val type: BooleanOverridePolicy, val anonymization: Bo
KOTLIN_OFFICIAL_CODESTYLE(OVERRIDE, SAFE), KOTLIN_OFFICIAL_CODESTYLE(OVERRIDE, SAFE),
KOTLIN_PROGRESSIVE_MODE(OVERRIDE, SAFE), KOTLIN_PROGRESSIVE_MODE(OVERRIDE, SAFE),
KOTLIN_KTS_USED(OR, SAFE), KOTLIN_KTS_USED(OR, SAFE),
JVM_COMPILER_IR_MODE(OR, SAFE),
JS_GENERATE_EXTERNALS(OR, SAFE), JS_GENERATE_EXTERNALS(OR, SAFE),
@@ -133,7 +133,6 @@ internal fun reportArgumentsNotAllowed(
messageCollector, messageCollector,
reportingState, reportingState,
K2JVMCompilerArguments::useJavac, K2JVMCompilerArguments::useJavac,
K2JVMCompilerArguments::useIR,
K2JVMCompilerArguments::useK2 K2JVMCompilerArguments::useK2
) )
@@ -81,14 +81,6 @@ class ScriptingCompilerPluginTest : TestCase() {
return KotlinCoreEnvironment.createForTests(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES) return KotlinCoreEnvironment.createForTests(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
} }
fun testUseOldBackendPreservedOnOptionsUpdate() {
val configuration = KotlinTestUtils.newConfiguration(ConfigurationKind.NO_KOTLIN_REFLECT, TestJdkKind.FULL_JDK).apply {
put(JVMConfigurationKeys.IR, false)
updateWithCompilerOptions(emptyList())
}
Assert.assertEquals(configuration[JVMConfigurationKeys.IR], false)
}
fun testScriptResolverEnvironmentArgsParsing() { fun testScriptResolverEnvironmentArgsParsing() {
val longStr = (1..100).joinToString("\\,") { """\" $it aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \\""" } val longStr = (1..100).joinToString("\\,") { """\" $it aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \\""" }