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:
Alexander Udalov
2020-10-21 22:26:55 +02:00
parent bc76f1fec3
commit 382a0bd298
11 changed files with 66 additions and 29 deletions
+2
View File
@@ -19,6 +19,8 @@ where advanced options include:
'enable' since language version 1.3
-Xdump-declarations-to=<path> Path to JSON file to dump Java to Kotlin declaration mappings
-Xdisable-standard-script Disable standard kotlin script support
-Xir-do-not-clear-binding-context
When using the IR backend, do not clear BindingContext between psi2ir and lowerings
-Xemit-jvm-type-annotations Emit JVM type annotations in bytecode
-Xfriend-paths=<path> Paths to output directories for friend modules (whose internals should be visible)
-Xmultifile-parts-inherit Compile multifile classes as a hierarchy of parts and facade