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
@@ -153,4 +153,7 @@ public class JVMConfigurationKeys {
public static final CompilerConfigurationKey<Boolean> VALIDATE_BYTECODE =
CompilerConfigurationKey.create("Validate generated JVM bytecode");
public static final CompilerConfigurationKey<Boolean> LINK_VIA_SIGNATURES =
CompilerConfigurationKey.create("Link JVM IR symbols via signatures, instead of by descriptors");
}