Wrap result method node with max stack calculator in inliner
#KT-31347 Fixed
This commit is contained in:
@@ -153,7 +153,7 @@ class MethodInliner(
|
|||||||
LocalVariablesSorter(
|
LocalVariablesSorter(
|
||||||
resultNode.access,
|
resultNode.access,
|
||||||
resultNode.desc,
|
resultNode.desc,
|
||||||
resultNode
|
wrapWithMaxLocalCalc(resultNode)
|
||||||
), AsmTypeRemapper(remapper, result)
|
), 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"
|
||||||
|
}
|
||||||
+10
@@ -3545,6 +3545,16 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
|||||||
runTest("compiler/testData/codegen/boxInline/suspend/kt26658.kt");
|
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")
|
@TestMetadata("multipleLocals.kt")
|
||||||
public void testMultipleLocals_1_2() throws Exception {
|
public void testMultipleLocals_1_2() throws Exception {
|
||||||
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines.experimental");
|
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines.experimental");
|
||||||
|
|||||||
Generated
+10
@@ -3545,6 +3545,16 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
|||||||
runTest("compiler/testData/codegen/boxInline/suspend/kt26658.kt");
|
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")
|
@TestMetadata("multipleLocals.kt")
|
||||||
public void testMultipleLocals_1_2() throws Exception {
|
public void testMultipleLocals_1_2() throws Exception {
|
||||||
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines.experimental");
|
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines.experimental");
|
||||||
|
|||||||
+10
@@ -3545,6 +3545,16 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
|||||||
runTest("compiler/testData/codegen/boxInline/suspend/kt26658.kt");
|
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")
|
@TestMetadata("multipleLocals.kt")
|
||||||
public void testMultipleLocals_1_2() throws Exception {
|
public void testMultipleLocals_1_2() throws Exception {
|
||||||
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines.experimental");
|
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines.experimental");
|
||||||
|
|||||||
Generated
+5
@@ -88,6 +88,11 @@ public class IrInlineSuspendTestsGenerated extends AbstractIrInlineSuspendTests
|
|||||||
runTest("compiler/testData/codegen/boxInline/suspend/kt26658.kt");
|
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")
|
@TestMetadata("multipleLocals.kt")
|
||||||
public void testMultipleLocals_1_3() throws Exception {
|
public void testMultipleLocals_1_3() throws Exception {
|
||||||
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines");
|
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines");
|
||||||
|
|||||||
+10
@@ -138,6 +138,16 @@ public class InlineSuspendTestsGenerated extends AbstractInlineSuspendTests {
|
|||||||
runTest("compiler/testData/codegen/boxInline/suspend/kt26658.kt");
|
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")
|
@TestMetadata("multipleLocals.kt")
|
||||||
public void testMultipleLocals_1_2() throws Exception {
|
public void testMultipleLocals_1_2() throws Exception {
|
||||||
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines.experimental");
|
runTestWithPackageReplacement("compiler/testData/codegen/boxInline/suspend/multipleLocals.kt", "kotlin.coroutines.experimental");
|
||||||
|
|||||||
Reference in New Issue
Block a user