Mercurial > hg > truffle
comparison test/compiler/whitebox/ClearMethodStateTest.java @ 10423:a6697eaddebd
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 19 Jun 2013 21:54:38 +0200 |
parents | 4b2eebe03f93 |
children | 11237ee74aae |
comparison
equal
deleted
inserted
replaced
10422:a47dd157277e | 10423:a6697eaddebd |
---|---|
25 * @test ClearMethodStateTest | 25 * @test ClearMethodStateTest |
26 * @library /testlibrary /testlibrary/whitebox | 26 * @library /testlibrary /testlibrary/whitebox |
27 * @build ClearMethodStateTest | 27 * @build ClearMethodStateTest |
28 * @run main ClassFileInstaller sun.hotspot.WhiteBox | 28 * @run main ClassFileInstaller sun.hotspot.WhiteBox |
29 * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ClearMethodStateTest | 29 * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ClearMethodStateTest |
30 * @summary testing of WB::clearMethodState() | |
30 * @author igor.ignatyev@oracle.com | 31 * @author igor.ignatyev@oracle.com |
31 */ | 32 */ |
32 public class ClearMethodStateTest extends CompilerWhiteBoxTest { | 33 public class ClearMethodStateTest extends CompilerWhiteBoxTest { |
34 | |
33 public static void main(String[] args) throws Exception { | 35 public static void main(String[] args) throws Exception { |
34 // to prevent inlining #method into #compile() and #test() | 36 for (TestCase test : TestCase.values()) { |
35 WHITE_BOX.testSetDontInlineMethod(METHOD, true); | 37 new ClearMethodStateTest(test).runTest(); |
36 new ClearMethodStateTest().runTest(); | 38 } |
37 } | 39 } |
38 | 40 |
41 public ClearMethodStateTest(TestCase testCase) { | |
42 super(testCase); | |
43 // to prevent inlining of #method | |
44 WHITE_BOX.testSetDontInlineMethod(method, true); | |
45 } | |
46 | |
47 | |
48 /** | |
49 * Tests {@code WB::clearMethodState()} by calling it before/after | |
50 * compilation. For non-tiered, checks that counters will be rested after | |
51 * clearing of method state. | |
52 * | |
53 * @throws Exception if one of the checks fails. | |
54 */ | |
55 @Override | |
39 protected void test() throws Exception { | 56 protected void test() throws Exception { |
40 checkNotCompiled(METHOD); | 57 checkNotCompiled(); |
41 compile(); | 58 compile(); |
42 checkCompiled(METHOD); | 59 WHITE_BOX.clearMethodState(method); |
43 WHITE_BOX.clearMethodState(METHOD); | 60 checkCompiled(); |
44 WHITE_BOX.deoptimizeMethod(METHOD); | 61 WHITE_BOX.clearMethodState(method); |
45 checkNotCompiled(METHOD); | 62 WHITE_BOX.deoptimizeMethod(method); |
63 checkNotCompiled(); | |
46 | 64 |
47 | 65 |
48 if (!TIERED_COMPILATION) { | 66 if (!TIERED_COMPILATION) { |
49 WHITE_BOX.clearMethodState(METHOD); | 67 WHITE_BOX.clearMethodState(method); |
50 compile(COMPILE_THRESHOLD); | 68 compile(COMPILE_THRESHOLD); |
51 checkCompiled(METHOD); | 69 checkCompiled(); |
52 | 70 |
53 WHITE_BOX.deoptimizeMethod(METHOD); | 71 WHITE_BOX.deoptimizeMethod(method); |
54 checkNotCompiled(METHOD); | 72 checkNotCompiled(); |
55 WHITE_BOX.clearMethodState(METHOD); | 73 WHITE_BOX.clearMethodState(method); |
56 | 74 |
75 // invoke method one less time than needed to compile | |
57 if (COMPILE_THRESHOLD > 1) { | 76 if (COMPILE_THRESHOLD > 1) { |
58 compile(COMPILE_THRESHOLD - 1); | 77 compile(COMPILE_THRESHOLD - 1); |
59 checkNotCompiled(METHOD); | 78 checkNotCompiled(); |
60 } else { | 79 } else { |
61 System.err.println("Warning: 'CompileThreshold' <= 1"); | 80 System.err.println("Warning: 'CompileThreshold' <= 1"); |
62 } | 81 } |
63 | 82 |
64 method(); | 83 compile(1); |
65 checkCompiled(METHOD); | 84 checkCompiled(); |
66 } else { | 85 } else { |
67 System.err.println( | 86 System.err.println( |
68 "Warning: part of test is not applicable in Tiered"); | 87 "Warning: part of test is not applicable in Tiered"); |
69 } | 88 } |
70 } | 89 } |