author | malenkov |
Thu, 22 May 2014 21:05:30 +0400 | |
changeset 25100 | d527cc827d7d |
parent 23207 | fc39038d37dc |
child 25379 | d50969e81568 |
permissions | -rw-r--r-- |
15621 | 1 |
/* |
23207
fc39038d37dc
8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents:
22214
diff
changeset
|
2 |
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
15621 | 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 |
|
19332 | 26 |
* @bug 8012322 8006683 8007288 8022832 |
15793
4867678e3517
8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
15621
diff
changeset
|
27 |
* @library /testlibrary /testlibrary/whitebox |
4867678e3517
8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
15621
diff
changeset
|
28 |
* @build MakeMethodNotCompilableTest |
4867678e3517
8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
15621
diff
changeset
|
29 |
* @run main ClassFileInstaller sun.hotspot.WhiteBox |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
20294
diff
changeset
|
30 |
* @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* MakeMethodNotCompilableTest |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
31 |
* @summary testing of WB::makeMethodNotCompilable() |
15621 | 32 |
* @author igor.ignatyev@oracle.com |
33 |
*/ |
|
34 |
public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest { |
|
19332 | 35 |
private int bci; |
15621 | 36 |
public static void main(String[] args) throws Exception { |
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
20294
diff
changeset
|
37 |
CompilerWhiteBoxTest.main(MakeMethodNotCompilableTest::new, args); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
38 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
39 |
|
22214
c551021e75b2
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents:
20294
diff
changeset
|
40 |
private MakeMethodNotCompilableTest(TestCase testCase) { |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
41 |
super(testCase); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
42 |
// to prevent inlining of #method |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
43 |
WHITE_BOX.testSetDontInlineMethod(method, true); |
15621 | 44 |
} |
45 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
46 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
47 |
* Tests {@code WB::makeMethodNotCompilable()} by calling it before |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
48 |
* compilation and checking that method isn't compiled. Also |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
49 |
* checks that WB::clearMethodState() clears no-compilable flags. For |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
50 |
* tiered, additional checks for all available levels are conducted. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
51 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
52 |
* @throws Exception if one of the checks fails. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
53 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
54 |
@Override |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
55 |
protected void test() throws Exception { |
23207
fc39038d37dc
8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents:
22214
diff
changeset
|
56 |
if (skipXcompOSR()) { |
fc39038d37dc
8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents:
22214
diff
changeset
|
57 |
return; |
20294
af95d17f2e04
8023452: TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents:
19332
diff
changeset
|
58 |
} |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
59 |
checkNotCompiled(); |
19332 | 60 |
if (!isCompilable()) { |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
61 |
throw new RuntimeException(method + " must be compilable"); |
15621 | 62 |
} |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
63 |
|
19332 | 64 |
bci = getBci(); |
65 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
66 |
if (TIERED_COMPILATION) { |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
67 |
final int tierLimit = TIERED_STOP_AT_LEVEL + 1; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
68 |
for (int testedTier = 1; testedTier < tierLimit; ++testedTier) { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
69 |
testTier(testedTier); |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
70 |
} |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
71 |
for (int testedTier = 1; testedTier < tierLimit; ++testedTier) { |
19332 | 72 |
makeNotCompilable(testedTier); |
73 |
if (isCompilable(testedTier)) { |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
74 |
throw new RuntimeException(method |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
75 |
+ " must be not compilable at level" + testedTier); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
76 |
} |
19332 | 77 |
WHITE_BOX.enqueueMethodForCompilation(method, testedTier, bci); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
78 |
checkNotCompiled(); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
79 |
|
19332 | 80 |
if (!isCompilable()) { |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
81 |
System.out.println(method |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
82 |
+ " is not compilable after level " + testedTier); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
83 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
84 |
} |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
85 |
} else { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
86 |
compile(); |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
87 |
checkCompiled(); |
19332 | 88 |
int compLevel = getCompLevel(); |
89 |
deoptimize(); |
|
90 |
makeNotCompilable(compLevel); |
|
91 |
if (isCompilable(COMP_LEVEL_ANY)) { |
|
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
92 |
throw new RuntimeException(method |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
93 |
+ " must be not compilable at CompLevel::CompLevel_any," |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
94 |
+ " after it is not compilable at " + compLevel); |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
95 |
} |
19332 | 96 |
|
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
97 |
WHITE_BOX.clearMethodState(method); |
19332 | 98 |
if (!isCompilable()) { |
99 |
throw new RuntimeException(method |
|
100 |
+ " is not compilable after clearMethodState()"); |
|
101 |
} |
|
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
102 |
|
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
103 |
// nocompilable at opposite level must make no sense |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
104 |
int oppositeLevel; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
105 |
if (isC1Compile(compLevel)) { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
106 |
oppositeLevel = COMP_LEVEL_FULL_OPTIMIZATION; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
107 |
} else { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
108 |
oppositeLevel = COMP_LEVEL_SIMPLE; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
109 |
} |
19332 | 110 |
makeNotCompilable(oppositeLevel); |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
111 |
|
19332 | 112 |
if (!isCompilable(COMP_LEVEL_ANY)) { |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
113 |
throw new RuntimeException(method |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
114 |
+ " must be compilable at CompLevel::CompLevel_any," |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
115 |
+ " even it is not compilable at opposite level [" |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
116 |
+ compLevel + "]"); |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
117 |
} |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
118 |
|
19332 | 119 |
if (!isCompilable(compLevel)) { |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
120 |
throw new RuntimeException(method |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
121 |
+ " must be compilable at level " + compLevel |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
122 |
+ ", even it is not compilable at opposite level [" |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
123 |
+ compLevel + "]"); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
124 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
125 |
} |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
126 |
|
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
127 |
// clearing after tiered/non-tiered tests |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
128 |
// WB.clearMethodState() must reset no-compilable flags |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
129 |
WHITE_BOX.clearMethodState(method); |
19332 | 130 |
if (!isCompilable()) { |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
131 |
throw new RuntimeException(method |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
132 |
+ " is not compilable after clearMethodState()"); |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
133 |
} |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
134 |
|
19332 | 135 |
makeNotCompilable(); |
136 |
if (isCompilable()) { |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
137 |
throw new RuntimeException(method + " must be not compilable"); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
138 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
139 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
140 |
compile(); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
141 |
checkNotCompiled(); |
19332 | 142 |
if (isCompilable()) { |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
143 |
throw new RuntimeException(method + " must be not compilable"); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
144 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
145 |
// WB.clearMethodState() must reset no-compilable flags |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
146 |
WHITE_BOX.clearMethodState(method); |
19332 | 147 |
if (!isCompilable()) { |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
148 |
throw new RuntimeException(method |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
149 |
+ " is not compilable after clearMethodState()"); |
15621 | 150 |
} |
151 |
compile(); |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
152 |
checkCompiled(); |
15621 | 153 |
} |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
154 |
|
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
155 |
// separately tests each tier |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
156 |
private void testTier(int testedTier) { |
19332 | 157 |
if (!isCompilable(testedTier)) { |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
158 |
throw new RuntimeException(method |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
159 |
+ " is not compilable on start"); |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
160 |
} |
19332 | 161 |
makeNotCompilable(testedTier); |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
162 |
|
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
163 |
// tests for all other tiers |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
164 |
for (int anotherTier = 1, tierLimit = TIERED_STOP_AT_LEVEL + 1; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
165 |
anotherTier < tierLimit; ++anotherTier) { |
19332 | 166 |
boolean isCompilable = isCompilable(anotherTier); |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
167 |
if (sameCompile(testedTier, anotherTier)) { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
168 |
if (isCompilable) { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
169 |
throw new RuntimeException(method |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
170 |
+ " must be not compilable at level " + anotherTier |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
171 |
+ ", if it is not compilable at " + testedTier); |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
172 |
} |
19332 | 173 |
WHITE_BOX.enqueueMethodForCompilation(method, anotherTier, bci); |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
174 |
checkNotCompiled(); |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
175 |
} else { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
176 |
if (!isCompilable) { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
177 |
throw new RuntimeException(method |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
178 |
+ " must be compilable at level " + anotherTier |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
179 |
+ ", even if it is not compilable at " |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
180 |
+ testedTier); |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
181 |
} |
19332 | 182 |
WHITE_BOX.enqueueMethodForCompilation(method, anotherTier, bci); |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
183 |
checkCompiled(); |
19332 | 184 |
deoptimize(); |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
185 |
} |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
186 |
|
19332 | 187 |
if (!isCompilable(COMP_LEVEL_ANY)) { |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
188 |
throw new RuntimeException(method |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
189 |
+ " must be compilable at 'CompLevel::CompLevel_any'" |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
190 |
+ ", if it is not compilable only at " + testedTier); |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
191 |
} |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
192 |
} |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
193 |
|
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
194 |
// clear state after test |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
195 |
WHITE_BOX.clearMethodState(method); |
19332 | 196 |
if (!isCompilable(testedTier)) { |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
197 |
throw new RuntimeException(method |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
198 |
+ " is not compilable after clearMethodState()"); |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
199 |
} |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
200 |
} |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
201 |
|
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
202 |
private boolean sameCompile(int level1, int level2) { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
203 |
if (level1 == level2) { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
204 |
return true; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
205 |
} |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
206 |
if (isC1Compile(level1) && isC1Compile(level2)) { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
207 |
return true; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
208 |
} |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
209 |
if (isC2Compile(level1) && isC2Compile(level2)) { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
210 |
return true; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
211 |
} |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
212 |
return false; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
213 |
} |
19332 | 214 |
|
215 |
private int getBci() { |
|
216 |
compile(); |
|
217 |
checkCompiled(); |
|
218 |
int result = WHITE_BOX.getMethodEntryBci(method); |
|
219 |
deoptimize(); |
|
220 |
WHITE_BOX.clearMethodState(method); |
|
221 |
return result; |
|
222 |
} |
|
15621 | 223 |
} |