When by String constants:

Generate TABLESWITCH/LOOKUPSWITCH bytecode operation for when operator by String constants
This commit is contained in:
Denis Zharkov
2014-07-16 20:09:49 +04:00
committed by Evgeny Gerashchenko
parent 5a1c995b5c
commit d4cb822ee8
18 changed files with 511 additions and 75 deletions
@@ -31,7 +31,7 @@ import org.jetbrains.jet.codegen.AbstractBytecodeTextTest;
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/codegen/bytecodeText")
@InnerTestClasses({BytecodeTextTestGenerated.BoxingOptimization.class, BytecodeTextTestGenerated.Constants.class, BytecodeTextTestGenerated.DirectInvoke.class, BytecodeTextTestGenerated.Statements.class, BytecodeTextTestGenerated.WhenEnumOptimization.class})
@InnerTestClasses({BytecodeTextTestGenerated.BoxingOptimization.class, BytecodeTextTestGenerated.Constants.class, BytecodeTextTestGenerated.DirectInvoke.class, BytecodeTextTestGenerated.Statements.class, BytecodeTextTestGenerated.WhenEnumOptimization.class, BytecodeTextTestGenerated.WhenStringOptimization.class})
public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
@TestMetadata("accessorForProtected.kt")
public void testAccessorForProtected() throws Exception {
@@ -352,6 +352,49 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
}
@TestMetadata("compiler/testData/codegen/bytecodeText/whenStringOptimization")
public static class WhenStringOptimization extends AbstractBytecodeTextTest {
public void testAllFilesPresentInWhenStringOptimization() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/bytecodeText/whenStringOptimization"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("denseHashCode.kt")
public void testDenseHashCode() throws Exception {
doTest("compiler/testData/codegen/bytecodeText/whenStringOptimization/denseHashCode.kt");
}
@TestMetadata("duplicatingItems.kt")
public void testDuplicatingItems() throws Exception {
doTest("compiler/testData/codegen/bytecodeText/whenStringOptimization/duplicatingItems.kt");
}
@TestMetadata("duplicatingItemsSameHashCode.kt")
public void testDuplicatingItemsSameHashCode() throws Exception {
doTest("compiler/testData/codegen/bytecodeText/whenStringOptimization/duplicatingItemsSameHashCode.kt");
}
@TestMetadata("expression.kt")
public void testExpression() throws Exception {
doTest("compiler/testData/codegen/bytecodeText/whenStringOptimization/expression.kt");
}
@TestMetadata("nonInlinedConst.kt")
public void testNonInlinedConst() throws Exception {
doTest("compiler/testData/codegen/bytecodeText/whenStringOptimization/nonInlinedConst.kt");
}
@TestMetadata("sameHashCode.kt")
public void testSameHashCode() throws Exception {
doTest("compiler/testData/codegen/bytecodeText/whenStringOptimization/sameHashCode.kt");
}
@TestMetadata("statement.kt")
public void testStatement() throws Exception {
doTest("compiler/testData/codegen/bytecodeText/whenStringOptimization/statement.kt");
}
}
public static Test suite() {
TestSuite suite = new TestSuite("BytecodeTextTestGenerated");
suite.addTestSuite(BytecodeTextTestGenerated.class);
@@ -360,6 +403,7 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
suite.addTestSuite(DirectInvoke.class);
suite.addTestSuite(Statements.class);
suite.addTestSuite(WhenEnumOptimization.class);
suite.addTestSuite(WhenStringOptimization.class);
return suite;
}
}
@@ -31,7 +31,7 @@ import org.jetbrains.jet.codegen.generated.AbstractBlackBoxCodegenTest;
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/codegen/boxWithStdlib")
@InnerTestClasses({BlackBoxWithStdlibCodegenTestGenerated.Annotations.class, BlackBoxWithStdlibCodegenTestGenerated.Arrays.class, BlackBoxWithStdlibCodegenTestGenerated.BoxingOptimization.class, BlackBoxWithStdlibCodegenTestGenerated.CallableReference.class, BlackBoxWithStdlibCodegenTestGenerated.Casts.class, BlackBoxWithStdlibCodegenTestGenerated.DataClasses.class, BlackBoxWithStdlibCodegenTestGenerated.Evaluate.class, BlackBoxWithStdlibCodegenTestGenerated.FullJdk.class, BlackBoxWithStdlibCodegenTestGenerated.HashPMap.class, BlackBoxWithStdlibCodegenTestGenerated.JdkAnnotations.class, BlackBoxWithStdlibCodegenTestGenerated.PlatformNames.class, BlackBoxWithStdlibCodegenTestGenerated.Ranges.class, BlackBoxWithStdlibCodegenTestGenerated.Reflection.class, BlackBoxWithStdlibCodegenTestGenerated.Regressions.class, BlackBoxWithStdlibCodegenTestGenerated.Strings.class, BlackBoxWithStdlibCodegenTestGenerated.ToArray.class, BlackBoxWithStdlibCodegenTestGenerated.Vararg.class, BlackBoxWithStdlibCodegenTestGenerated.When.class, BlackBoxWithStdlibCodegenTestGenerated.WhenEnumOptimization.class})
@InnerTestClasses({BlackBoxWithStdlibCodegenTestGenerated.Annotations.class, BlackBoxWithStdlibCodegenTestGenerated.Arrays.class, BlackBoxWithStdlibCodegenTestGenerated.BoxingOptimization.class, BlackBoxWithStdlibCodegenTestGenerated.CallableReference.class, BlackBoxWithStdlibCodegenTestGenerated.Casts.class, BlackBoxWithStdlibCodegenTestGenerated.DataClasses.class, BlackBoxWithStdlibCodegenTestGenerated.Evaluate.class, BlackBoxWithStdlibCodegenTestGenerated.FullJdk.class, BlackBoxWithStdlibCodegenTestGenerated.HashPMap.class, BlackBoxWithStdlibCodegenTestGenerated.JdkAnnotations.class, BlackBoxWithStdlibCodegenTestGenerated.PlatformNames.class, BlackBoxWithStdlibCodegenTestGenerated.Ranges.class, BlackBoxWithStdlibCodegenTestGenerated.Reflection.class, BlackBoxWithStdlibCodegenTestGenerated.Regressions.class, BlackBoxWithStdlibCodegenTestGenerated.Strings.class, BlackBoxWithStdlibCodegenTestGenerated.ToArray.class, BlackBoxWithStdlibCodegenTestGenerated.Vararg.class, BlackBoxWithStdlibCodegenTestGenerated.When.class, BlackBoxWithStdlibCodegenTestGenerated.WhenEnumOptimization.class, BlackBoxWithStdlibCodegenTestGenerated.WhenStringOptimization.class})
public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInBoxWithStdlib() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxWithStdlib"), Pattern.compile("^(.+)\\.kt$"), true);
@@ -2005,6 +2005,39 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
}
@TestMetadata("compiler/testData/codegen/boxWithStdlib/whenStringOptimization")
public static class WhenStringOptimization extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInWhenStringOptimization() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxWithStdlib/whenStringOptimization"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("duplicatingItems.kt")
public void testDuplicatingItems() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/whenStringOptimization/duplicatingItems.kt");
}
@TestMetadata("duplicatingItemsSameHashCode.kt")
public void testDuplicatingItemsSameHashCode() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/whenStringOptimization/duplicatingItemsSameHashCode.kt");
}
@TestMetadata("expression.kt")
public void testExpression() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/whenStringOptimization/expression.kt");
}
@TestMetadata("sameHashCode.kt")
public void testSameHashCode() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/whenStringOptimization/sameHashCode.kt");
}
@TestMetadata("statement.kt")
public void testStatement() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/whenStringOptimization/statement.kt");
}
}
public static Test suite() {
TestSuite suite = new TestSuite("BlackBoxWithStdlibCodegenTestGenerated");
suite.addTestSuite(BlackBoxWithStdlibCodegenTestGenerated.class);
@@ -2027,6 +2060,7 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
suite.addTestSuite(Vararg.class);
suite.addTestSuite(When.class);
suite.addTestSuite(WhenEnumOptimization.class);
suite.addTestSuite(WhenStringOptimization.class);
return suite;
}
}