Make start label of LVT record the point where variable becomes alive

Otherwise, there will be overlapping LVT records, which leads to
removal of the whole LVT by R8.
 #KT-44714 Fixed
This commit is contained in:
Ilmir Usmanov
2021-03-03 00:46:14 +01:00
parent e17b7f01b6
commit b6bb8a576e
2 changed files with 2 additions and 3 deletions
@@ -1252,8 +1252,7 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction:
for (insnIndex in 0 until (method.instructions.size() - 1)) {
val insn = method.instructions[insnIndex]
if (!isAlive(insnIndex, variableIndex) && isAlive(insnIndex + 1, variableIndex)) {
val lvtRecord = oldLvt.findRecord(insnIndex, variableIndex) ?: continue
startLabel = max(lvtRecord.start, previousSuspensionPointLabel(insn))
startLabel = insn as? LabelNode ?: insn.findNextOrNull { it is LabelNode } as? LabelNode
}
if (isAlive(insnIndex, variableIndex) && !isAlive(insnIndex + 1, variableIndex)) {
// No variable in LVT -> do not add one
@@ -15,7 +15,7 @@ fun main(args: Array<String>) {
suspend fun SequenceScope<Int>.awaitSeq(): Int = 42
// 1 LOCALVARIABLE a I L[0-9]+ L4
// 1 LOCALVARIABLE a I L[0-9]+ L19
/* TODO: JVM_IR does not generate LINENUMBER at the end of the lambda */
// JVM_TEMPLATES