IR: create shared variables for val-variables when needed

This is possible when a lambda's contract guarantees initialization of a
variable.
This commit is contained in:
Alexander Udalov
2019-11-04 20:13:25 +01:00
parent 5c4b47c336
commit 66e19b13ce
18 changed files with 116 additions and 48 deletions
@@ -777,6 +777,16 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/capturedVarsOptimization/capturedInNoInlneInsideChainOfInlineFuns.kt");
}
@TestMetadata("capturedValInLambdaInitializedInside.kt")
public void testCapturedValInLambdaInitializedInside() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/capturedVarsOptimization/capturedValInLambdaInitializedInside.kt");
}
@TestMetadata("capturedValInLambdaInitializedOutside.kt")
public void testCapturedValInLambdaInitializedOutside() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/capturedVarsOptimization/capturedValInLambdaInitializedOutside.kt");
}
@TestMetadata("capturedVarsOfSize2.kt")
public void testCapturedVarsOfSize2() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/capturedVarsOptimization/capturedVarsOfSize2.kt");