From bb5a99ec18d9a5d5fa740832c08502083667d7af Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Tue, 4 Aug 2020 20:38:43 +0200 Subject: [PATCH] Do not put $completion to LVT if is dead --- .../codegen/coroutines/CoroutineTransformerMethodVisitor.kt | 3 +-- .../completionInSuspendFunction/nonStaticStateMachine.kt | 1 - .../completionInSuspendFunction/staticStateMachine.kt | 1 - .../completionInSuspendFunction/staticStateMachineReceiver.kt | 1 - 4 files changed, 1 insertion(+), 5 deletions(-) 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 bf54d5d0e35..b25b580a317 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt @@ -1177,8 +1177,7 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction: for (variable in oldLvt) { // $completion, $continuation and $result are dead, but they are used by debugger, as well as fake inliner variables // For example, $continuation is used to create async stack trace - if (variable.name == SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME || - variable.name == CONTINUATION_VARIABLE_NAME || + if (variable.name == CONTINUATION_VARIABLE_NAME || variable.name == SUSPEND_CALL_RESULT_NAME || isFakeLocalVariableForInline(variable.name) ) { diff --git a/compiler/testData/checkLocalVariablesTable/completionInSuspendFunction/nonStaticStateMachine.kt b/compiler/testData/checkLocalVariablesTable/completionInSuspendFunction/nonStaticStateMachine.kt index fb176ef39f2..3ac0b4e09c2 100644 --- a/compiler/testData/checkLocalVariablesTable/completionInSuspendFunction/nonStaticStateMachine.kt +++ b/compiler/testData/checkLocalVariablesTable/completionInSuspendFunction/nonStaticStateMachine.kt @@ -12,6 +12,5 @@ class A { // METHOD : A.foo1(JLkotlin/coroutines/Continuation;)Ljava/lang/Object; // VARIABLE : NAME=this TYPE=LA; INDEX=0 // VARIABLE : NAME=l TYPE=J INDEX=1 -// VARIABLE : NAME=$completion TYPE=Lkotlin/coroutines/Continuation; INDEX=3 // VARIABLE : NAME=$continuation TYPE=Lkotlin/coroutines/Continuation; INDEX=7 // VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=6 \ No newline at end of file diff --git a/compiler/testData/checkLocalVariablesTable/completionInSuspendFunction/staticStateMachine.kt b/compiler/testData/checkLocalVariablesTable/completionInSuspendFunction/staticStateMachine.kt index 2e10b36cc70..7c146204423 100644 --- a/compiler/testData/checkLocalVariablesTable/completionInSuspendFunction/staticStateMachine.kt +++ b/compiler/testData/checkLocalVariablesTable/completionInSuspendFunction/staticStateMachine.kt @@ -9,6 +9,5 @@ suspend fun foo1(l: Long) { // METHOD : StaticStateMachineKt.foo1(JLkotlin/coroutines/Continuation;)Ljava/lang/Object; // VARIABLE : NAME=l TYPE=J INDEX=0 -// VARIABLE : NAME=$completion TYPE=Lkotlin/coroutines/Continuation; INDEX=2 // VARIABLE : NAME=$continuation TYPE=Lkotlin/coroutines/Continuation; INDEX=6 // VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=5 \ No newline at end of file diff --git a/compiler/testData/checkLocalVariablesTable/completionInSuspendFunction/staticStateMachineReceiver.kt b/compiler/testData/checkLocalVariablesTable/completionInSuspendFunction/staticStateMachineReceiver.kt index 182219e5861..21bfd7101b6 100644 --- a/compiler/testData/checkLocalVariablesTable/completionInSuspendFunction/staticStateMachineReceiver.kt +++ b/compiler/testData/checkLocalVariablesTable/completionInSuspendFunction/staticStateMachineReceiver.kt @@ -12,6 +12,5 @@ suspend fun A.foo1(l: Long) { // METHOD : StaticStateMachineReceiverKt.foo1(LA;JLkotlin/coroutines/Continuation;)Ljava/lang/Object; // VARIABLE : NAME=$this$foo1 TYPE=LA; INDEX=0 // VARIABLE : NAME=l TYPE=J INDEX=1 -// VARIABLE : NAME=$completion TYPE=Lkotlin/coroutines/Continuation; INDEX=3 // VARIABLE : NAME=$continuation TYPE=Lkotlin/coroutines/Continuation; INDEX=7 // VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=6 \ No newline at end of file