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:
Ilmir Usmanov
2018-03-27 15:49:09 +03:00
parent 58bac6882d
commit 4070f13e26
18 changed files with 662 additions and 17 deletions
@@ -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);
}