From dcaad530cee729a519e7741b33e5e537153826eb Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Fri, 12 May 2017 15:38:10 +0300 Subject: [PATCH] Make code generation in method transformer more stable Do not mix references to label nodes and common ASM labels as it may lead to different LabelNode instance (not defaultLabel) being inserted into insns list It's been working before because there was no `resetLabels` call on insnList, and label/label nodes were bound to each other --- .../codegen/coroutines/CoroutineTransformerMethodVisitor.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt index 04c63261659..bc782060c3d 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt @@ -125,9 +125,9 @@ class CoroutineTransformerMethodVisitor( ) insert(startLabel, withInstructionAdapter { generateResumeWithExceptionCheck(exceptionIndex) }) + insert(last, defaultLabel) insert(last, withInstructionAdapter { - visitLabel(defaultLabel.label) AsmUtil.genThrow(this, "java/lang/IllegalStateException", "call to 'resume' before 'invoke' with coroutine") areturn(Type.VOID_TYPE) })