Do not take LVT into account when calculating liveness of variables

This commit is contained in:
Ilmir Usmanov
2020-07-20 15:56:29 +02:00
parent 687d13a320
commit 60875f96b4
19 changed files with 32 additions and 189 deletions
@@ -17,9 +17,10 @@ suspend fun SequenceScope<Int>.awaitSeq(): Int = 42
// label numbers differ in BEs
// JVM_TEMPLATES
// 1 LOCALVARIABLE a I L17 L.*
// 1 LINENUMBER 8 L17
// 1 LOCALVARIABLE a I L[0-9]+ L20
// 1 LINENUMBER 9 L20
/* TODO: JVM_IR does not generate LINENUMBER at the end of the lambda */
// JVM_IR_TEMPLATES
// 1 LOCALVARIABLE a I L14 L.*
// 1 LOCALVARIABLE a I L[0-9]+ L5
// 1 LINENUMBER 8 L14
@@ -15,17 +15,18 @@ fun box(): String {
builder {
var shiftSlot: String = ""
// Initialize var with Int value
// Initialize var with String value
try {
var i: String = "abc"
i = "123"
} finally { }
// This variable should take the same slot as 'i' had
var s: String
var s: String = "FAIL"
// We shout not spill 's' to continuation field because it's not effectively initialized
if (suspendHere() == "OK") {
println(s)
s = "OK"
}
else {
@@ -45,5 +46,9 @@ fun box(): String {
// 1 ALOAD 3\s+ATHROW
/* 1 load in result = s */
// 1 ALOAD 3\s+PUTFIELD kotlin/jvm/internal/Ref\$ObjectRef\.element
/* 1 load in spill */
// 1 ALOAD 3\s+PUTFIELD VarValueConflictsWithTableSameSortKt\$box\$1\.L\$0 : Ljava/lang/Object;
/* 1 load in println(s) */
// 1 ALOAD 3\s+INVOKEVIRTUAL java/io/PrintStream.println \(Ljava/lang/Object;\)V
/* But no further load when spilling 's' to the continuation */
// 2 ALOAD 3
// 4 ALOAD 3