Do not generate fields for unused suspend lambda parameters

This also allows us to not spill them in the lambda.
But, disable this optimization for local named functions.

 #KT-16222 In progress
This commit is contained in:
Ilmir Usmanov
2020-06-11 01:57:10 +02:00
parent a292eb865b
commit d9821412d0
21 changed files with 850 additions and 37 deletions
@@ -300,6 +300,49 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
public void testTcoContinuation_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.kt", "kotlin.coroutines");
}
@TestMetadata("compiler/testData/codegen/bytecodeListing/coroutines/spilling")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Spilling extends AbstractBytecodeListingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInSpilling() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/coroutines/spilling"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("component1.kt")
public void testComponent1() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/coroutines/spilling/component1.kt");
}
@TestMetadata("destructured.kt")
public void testDestructured() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/coroutines/spilling/destructured.kt");
}
@TestMetadata("field.kt")
public void testField() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/coroutines/spilling/field.kt");
}
@TestMetadata("lambda.kt")
public void testLambda() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/coroutines/spilling/lambda.kt");
}
@TestMetadata("select.kt")
public void testSelect() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/coroutines/spilling/select.kt");
}
@TestMetadata("unreachable.kt")
public void testUnreachable() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/coroutines/spilling/unreachable.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/bytecodeListing/inline")
@@ -270,6 +270,49 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
public void testTcoContinuation_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutines/tcoContinuation.kt", "kotlin.coroutines");
}
@TestMetadata("compiler/testData/codegen/bytecodeListing/coroutines/spilling")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Spilling extends AbstractIrBytecodeListingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
public void testAllFilesPresentInSpilling() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/coroutines/spilling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("component1.kt")
public void testComponent1() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/coroutines/spilling/component1.kt");
}
@TestMetadata("destructured.kt")
public void testDestructured() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/coroutines/spilling/destructured.kt");
}
@TestMetadata("field.kt")
public void testField() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/coroutines/spilling/field.kt");
}
@TestMetadata("lambda.kt")
public void testLambda() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/coroutines/spilling/lambda.kt");
}
@TestMetadata("select.kt")
public void testSelect() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/coroutines/spilling/select.kt");
}
@TestMetadata("unreachable.kt")
public void testUnreachable() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/coroutines/spilling/unreachable.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/bytecodeListing/inline")