Do not generate beforeInlineMarker on tailrec jump
Before this change, the codegen used to generate beforeInlineMarker in order to spill variables later. However, since the tailrec call is replaced with jump, no afterInlineMarker is generated, leading to inconsistency of these markers. Thus, the spilling fails. This change disables generating of beforeInlineMarker. #KT-21521: Fixed
This commit is contained in:
@@ -2416,7 +2416,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
) {
|
||||
boolean isSafeCallOrOnStack = receiver instanceof StackValue.SafeCall || receiver instanceof StackValue.OnStack;
|
||||
|
||||
if (isSuspendCall && !isSafeCallOrOnStack) {
|
||||
if (isSuspendCall && !isSafeCallOrOnStack && !tailRecursionCodegen.isTailRecursion(resolvedCall)) {
|
||||
// Inline markers are used to spill the stack before coroutine suspension
|
||||
addInlineMarker(v, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user