JVM IR: clear BindingContext after psi2ir
This helps to reduce peak memory in lowerings/codegen by a lot. A more robust approach would be to have a separate BindingContext for each file, and clear each of them after running psi2ir on it. This would also lower peak memory usage in psi2ir. Provide a fallback workaround compiler argument -Xir-do-not-clear-binding-context just in case BindingContext is in fact used somewhere and it's not caught by tests.
This commit is contained in:
+6
@@ -108,6 +108,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
)
|
||||
var isIrWithStableAbi: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xir-do-not-clear-binding-context",
|
||||
description = "When using the IR backend, do not clear BindingContext between psi2ir and lowerings"
|
||||
)
|
||||
var doNotClearBindingContext: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(value = "-Xmodule-path", valueDescription = "<path>", description = "Paths where to find Java 9+ modules")
|
||||
var javaModulePath: String? by NullableStringFreezableVar(null)
|
||||
|
||||
|
||||
@@ -173,6 +173,7 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
|
||||
|
||||
put(JVMConfigurationKeys.IR, arguments.useIR && !arguments.noUseIR)
|
||||
put(JVMConfigurationKeys.IS_IR_WITH_STABLE_ABI, arguments.isIrWithStableAbi)
|
||||
put(JVMConfigurationKeys.DO_NOT_CLEAR_BINDING_CONTEXT, arguments.doNotClearBindingContext)
|
||||
put(JVMConfigurationKeys.DISABLE_CALL_ASSERTIONS, arguments.noCallAssertions)
|
||||
put(JVMConfigurationKeys.DISABLE_RECEIVER_ASSERTIONS, arguments.noReceiverAssertions)
|
||||
put(JVMConfigurationKeys.DISABLE_PARAM_ASSERTIONS, arguments.noParamAssertions)
|
||||
|
||||
Reference in New Issue
Block a user