JVM IR: link via descriptors instead of signatures by default

Doing so speeds up psi2ir ~2 times, and thus improves total compiler
performance by about 6-8%.

Unless JVM IR is in the mode where linking via signatures is the only
way (-Xserialize-ir, -Xklib), signatures are actually not needed at all,
SymbolTable can use the frontend representation (descriptors for FE1.0,
and hopefully FIR elements for K2) as hash table keys. The only catch is
that since other backends still need to work with signatures, all the
common IR utilities, such as irTypePredicates.kt, need to work correctly
for IR elements both with signatures and without.

Also, introduce a fallback compiler flag -Xlink-via-signatures, in case
something goes wrong, to be able to troubleshoot and workaround any
issues.

 #KT-48233
This commit is contained in:
Alexander Udalov
2022-01-24 14:26:28 +01:00
parent 6e4131de8e
commit 6379fe4c4c
18 changed files with 290 additions and 70 deletions
+5 -1
View File
@@ -81,6 +81,8 @@ where advanced options include:
-Xlambdas=indy Generate lambdas using `invokedynamic` with `LambdaMetafactory.metafactory`. Requires `-jvm-target 1.8` or greater.
Lambda objects created using `LambdaMetafactory.metafactory` will have different `toString()`.
-Xlambdas=class Generate lambdas as explicit classes
-Xlink-via-signatures Link JVM IR symbols via signatures, instead of descriptors.
This mode is slower, but can be useful in troubleshooting problems with the JVM IR backend
-Xno-call-assertions Don't generate not-null assertions for arguments of platform types
-Xno-kotlin-nothing-value-exception
Do not use KotlinNothingValueException available since 1.4
@@ -133,7 +135,9 @@ where advanced options include:
-Xsuppress-missing-builtins-error
Suppress the "cannot access built-in declaration" error (useful with -no-stdlib)
-Xtype-enhancement-improvements-strict-mode
Enable strict mode for some improvements in the type enhancement for loaded Java types based on nullability annotations,including freshly supported reading of the type use annotations from class files. See KT-45671 for more details
Enable strict mode for some improvements in the type enhancement for loaded Java types based on nullability annotations,
including freshly supported reading of the type use annotations from class files.
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-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