Wrap result method node with max stack calculator in inliner

#KT-31347 Fixed
This commit is contained in:
Ilmir Usmanov
2019-05-21 18:54:36 +03:00
parent 3f6492ab2a
commit 5631306165
7 changed files with 81 additions and 1 deletions
@@ -153,7 +153,7 @@ class MethodInliner(
LocalVariablesSorter(
resultNode.access,
resultNode.desc,
resultNode
wrapWithMaxLocalCalc(resultNode)
), AsmTypeRemapper(remapper, result)
)
@@ -0,0 +1,35 @@
// IGNORE_BACKEND: JVM_IR
// FILE: inlined.kt
// WITH_RUNTIME
// NO_CHECK_LAMBDA_INLINING
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
fun handle(f: suspend () -> Unit) {}
open class Foo {
inline fun foo(crossinline body: suspend (Baz) -> Unit, crossinline createContext: () -> Baz) {
handle {
body(createContext())
}
}
}
class Bar : Foo() {
inline fun bar(crossinline body: suspend (Baz) -> Unit) {
this.foo(body) {
Baz(Unit)
}
}
}
class Baz(unit: Unit)
// FILE: inlineSite.kt
// COMMON_COROUTINES_TEST
fun box(): String {
Bar().bar {}
return "OK"
}
@@ -3545,6 +3545,16 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
runTest("compiler/testData/codegen/boxInline/suspend/kt26658.kt");
}
@TestMetadata("maxStackWithCrossinline.kt")
public void testMaxStackWithCrossinline_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("maxStackWithCrossinline.kt")
public void testMaxStackWithCrossinline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines");
}
@TestMetadata("multipleLocals.kt")
public void testMultipleLocals_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines.experimental");
@@ -3545,6 +3545,16 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
runTest("compiler/testData/codegen/boxInline/suspend/kt26658.kt");
}
@TestMetadata("maxStackWithCrossinline.kt")
public void testMaxStackWithCrossinline_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("maxStackWithCrossinline.kt")
public void testMaxStackWithCrossinline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines");
}
@TestMetadata("multipleLocals.kt")
public void testMultipleLocals_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines.experimental");
@@ -3545,6 +3545,16 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
runTest("compiler/testData/codegen/boxInline/suspend/kt26658.kt");
}
@TestMetadata("maxStackWithCrossinline.kt")
public void testMaxStackWithCrossinline_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("maxStackWithCrossinline.kt")
public void testMaxStackWithCrossinline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines");
}
@TestMetadata("multipleLocals.kt")
public void testMultipleLocals_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines.experimental");
@@ -88,6 +88,11 @@ public class IrInlineSuspendTestsGenerated extends AbstractIrInlineSuspendTests
runTest("compiler/testData/codegen/boxInline/suspend/kt26658.kt");
}
@TestMetadata("maxStackWithCrossinline.kt")
public void testMaxStackWithCrossinline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines");
}
@TestMetadata("multipleLocals.kt")
public void testMultipleLocals_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines");
@@ -138,6 +138,16 @@ public class InlineSuspendTestsGenerated extends AbstractInlineSuspendTests {
runTest("compiler/testData/codegen/boxInline/suspend/kt26658.kt");
}
@TestMetadata("maxStackWithCrossinline.kt")
public void testMaxStackWithCrossinline_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("maxStackWithCrossinline.kt")
public void testMaxStackWithCrossinline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/maxStackWithCrossinline.kt", "kotlin.coroutines");
}
@TestMetadata("multipleLocals.kt")
public void testMultipleLocals_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines.experimental");