Mercurial > hg > graal-compiler
comparison test/compiler/whitebox/MakeMethodNotCompilableTest.java @ 10113:4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
Reviewed-by: kvn, vlivanov
author | iignatyev |
---|---|
date | Tue, 16 Apr 2013 10:04:01 -0700 |
parents | b84fd7d73702 |
children | d1c9384eecb4 |
comparison
equal
deleted
inserted
replaced
10112:c89eab0b6b30 | 10113:4b2eebe03f93 |
---|---|
25 * @test MakeMethodNotCompilableTest | 25 * @test MakeMethodNotCompilableTest |
26 * @library /testlibrary /testlibrary/whitebox | 26 * @library /testlibrary /testlibrary/whitebox |
27 * @build MakeMethodNotCompilableTest | 27 * @build MakeMethodNotCompilableTest |
28 * @run main ClassFileInstaller sun.hotspot.WhiteBox | 28 * @run main ClassFileInstaller sun.hotspot.WhiteBox |
29 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI MakeMethodNotCompilableTest | 29 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI MakeMethodNotCompilableTest |
30 * @summary testing of WB::makeMethodNotCompilable() | |
30 * @author igor.ignatyev@oracle.com | 31 * @author igor.ignatyev@oracle.com |
31 */ | 32 */ |
32 public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest { | 33 public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest { |
33 | 34 |
34 public static void main(String[] args) throws Exception { | 35 public static void main(String[] args) throws Exception { |
35 // to prevent inlining #method into #compile() | 36 if (args.length == 0) { |
36 WHITE_BOX.testSetDontInlineMethod(METHOD, true); | 37 for (TestCase test : TestCase.values()) { |
37 new MakeMethodNotCompilableTest().runTest(); | 38 new MakeMethodNotCompilableTest(test).runTest(); |
39 } | |
40 } else { | |
41 for (String name : args) { | |
42 new MakeMethodNotCompilableTest( | |
43 TestCase.valueOf(name)).runTest(); | |
44 } | |
45 } | |
38 } | 46 } |
39 | 47 |
40 protected void test() throws Exception { | 48 public MakeMethodNotCompilableTest(TestCase testCase) { |
41 if (!WHITE_BOX.isMethodCompilable(METHOD)) { | 49 super(testCase); |
42 throw new RuntimeException(METHOD + " must be compilable"); | 50 // to prevent inlining of #method |
51 WHITE_BOX.testSetDontInlineMethod(method, true); | |
52 } | |
53 | |
54 /** | |
55 * Tests {@code WB::makeMethodNotCompilable()} by calling it before | |
56 * compilation and checking that method isn't compiled. Also | |
57 * checks that WB::clearMethodState() clears no-compilable flags. For | |
58 * tiered, additional checks for all available levels are conducted. | |
59 * | |
60 * @throws Exception if one of the checks fails. | |
61 */ | |
62 @Override | |
63 protected void test() throws Exception { | |
64 checkNotCompiled(); | |
65 if (!WHITE_BOX.isMethodCompilable(method)) { | |
66 throw new RuntimeException(method + " must be compilable"); | |
43 } | 67 } |
44 WHITE_BOX.makeMethodNotCompilable(METHOD); | 68 |
45 if (WHITE_BOX.isMethodCompilable(METHOD)) { | 69 if (TIERED_COMPILATION) { |
46 throw new RuntimeException(METHOD + " must be not compilable"); | 70 for (int i = 1, n = TIERED_STOP_AT_LEVEL + 1; i < n; ++i) { |
71 WHITE_BOX.makeMethodNotCompilable(method, i); | |
72 if (WHITE_BOX.isMethodCompilable(method, i)) { | |
73 throw new RuntimeException(method | |
74 + " must be not compilable at level" + i); | |
75 } | |
76 WHITE_BOX.enqueueMethodForCompilation(method, i); | |
77 checkNotCompiled(); | |
78 | |
79 if (!WHITE_BOX.isMethodCompilable(method)) { | |
80 System.out.println(method | |
81 + " is not compilable after level " + i); | |
82 } | |
83 } | |
84 | |
85 // WB.clearMethodState() must reset no-compilable flags | |
86 WHITE_BOX.clearMethodState(method); | |
87 if (!WHITE_BOX.isMethodCompilable(method)) { | |
88 throw new RuntimeException(method | |
89 + " is not compilable after clearMethodState()"); | |
90 } | |
91 } | |
92 WHITE_BOX.makeMethodNotCompilable(method); | |
93 if (WHITE_BOX.isMethodCompilable(method)) { | |
94 throw new RuntimeException(method + " must be not compilable"); | |
95 } | |
96 | |
97 compile(); | |
98 checkNotCompiled(); | |
99 if (WHITE_BOX.isMethodCompilable(method)) { | |
100 throw new RuntimeException(method + " must be not compilable"); | |
101 } | |
102 // WB.clearMethodState() must reset no-compilable flags | |
103 WHITE_BOX.clearMethodState(method); | |
104 if (!WHITE_BOX.isMethodCompilable(method)) { | |
105 throw new RuntimeException(method | |
106 + " is not compilable after clearMethodState()"); | |
47 } | 107 } |
48 compile(); | 108 compile(); |
49 checkNotCompiled(METHOD); | 109 checkCompiled(); |
50 if (WHITE_BOX.isMethodCompilable(METHOD)) { | |
51 throw new RuntimeException(METHOD + " must be not compilable"); | |
52 } | |
53 } | 110 } |
54 } | 111 } |