JVM_IR: sidestep defective getMethodAsmFlags when inlining lambdas

It uses isStaticMethod to determine whether to set ACC_STATIC, which is
not correct (see PR #2341). This results in using incorrectly typed
opcodes (as all arguments are shifted by 1) when modifying the inlined
lambda's bytecode. For example, in the test added by this commit, these
opcodes are inserted to spill the stack into locals before calling
another inline function.

Because getMethodAsmFlags is used by the non-IR backend (see PR #2341
again for why changing stuff might not be a good idea), the proposed
solution is to ditch it completely and override generateLambdaBody in
IrExpressionLambdaImpl to use FunctionCodegen's IR-based flag
computation logic.
This commit is contained in:
pyos
2019-05-24 13:57:42 +02:00
committed by max-kammerer
parent 82e4985aa0
commit 6d19eb1853
9 changed files with 59 additions and 61 deletions
@@ -2914,6 +2914,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
runTest("compiler/testData/codegen/boxInline/simple/funImportedFromObject.kt");
}
@TestMetadata("inlineCallInInlineLambda.kt")
public void testInlineCallInInlineLambda() throws Exception {
runTest("compiler/testData/codegen/boxInline/simple/inlineCallInInlineLambda.kt");
}
@TestMetadata("kt17431.kt")
public void testKt17431() throws Exception {
runTest("compiler/testData/codegen/boxInline/simple/kt17431.kt");