Mercurial > hg > graal-compiler
annotate test/compiler/whitebox/MakeMethodNotCompilableTest.java @ 21472:c190ed6b84bf
added checkcopyrights command (from mxtool2)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 22 May 2015 23:11:17 +0200 |
parents | 7848fc12602b |
children |
rev | line source |
---|---|
8051 | 1 /* |
14680
2dfa56e10640
8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents:
14203
diff
changeset
|
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
8051 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 | |
24 /* | |
25 * @test MakeMethodNotCompilableTest | |
12073 | 26 * @bug 8012322 8006683 8007288 8022832 |
8098
1b0dc9f87e75
8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
8051
diff
changeset
|
27 * @library /testlibrary /testlibrary/whitebox |
1b0dc9f87e75
8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
8051
diff
changeset
|
28 * @build MakeMethodNotCompilableTest |
1b0dc9f87e75
8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
8051
diff
changeset
|
29 * @run main ClassFileInstaller sun.hotspot.WhiteBox |
14203
f9a4b59ae350
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
12328
diff
changeset
|
30 * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* MakeMethodNotCompilableTest |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
31 * @summary testing of WB::makeMethodNotCompilable() |
8051 | 32 * @author igor.ignatyev@oracle.com |
33 */ | |
34 public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest { | |
12073 | 35 private int bci; |
8051 | 36 public static void main(String[] args) throws Exception { |
14203
f9a4b59ae350
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
12328
diff
changeset
|
37 CompilerWhiteBoxTest.main(MakeMethodNotCompilableTest::new, args); |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
38 } |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
39 |
14203
f9a4b59ae350
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
12328
diff
changeset
|
40 private MakeMethodNotCompilableTest(TestCase testCase) { |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
41 super(testCase); |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
42 // to prevent inlining of #method |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
43 WHITE_BOX.testSetDontInlineMethod(method, true); |
8051 | 44 } |
45 | |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
46 /** |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
47 * Tests {@code WB::makeMethodNotCompilable()} by calling it before |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
48 * compilation and checking that method isn't compiled. Also |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
49 * checks that WB::clearMethodState() clears no-compilable flags. For |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
50 * tiered, additional checks for all available levels are conducted. |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
51 * |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
52 * @throws Exception if one of the checks fails. |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
53 */ |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
54 @Override |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
55 protected void test() throws Exception { |
14680
2dfa56e10640
8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents:
14203
diff
changeset
|
56 if (skipXcompOSR()) { |
2dfa56e10640
8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents:
14203
diff
changeset
|
57 return; |
12328
303826f477c6
8023452: TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents:
12073
diff
changeset
|
58 } |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
59 checkNotCompiled(); |
12073 | 60 if (!isCompilable()) { |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
61 throw new RuntimeException(method + " must be compilable"); |
8051 | 62 } |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
63 |
12073 | 64 bci = getBci(); |
65 | |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
66 if (TIERED_COMPILATION) { |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
67 final int tierLimit = TIERED_STOP_AT_LEVEL + 1; |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
68 for (int testedTier = 1; testedTier < tierLimit; ++testedTier) { |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
69 testTier(testedTier); |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
70 } |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
71 for (int testedTier = 1; testedTier < tierLimit; ++testedTier) { |
12073 | 72 makeNotCompilable(testedTier); |
73 if (isCompilable(testedTier)) { | |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
74 throw new RuntimeException(method |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
75 + " must be not compilable at level" + testedTier); |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
76 } |
12073 | 77 WHITE_BOX.enqueueMethodForCompilation(method, testedTier, bci); |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
78 checkNotCompiled(); |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
79 |
12073 | 80 if (!isCompilable()) { |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
81 System.out.println(method |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
82 + " is not compilable after level " + testedTier); |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
83 } |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
84 } |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
85 } else { |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
86 compile(); |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
87 checkCompiled(); |
12073 | 88 int compLevel = getCompLevel(); |
89 deoptimize(); | |
90 makeNotCompilable(compLevel); | |
91 if (isCompilable(COMP_LEVEL_ANY)) { | |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
92 throw new RuntimeException(method |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
93 + " must be not compilable at CompLevel::CompLevel_any," |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
94 + " after it is not compilable at " + compLevel); |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
95 } |
12073 | 96 |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
97 WHITE_BOX.clearMethodState(method); |
12073 | 98 if (!isCompilable()) { |
99 throw new RuntimeException(method | |
100 + " is not compilable after clearMethodState()"); | |
101 } | |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
102 |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
103 // nocompilable at opposite level must make no sense |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
104 int oppositeLevel; |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
105 if (isC1Compile(compLevel)) { |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
106 oppositeLevel = COMP_LEVEL_FULL_OPTIMIZATION; |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
107 } else { |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
108 oppositeLevel = COMP_LEVEL_SIMPLE; |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
109 } |
12073 | 110 makeNotCompilable(oppositeLevel); |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
111 |
12073 | 112 if (!isCompilable(COMP_LEVEL_ANY)) { |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
113 throw new RuntimeException(method |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
114 + " must be compilable at CompLevel::CompLevel_any," |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
115 + " even it is not compilable at opposite level [" |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
116 + compLevel + "]"); |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
117 } |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
118 |
12073 | 119 if (!isCompilable(compLevel)) { |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
120 throw new RuntimeException(method |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
121 + " must be compilable at level " + compLevel |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
122 + ", even it is not compilable at opposite level [" |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
123 + compLevel + "]"); |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
124 } |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
125 } |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
126 |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
127 // clearing after tiered/non-tiered tests |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
128 // WB.clearMethodState() must reset no-compilable flags |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
129 WHITE_BOX.clearMethodState(method); |
12073 | 130 if (!isCompilable()) { |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
131 throw new RuntimeException(method |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
132 + " is not compilable after clearMethodState()"); |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
133 } |
20607
f5f752e74840
8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents:
20604
diff
changeset
|
134 // Make method not (OSR-)compilable (depending on testCase.isOsr()) |
12073 | 135 makeNotCompilable(); |
136 if (isCompilable()) { | |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
137 throw new RuntimeException(method + " must be not compilable"); |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
138 } |
20607
f5f752e74840
8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents:
20604
diff
changeset
|
139 // Try to (OSR-)compile method |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
140 compile(); |
20607
f5f752e74840
8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents:
20604
diff
changeset
|
141 // Method should not be (OSR-)compiled |
f5f752e74840
8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents:
20604
diff
changeset
|
142 checkNotCompiled(testCase.isOsr()); |
12073 | 143 if (isCompilable()) { |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
144 throw new RuntimeException(method + " must be not compilable"); |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
145 } |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
146 // WB.clearMethodState() must reset no-compilable flags |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
147 WHITE_BOX.clearMethodState(method); |
12073 | 148 if (!isCompilable()) { |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
149 throw new RuntimeException(method |
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
150 + " is not compilable after clearMethodState()"); |
8051 | 151 } |
152 compile(); | |
10113
4b2eebe03f93
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
9080
diff
changeset
|
153 checkCompiled(); |
8051 | 154 } |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
155 |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
156 // separately tests each tier |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
157 private void testTier(int testedTier) { |
12073 | 158 if (!isCompilable(testedTier)) { |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
159 throw new RuntimeException(method |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
160 + " is not compilable on start"); |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
161 } |
12073 | 162 makeNotCompilable(testedTier); |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
163 |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
164 // tests for all other tiers |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
165 for (int anotherTier = 1, tierLimit = TIERED_STOP_AT_LEVEL + 1; |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
166 anotherTier < tierLimit; ++anotherTier) { |
12073 | 167 boolean isCompilable = isCompilable(anotherTier); |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
168 if (sameCompile(testedTier, anotherTier)) { |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
169 if (isCompilable) { |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
170 throw new RuntimeException(method |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
171 + " must be not compilable at level " + anotherTier |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
172 + ", if it is not compilable at " + testedTier); |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
173 } |
12073 | 174 WHITE_BOX.enqueueMethodForCompilation(method, anotherTier, bci); |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
175 checkNotCompiled(); |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
176 } else { |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
177 if (!isCompilable) { |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
178 throw new RuntimeException(method |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
179 + " must be compilable at level " + anotherTier |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
180 + ", even if it is not compilable at " |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
181 + testedTier); |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
182 } |
12073 | 183 WHITE_BOX.enqueueMethodForCompilation(method, anotherTier, bci); |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
184 checkCompiled(); |
12073 | 185 deoptimize(); |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
186 } |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
187 |
12073 | 188 if (!isCompilable(COMP_LEVEL_ANY)) { |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
189 throw new RuntimeException(method |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
190 + " must be compilable at 'CompLevel::CompLevel_any'" |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
191 + ", if it is not compilable only at " + testedTier); |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
192 } |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
193 } |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
194 |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
195 // clear state after test |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
196 WHITE_BOX.clearMethodState(method); |
12073 | 197 if (!isCompilable(testedTier)) { |
10200
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
198 throw new RuntimeException(method |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
199 + " is not compilable after clearMethodState()"); |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
200 } |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
201 } |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
202 |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
203 private boolean sameCompile(int level1, int level2) { |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
204 if (level1 == level2) { |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
205 return true; |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
206 } |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
207 if (isC1Compile(level1) && isC1Compile(level2)) { |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
208 return true; |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
209 } |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
210 if (isC2Compile(level1) && isC2Compile(level2)) { |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
211 return true; |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
212 } |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
213 return false; |
d1c9384eecb4
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
10113
diff
changeset
|
214 } |
12073 | 215 |
216 private int getBci() { | |
217 compile(); | |
218 checkCompiled(); | |
219 int result = WHITE_BOX.getMethodEntryBci(method); | |
220 deoptimize(); | |
221 WHITE_BOX.clearMethodState(method); | |
222 return result; | |
223 } | |
8051 | 224 } |