Split LVT record for known nulls

Since they are not spilled, the logic for splitting LVT records, that
is applied for spilled variables, was not applied for known nulls.
Fix that by applying the logic to them.
 #KT-47749
This commit is contained in:
Ilmir Usmanov
2021-07-18 19:44:10 +02:00
committed by Space
parent 83dddd73b0
commit b4d356c5bd
3 changed files with 47 additions and 33 deletions
@@ -46,7 +46,11 @@ fun box(): String {
}
// 1 LOCALVARIABLE i I L.* 2
// 1 LOCALVARIABLE s Ljava/lang/String; L.* 2
// 0 PUTFIELD VarValueConflictsWithTableKt\$box\$1.I\$0 : I
/* 2 loads in cycle */
// 2 ILOAD 2
// JVM_IR_TEMPLATES
// 1 LOCALVARIABLE s Ljava/lang/String; L.* 2
// JVM_TEMPLATES
// 2 LOCALVARIABLE s Ljava/lang/String; L.* 2
@@ -42,8 +42,6 @@ fun box(): String {
}
// 1 LOCALVARIABLE i Ljava/lang/String; L.* 3
// We merge LVT records for two consequent branches, but we split the local over the restore code.
// 3 LOCALVARIABLE s Ljava/lang/String; L.* 3
// 1 PUTFIELD VarValueConflictsWithTableSameSortKt\$box\$1.L\$0 : Ljava/lang/Object;
/* 1 load in the catch (e: Throwable) { throw e } block which is implicitly wrapped around try/finally */
// 1 ALOAD 3\s+ATHROW
@@ -55,3 +53,9 @@ fun box(): String {
// 2 ALOAD 3\s+INVOKEVIRTUAL java/io/PrintStream.println \(Ljava/lang/Object;\)V
/* But no further load when spilling 's' to the continuation */
// 5 ALOAD 3
// We merge LVT records for two consequent branches, but we split the local over the restore code.
// JVM_IR_TEMPLATES
// 3 LOCALVARIABLE s Ljava/lang/String; L.* 3
// JVM_TEMPLATES
// 4 LOCALVARIABLE s Ljava/lang/String; L.* 3