From a239f02a30e4f81894731a277dbc9c3050abe4d4 Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Mon, 10 Jan 2022 16:23:38 +0100 Subject: [PATCH] Add cli argumens for FIR "tight" IC and LightTree usage --- .../cli/common/arguments/CommonCompilerArguments.kt | 12 ++++++++++++ .../org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt | 2 +- .../incremental/IncrementalJvmCompilerRunner.kt | 2 +- compiler/testData/cli/js/jsExtraHelp.out | 2 ++ compiler/testData/cli/jvm/extraHelp.out | 2 ++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt index c786f4d8744..f12a68a905f 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt @@ -305,6 +305,18 @@ abstract class CommonCompilerArguments : CommonToolArguments() { ) var useFirExtendedCheckers: Boolean by FreezableVar(false) + @Argument( + value = "-Xuse-fir-ic", + description = "Compile using Front-end IR internal incremental compilation cycle. Warning: this feature is far from being production-ready" + ) + var useFirIC: Boolean by FreezableVar(false) + + @Argument( + value = "-Xuse-fir-lt", + description = "Compile using LightTree parser with Front-end IR. Warning: this feature is far from being production-ready" + ) + var useFirLT: Boolean by FreezableVar(false) + @Argument( value = "-Xdisable-ultra-light-classes", description = "Do not use the ultra light classes implementation" diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt index 19e6e59b947..3c18348e661 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt @@ -124,7 +124,7 @@ class K2JVMCompiler : CLICompiler() { val chunk = moduleChunk.modules configuration.configureSourceRoots(chunk, buildFile) - if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) { + if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR) && arguments.useFirLT /* TODO: consider storing in the configuration instead of using args here directly */) { val projectEnvironment = createProjectEnvironment(configuration, rootDisposable, EnvironmentConfigFiles.JVM_CONFIG_FILES, messageCollector) diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt index 4d41601f14a..d631664f716 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt @@ -87,7 +87,7 @@ fun makeIncrementally( withIC(args) { val compiler = - if (args.useFir) + if (args.useFir && args.useFirIC && args.useFirLT /* TODO: move LT check into runner */ ) IncrementalFirJvmCompilerRunner( cachesDir, buildReporter, buildHistoryFile, emptyList(), EmptyModulesApiHistory, kotlinExtensions, ClasspathSnapshotDisabled ) diff --git a/compiler/testData/cli/js/jsExtraHelp.out b/compiler/testData/cli/js/jsExtraHelp.out index ece6fe4d6d4..8d993c89072 100644 --- a/compiler/testData/cli/js/jsExtraHelp.out +++ b/compiler/testData/cli/js/jsExtraHelp.out @@ -103,6 +103,8 @@ where advanced options include: Eliminate builder inference restrictions like allowance of returning type variables of a builder inference call -Xuse-fir Compile using Front-end IR. Warning: this feature is far from being production-ready -Xuse-fir-extended-checkers Use extended analysis mode based on Front-end IR. Warning: this feature is far from being production-ready + -Xuse-fir-ic Compile using Front-end IR internal incremental compilation cycle. Warning: this feature is far from being production-ready + -Xuse-fir-lt Compile using LightTree parser with Front-end IR. Warning: this feature is far from being production-ready -Xuse-mixed-named-arguments Enable Support named arguments in their own position even if the result appears as mixed -Xverbose-phases Be verbose while performing these backend phases diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out index 5318f46a78f..79293ed46d0 100644 --- a/compiler/testData/cli/jvm/extraHelp.out +++ b/compiler/testData/cli/jvm/extraHelp.out @@ -211,6 +211,8 @@ where advanced options include: Eliminate builder inference restrictions like allowance of returning type variables of a builder inference call -Xuse-fir Compile using Front-end IR. Warning: this feature is far from being production-ready -Xuse-fir-extended-checkers Use extended analysis mode based on Front-end IR. Warning: this feature is far from being production-ready + -Xuse-fir-ic Compile using Front-end IR internal incremental compilation cycle. Warning: this feature is far from being production-ready + -Xuse-fir-lt Compile using LightTree parser with Front-end IR. Warning: this feature is far from being production-ready -Xuse-mixed-named-arguments Enable Support named arguments in their own position even if the result appears as mixed -Xverbose-phases Be verbose while performing these backend phases