Skip to content

Commit bca64cc

Browse files
author
songruiwang
committed
Skip restoring this when generating spill and unspill for coroutines
1 parent eacf69f commit bca64cc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,9 @@ class CoroutineTransformerMethodVisitor(
739739
)
740740
})
741741

742-
if (spillableVariable.slot !in suspendLambdaParameters) {
742+
// skip restoring this
743+
val isInstanceThisVariable = !isStatic(methodNode.access) && spillableVariable.slot == 0
744+
if (spillableVariable.slot !in suspendLambdaParameters && !isInstanceThisVariable) {
743745
// restore variable after suspension call
744746
insert(suspension.tryCatchBlockEndLabelAfterSuspensionCall, withInstructionAdapter {
745747
load(continuationIndex, AsmTypes.OBJECT_TYPE)

0 commit comments

Comments
 (0)