annotate test/compiler/whitebox/MakeMethodNotCompilableTest.java @ 12026:11237ee74aae

8019915: whitebox testClearMethodStateTest fails with tiered on sparc Summary: 'compileonly' directive has beens added to each 'compiler/whitebox' test Reviewed-by: kvn
author iignatyev
date Sat, 10 Aug 2013 10:01:12 +0400
parents d1c9384eecb4
children f99558245e5c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
1 /*
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
4 *
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
7 * published by the Free Software Foundation.
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
8 *
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
13 * accompanied this code).
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
14 *
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
18 *
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
21 * questions.
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
22 */
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
23
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
24 /*
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
25 * @test MakeMethodNotCompilableTest
10200
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
26 * @bug 8012322
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
12026
11237ee74aae 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 10200
diff changeset
30 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$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
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
32 * @author igor.ignatyev@oracle.com
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
33 */
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
34 public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
35
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
36 public static void main(String[] args) throws Exception {
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
37 if (args.length == 0) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
38 for (TestCase test : TestCase.values()) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
39 new MakeMethodNotCompilableTest(test).runTest();
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
40 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
41 } else {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
42 for (String name : args) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
43 new MakeMethodNotCompilableTest(
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
44 TestCase.valueOf(name)).runTest();
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
45 }
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 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
48
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
49 public MakeMethodNotCompilableTest(TestCase testCase) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
50 super(testCase);
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
51 // to prevent inlining of #method
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
52 WHITE_BOX.testSetDontInlineMethod(method, true);
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
53 }
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
54
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
55 /**
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
56 * Tests {@code WB::makeMethodNotCompilable()} by calling it before
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
57 * 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
58 * 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
59 * 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
60 *
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
61 * @throws Exception if one of the checks fails.
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
62 */
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
63 @Override
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
64 protected void test() throws Exception {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
65 checkNotCompiled();
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
66 if (!WHITE_BOX.isMethodCompilable(method)) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
67 throw new RuntimeException(method + " must be compilable");
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
68 }
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
69
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
70 if (TIERED_COMPILATION) {
10200
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
71 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
72 for (int testedTier = 1; testedTier < tierLimit; ++testedTier) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
73 testTier(testedTier);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
74 }
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
75 for (int testedTier = 1; testedTier < tierLimit; ++testedTier) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
76 WHITE_BOX.makeMethodNotCompilable(method, testedTier);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
77 if (WHITE_BOX.isMethodCompilable(method, testedTier)) {
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
78 throw new RuntimeException(method
10200
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
79 + " must be not compilable at level" + testedTier);
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
80 }
10200
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
81 WHITE_BOX.enqueueMethodForCompilation(method, testedTier);
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
82 checkNotCompiled();
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 if (!WHITE_BOX.isMethodCompilable(method)) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
85 System.out.println(method
10200
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
86 + " is not compilable after level " + testedTier);
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
87 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
88 }
10200
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
89 } else {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
90 compile();
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
91 checkCompiled();
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
92 int compLevel = WHITE_BOX.getMethodCompilationLevel(method);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
93 WHITE_BOX.deoptimizeMethod(method);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
94 WHITE_BOX.makeMethodNotCompilable(method, compLevel);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
95 if (WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY)) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
96 throw new RuntimeException(method
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
97 + " 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
98 + " after it is not compilable at " + compLevel);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
99 }
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
100 WHITE_BOX.clearMethodState(method);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
101
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
102 // 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
103 int oppositeLevel;
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
104 if (isC1Compile(compLevel)) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
105 oppositeLevel = COMP_LEVEL_FULL_OPTIMIZATION;
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
106 } else {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
107 oppositeLevel = COMP_LEVEL_SIMPLE;
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
108 }
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
109 WHITE_BOX.makeMethodNotCompilable(method, oppositeLevel);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
110
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
111 if (!WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY)) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
112 throw new RuntimeException(method
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
113 + " must be compilable at CompLevel::CompLevel_any,"
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
114 + " 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
115 + compLevel + "]");
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
116 }
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
117
10200
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
118 if (!WHITE_BOX.isMethodCompilable(method, compLevel)) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
119 throw new RuntimeException(method
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
120 + " must be compilable at level " + compLevel
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
121 + ", 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
122 + compLevel + "]");
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
123 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
124 }
10200
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
125
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
126 // clearing after tiered/non-tiered tests
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
127 // WB.clearMethodState() must reset no-compilable flags
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
128 WHITE_BOX.clearMethodState(method);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
129 if (!WHITE_BOX.isMethodCompilable(method)) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
130 throw new RuntimeException(method
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
131 + " is not compilable after clearMethodState()");
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
132 }
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
133
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
134 WHITE_BOX.makeMethodNotCompilable(method);
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
135 if (WHITE_BOX.isMethodCompilable(method)) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
136 throw new RuntimeException(method + " must be not compilable");
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
137 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
138
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
139 compile();
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
140 checkNotCompiled();
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
141 if (WHITE_BOX.isMethodCompilable(method)) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
142 throw new RuntimeException(method + " must be not compilable");
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
143 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
144 // WB.clearMethodState() must reset no-compilable flags
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
145 WHITE_BOX.clearMethodState(method);
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
146 if (!WHITE_BOX.isMethodCompilable(method)) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
147 throw new RuntimeException(method
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
148 + " is not compilable after clearMethodState()");
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
149 }
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
150 compile();
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
151 checkCompiled();
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
152 }
10200
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
153
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
154 // separately tests each tier
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
155 private void testTier(int testedTier) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
156 if (!WHITE_BOX.isMethodCompilable(method, testedTier)) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
157 throw new RuntimeException(method
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
158 + " is not compilable on start");
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
159 }
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
160 WHITE_BOX.makeMethodNotCompilable(method, testedTier);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
161
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
162 // tests for all other tiers
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
163 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
164 anotherTier < tierLimit; ++anotherTier) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
165 boolean isCompilable = WHITE_BOX.isMethodCompilable(method,
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
166 anotherTier);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
167 if (sameCompile(testedTier, anotherTier)) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
168 if (isCompilable) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
169 throw new RuntimeException(method
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
170 + " must be not compilable at level " + anotherTier
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
171 + ", if it is not compilable at " + testedTier);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
172 }
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
173 WHITE_BOX.enqueueMethodForCompilation(method, anotherTier);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
174 checkNotCompiled();
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
175 } else {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
176 if (!isCompilable) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
177 throw new RuntimeException(method
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
178 + " must be compilable at level " + anotherTier
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
179 + ", even if it is not compilable at "
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
180 + testedTier);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
181 }
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
182 WHITE_BOX.enqueueMethodForCompilation(method, anotherTier);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
183 checkCompiled();
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
184 WHITE_BOX.deoptimizeMethod(method);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
185 }
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 if (!WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY)) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
188 throw new RuntimeException(method
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
189 + " must be compilable at 'CompLevel::CompLevel_any'"
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
190 + ", 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
191 }
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 // clear state after test
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
195 WHITE_BOX.clearMethodState(method);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
196 if (!WHITE_BOX.isMethodCompilable(method, testedTier)) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
197 throw new RuntimeException(method
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
198 + " is not compilable after clearMethodState()");
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
199 }
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 private boolean sameCompile(int level1, int level2) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
203 if (level1 == level2) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
204 return true;
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
205 }
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
206 if (isC1Compile(level1) && isC1Compile(level2)) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
207 return true;
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
208 }
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
209 if (isC2Compile(level1) && isC2Compile(level2)) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
210 return true;
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
211 }
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
212 return false;
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
213 }
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
214 }