Optimize const vals by inlining them at use sites

#KT-11734 Fixed
 #KT-13570 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2016-12-05 12:02:52 +03:00
parent 8c1e165f18
commit 0134b8819b
28 changed files with 210 additions and 136 deletions
@@ -1256,6 +1256,12 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/bytecodeText/lazyCodegen"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("inlineConstInsideComparison.kt")
public void testInlineConstInsideComparison() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/lazyCodegen/inlineConstInsideComparison.kt");
doTest(fileName);
}
@TestMetadata("negateConst.kt")
public void testNegateConst() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/lazyCodegen/negateConst.kt");
@@ -1562,17 +1568,35 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
doTest(fileName);
}
@TestMetadata("inlineConstValsInsideWhen.kt")
public void testInlineConstValsInsideWhen() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/when/inlineConstValsInsideWhen.kt");
doTest(fileName);
}
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/when/integralWhenWithNoInlinedConstants.kt");
doTest(fileName);
}
@TestMetadata("qualifiedConstValsInsideWhen.kt")
public void testQualifiedConstValsInsideWhen() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/when/qualifiedConstValsInsideWhen.kt");
doTest(fileName);
}
@TestMetadata("sealedWhenInitialization.kt")
public void testSealedWhenInitialization() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/when/sealedWhenInitialization.kt");
doTest(fileName);
}
@TestMetadata("simpleConstValsInsideWhen.kt")
public void testSimpleConstValsInsideWhen() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/when/simpleConstValsInsideWhen.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/whenEnumOptimization")
@@ -1676,6 +1700,12 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
doTest(fileName);
}
@TestMetadata("inlineStringConstInsideWhen.kt")
public void testInlineStringConstInsideWhen() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/whenStringOptimization/inlineStringConstInsideWhen.kt");
doTest(fileName);
}
@TestMetadata("nonInlinedConst.kt")
public void testNonInlinedConst() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/whenStringOptimization/nonInlinedConst.kt");