KT-5248 Don't wrap variable if it is captured only in inlined closures

Remove non-escaping Ref's on bytecode postprocessing pass.
This commit is contained in:
Dmitry Petrov
2017-01-31 15:43:17 +03:00
parent 3fc106572e
commit 3c09a26e16
38 changed files with 1115 additions and 26 deletions
@@ -4452,6 +4452,63 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
}
}
@TestMetadata("compiler/testData/codegen/box/closures/capturedVarsOptimization")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class CapturedVarsOptimization extends AbstractJsCodegenBoxTest {
public void testAllFilesPresentInCapturedVarsOptimization() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/closures/capturedVarsOptimization"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("capturedInCrossinline.kt")
public void testCapturedInCrossinline() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturedVarsOptimization/capturedInCrossinline.kt");
doTest(fileName);
}
@TestMetadata("capturedInInlineOnlyAssign.kt")
public void testCapturedInInlineOnlyAssign() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyAssign.kt");
doTest(fileName);
}
@TestMetadata("capturedInInlineOnlyCAO.kt")
public void testCapturedInInlineOnlyCAO() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyCAO.kt");
doTest(fileName);
}
@TestMetadata("capturedInInlineOnlyIncrDecr.kt")
public void testCapturedInInlineOnlyIncrDecr() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyIncrDecr.kt");
doTest(fileName);
}
@TestMetadata("capturedInInlineOnlyIndexedCAO.kt")
public void testCapturedInInlineOnlyIndexedCAO() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturedVarsOptimization/capturedInInlineOnlyIndexedCAO.kt");
doTest(fileName);
}
@TestMetadata("capturedVarsOfSize2.kt")
public void testCapturedVarsOfSize2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturedVarsOptimization/capturedVarsOfSize2.kt");
doTest(fileName);
}
@TestMetadata("sharedSlotsWithCapturedVars.kt")
public void testSharedSlotsWithCapturedVars() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturedVarsOptimization/sharedSlotsWithCapturedVars.kt");
doTest(fileName);
}
@TestMetadata("withCoroutines.kt")
public void testWithCoroutines() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/codegen/box/closures/closureInsideClosure")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)