comparison test/compiler/whitebox/IsMethodCompilableTest.java @ 14203:f9a4b59ae350

8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul Reviewed-by: twisti Contributed-by: anton.ivanov@oracle.com
author iignatyev
date Tue, 31 Dec 2013 19:26:57 +0400
parents 303826f477c6
children bbfe3ac1471d 4ca6dc0799b6 d559dbbded7a
comparison
equal deleted inserted replaced
14202:3e98456aab94 14203:f9a4b59ae350
25 * @test IsMethodCompilableTest 25 * @test IsMethodCompilableTest
26 * @bug 8007270 8006683 8007288 8022832 26 * @bug 8007270 8006683 8007288 8022832
27 * @library /testlibrary /testlibrary/whitebox 27 * @library /testlibrary /testlibrary/whitebox
28 * @build IsMethodCompilableTest 28 * @build IsMethodCompilableTest
29 * @run main ClassFileInstaller sun.hotspot.WhiteBox 29 * @run main ClassFileInstaller sun.hotspot.WhiteBox
30 * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* IsMethodCompilableTest 30 * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest
31 * @summary testing of WB::isMethodCompilable() 31 * @summary testing of WB::isMethodCompilable()
32 * @author igor.ignatyev@oracle.com 32 * @author igor.ignatyev@oracle.com
33 */ 33 */
34 public class IsMethodCompilableTest extends CompilerWhiteBoxTest { 34 public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
35 /** 35 /**
46 PER_METHOD_RECOMPILATION_CUTOFF = 1 + (0xFFFFFFFFL & tmp); 46 PER_METHOD_RECOMPILATION_CUTOFF = 1 + (0xFFFFFFFFL & tmp);
47 } 47 }
48 } 48 }
49 49
50 public static void main(String[] args) throws Exception { 50 public static void main(String[] args) throws Exception {
51 for (TestCase test : TestCase.values()) { 51 CompilerWhiteBoxTest.main(IsMethodCompilableTest::new, args);
52 new IsMethodCompilableTest(test).runTest();
53 }
54 } 52 }
55 53
56 public IsMethodCompilableTest(TestCase testCase) { 54 private IsMethodCompilableTest(TestCase testCase) {
57 super(testCase); 55 super(testCase);
58 // to prevent inlining of #method 56 // to prevent inlining of #method
59 WHITE_BOX.testSetDontInlineMethod(method, true); 57 WHITE_BOX.testSetDontInlineMethod(method, true);
60 } 58 }
61 59
66 * 64 *
67 * @throws Exception if one of the checks fails. 65 * @throws Exception if one of the checks fails.
68 */ 66 */
69 @Override 67 @Override
70 protected void test() throws Exception { 68 protected void test() throws Exception {
71 if (testCase.isOsr && CompilerWhiteBoxTest.MODE.startsWith( 69 if (testCase.isOsr() && CompilerWhiteBoxTest.MODE.startsWith(
72 "compiled ")) { 70 "compiled ")) {
73 System.err.printf("Warning: %s is not applicable in %s%n", 71 System.err.printf("Warning: %s is not applicable in %s%n",
74 testCase.name(), CompilerWhiteBoxTest.MODE); 72 testCase.name(), CompilerWhiteBoxTest.MODE);
75 return; 73 return;
76 } 74 }
87 85
88 // deoptimize 'PerMethodRecompilationCutoff' times and clear state 86 // deoptimize 'PerMethodRecompilationCutoff' times and clear state
89 for (long i = 0L, n = PER_METHOD_RECOMPILATION_CUTOFF - 1; i < n; ++i) { 87 for (long i = 0L, n = PER_METHOD_RECOMPILATION_CUTOFF - 1; i < n; ++i) {
90 compileAndDeoptimize(); 88 compileAndDeoptimize();
91 } 89 }
92 if (!testCase.isOsr && !isCompilable()) { 90 if (!testCase.isOsr() && !isCompilable()) {
93 // in osr test case count of deopt maybe more than iterations 91 // in osr test case count of deopt maybe more than iterations
94 throw new RuntimeException(method + " is not compilable after " 92 throw new RuntimeException(method + " is not compilable after "
95 + (PER_METHOD_RECOMPILATION_CUTOFF - 1) + " iterations"); 93 + (PER_METHOD_RECOMPILATION_CUTOFF - 1) + " iterations");
96 } 94 }
97 WHITE_BOX.clearMethodState(method); 95 WHITE_BOX.clearMethodState(method);
100 long i; 98 long i;
101 for (i = 0L; i < PER_METHOD_RECOMPILATION_CUTOFF 99 for (i = 0L; i < PER_METHOD_RECOMPILATION_CUTOFF
102 && isCompilable(); ++i) { 100 && isCompilable(); ++i) {
103 compileAndDeoptimize(); 101 compileAndDeoptimize();
104 } 102 }
105 if (!testCase.isOsr && i != PER_METHOD_RECOMPILATION_CUTOFF) { 103 if (!testCase.isOsr() && i != PER_METHOD_RECOMPILATION_CUTOFF) {
106 // in osr test case count of deopt maybe more than iterations 104 // in osr test case count of deopt maybe more than iterations
107 throw new RuntimeException(method + " is not compilable after " 105 throw new RuntimeException(method + " is not compilable after "
108 + i + " iterations, but must only after " 106 + i + " iterations, but must only after "
109 + PER_METHOD_RECOMPILATION_CUTOFF); 107 + PER_METHOD_RECOMPILATION_CUTOFF);
110 } 108 }