Fix compilation with ASM 8

General rule to use linkedLabel or linkWithLabel
  when label from node is reused in other instructions.
  If label is not linked then it will point to another labelNode when visited

  #KT-39013 Fixed
This commit is contained in:
Mikhail Bogdanov
2020-06-12 20:18:20 +02:00
parent 1186d1affd
commit db50afeafe
8 changed files with 36 additions and 12 deletions
@@ -13,12 +13,9 @@ import org.jetbrains.kotlin.backend.jvm.intrinsics.JavaClassProperty
import org.jetbrains.kotlin.backend.jvm.lower.MultifileFacadeFileEntry
import org.jetbrains.kotlin.backend.jvm.lower.constantValue
import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.unboxInlineClass
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.AsmUtil.*
import org.jetbrains.kotlin.codegen.BaseExpressionCodegen
import org.jetbrains.kotlin.codegen.CallGenerator
import org.jetbrains.kotlin.codegen.StackValue
import org.jetbrains.kotlin.codegen.coroutines.SuspensionPointKind
import org.jetbrains.kotlin.codegen.extractReificationArgument
import org.jetbrains.kotlin.codegen.inline.*
import org.jetbrains.kotlin.codegen.inline.ReifiedTypeInliner.Companion.putNeedClassReificationMarker
import org.jetbrains.kotlin.codegen.inline.ReifiedTypeInliner.OperationKind.AS
@@ -148,6 +145,8 @@ class ExpressionCodegen(
private fun markNewLabel() = Label().apply { mv.visitLabel(this) }
private fun markNewLinkedLabel() = linkedLabel().apply { mv.visitLabel(this) }
private fun getLineNumberForOffset(offset: Int): Int = fileEntry?.getLineNumber(offset)?.plus(1) ?: -1
private fun IrElement.markLineNumber(startOffset: Boolean) {
@@ -1027,7 +1026,7 @@ class ExpressionCodegen(
data: BlockInfo,
nestedTryWithoutFinally: MutableList<TryInfo> = arrayListOf()
) {
val gapStart = markNewLabel()
val gapStart = markNewLinkedLabel()
finallyDepth++
if (isFinallyMarkerRequired()) {
generateFinallyMarker(mv, finallyDepth, true)