author | dtitov |
Fri, 31 Aug 2018 11:56:43 -0700 | |
changeset 51613 | 3835dc32de5e |
parent 51290 | 5afd528675f6 |
permissions | -rw-r--r-- |
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
1 |
/* |
51287
7b1ddbafa134
8208655: use JTreg skipped status in hotspot tests
iignatyev
parents:
50068
diff
changeset
|
2 |
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. |
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
4 |
* |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
8 |
* |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
13 |
* accompanied this code). |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
14 |
* |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
18 |
* |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
21 |
* questions. |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
22 |
*/ |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
23 |
|
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
24 |
/** |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
25 |
* @test ConstantGettersTransitionsTest |
40059 | 26 |
* @summary Test the correctness of compilation level transitions for constant getters methods |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40059
diff
changeset
|
27 |
* @library /test/lib / |
36851 | 28 |
* @modules java.base/jdk.internal.misc |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28194
diff
changeset
|
29 |
* java.management |
40059 | 30 |
* |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40059
diff
changeset
|
31 |
* @build sun.hotspot.WhiteBox |
40059 | 32 |
* compiler.tiered.ConstantGettersTransitionsTest |
38032
bedc2fbb9454
8153885: [TESTBUG] few regression tests failed after 8151880 changes
neliasso
parents:
34185
diff
changeset
|
33 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission |
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
34 |
* @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions |
40059 | 35 |
* -XX:+WhiteBoxAPI -XX:+TieredCompilation -XX:-UseCounterDecay |
36 |
* -XX:CompileCommand=compileonly,compiler.tiered.ConstantGettersTransitionsTest$ConstantGettersTestCase$TrivialMethods::* |
|
37 |
* compiler.tiered.ConstantGettersTransitionsTest |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
38 |
*/ |
39438 | 39 |
|
40059 | 40 |
package compiler.tiered; |
41 |
||
42 |
import compiler.whitebox.CompilerWhiteBoxTest; |
|
51290
5afd528675f6
8208706: compiler/tiered/ConstantGettersTransitionsTest.java fails to compile
dcubed
parents:
51287
diff
changeset
|
43 |
import jtreg.SkippedException; |
40059 | 44 |
|
39438 | 45 |
import java.lang.reflect.Executable; |
46 |
import java.util.concurrent.Callable; |
|
47 |
||
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
48 |
public class ConstantGettersTransitionsTest extends LevelTransitionTest { |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
49 |
public static void main(String[] args) { |
51287
7b1ddbafa134
8208655: use JTreg skipped status in hotspot tests
iignatyev
parents:
50068
diff
changeset
|
50 |
if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) { |
7b1ddbafa134
8208655: use JTreg skipped status in hotspot tests
iignatyev
parents:
50068
diff
changeset
|
51 |
throw new SkippedException("Test isn't applicable for non-tiered mode"); |
7b1ddbafa134
8208655: use JTreg skipped status in hotspot tests
iignatyev
parents:
50068
diff
changeset
|
52 |
} |
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
53 |
|
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
54 |
// run test cases |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
55 |
for (TestCase testCase : ConstantGettersTestCase.values()) { |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
56 |
new ConstantGettersTransitionsTest(testCase).runTest(); |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
57 |
} |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
58 |
} |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
59 |
|
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
60 |
@Override |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
61 |
protected boolean isTrivial() { |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
62 |
return true; |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
63 |
} |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
64 |
|
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
65 |
private ConstantGettersTransitionsTest(TestCase testCase) { |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
66 |
super(testCase); |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
67 |
} |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
68 |
|
40059 | 69 |
private static enum ConstantGettersTestCase implements CompilerWhiteBoxTest.TestCase { |
70 |
ICONST_M1, |
|
71 |
ICONST_0, |
|
72 |
ICONST_1, |
|
73 |
ICONST_2, |
|
74 |
ICONST_3, |
|
75 |
ICONST_4, |
|
76 |
ICONST_5, |
|
77 |
LCONST_0, |
|
78 |
LCONST_1, |
|
79 |
FCONST_0, |
|
80 |
FCONST_1, |
|
81 |
FCONST_2, |
|
82 |
DCONST_0, |
|
83 |
DCONST_1, |
|
84 |
DCONST_W, |
|
85 |
BYTE, |
|
86 |
SHORT, |
|
87 |
CHAR; |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
88 |
|
40059 | 89 |
private final Executable executable; |
90 |
private final Callable<Integer> callable; |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
91 |
|
40059 | 92 |
@Override |
93 |
public Executable getExecutable() { |
|
94 |
return executable; |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
95 |
} |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
96 |
|
40059 | 97 |
@Override |
98 |
public Callable<Integer> getCallable() { |
|
99 |
return callable; |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
100 |
} |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
101 |
|
40059 | 102 |
@Override |
103 |
public boolean isOsr() { |
|
104 |
return false; |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
105 |
} |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
106 |
|
40059 | 107 |
private ConstantGettersTestCase() { |
108 |
String name = "make" + this.name(); |
|
109 |
this.executable = LevelTransitionTest.Helper.getMethod(TrivialMethods.class, name); |
|
110 |
this.callable = LevelTransitionTest.Helper.getCallable(new TrivialMethods(), name); |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
111 |
} |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
112 |
|
40059 | 113 |
/** |
114 |
* Contains methods that load constants with certain types of bytecodes |
|
115 |
* See JVMS 2.11.2. Load and Store Instructions |
|
116 |
* Note that it doesn't have a method for ldc_w instruction |
|
117 |
*/ |
|
118 |
private static class TrivialMethods { |
|
119 |
public static int makeICONST_M1() { |
|
120 |
return -1; |
|
121 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
122 |
|
40059 | 123 |
public static int makeICONST_0() { |
124 |
return 0; |
|
125 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
126 |
|
40059 | 127 |
public static int makeICONST_1() { |
128 |
return 1; |
|
129 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
130 |
|
40059 | 131 |
public static int makeICONST_2() { |
132 |
return 2; |
|
133 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
134 |
|
40059 | 135 |
public static int makeICONST_3() { |
136 |
return 3; |
|
137 |
} |
|
138 |
||
139 |
public static int makeICONST_4() { |
|
140 |
return 4; |
|
141 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
142 |
|
40059 | 143 |
public static int makeICONST_5() { |
144 |
return 5; |
|
145 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
146 |
|
40059 | 147 |
public static long makeLCONST_0() { |
148 |
return 0L; |
|
149 |
} |
|
150 |
||
151 |
public static long makeLCONST_1() { |
|
152 |
return 1L; |
|
153 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
154 |
|
40059 | 155 |
public static float makeFCONST_0() { |
156 |
return 0F; |
|
157 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
158 |
|
40059 | 159 |
public static float makeFCONST_1() { |
160 |
return 1F; |
|
161 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
162 |
|
40059 | 163 |
public static float makeFCONST_2() { |
164 |
return 2F; |
|
165 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
166 |
|
40059 | 167 |
public static double makeDCONST_0() { |
168 |
return 0D; |
|
169 |
} |
|
170 |
||
171 |
public static double makeDCONST_1() { |
|
172 |
return 1D; |
|
173 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
174 |
|
40059 | 175 |
public static double makeDCONST_W() { |
176 |
// ldc2_w |
|
177 |
return Double.MAX_VALUE; |
|
178 |
} |
|
179 |
||
180 |
public static Object makeOBJECT() { |
|
181 |
// aconst_null |
|
182 |
return null; |
|
183 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
184 |
|
40059 | 185 |
public static byte makeBYTE() { |
186 |
// bipush |
|
187 |
return (byte) 0x7F; |
|
188 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
189 |
|
40059 | 190 |
public static short makeSHORT() { |
191 |
// sipush |
|
192 |
return (short) 0x7FFF; |
|
193 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
194 |
|
40059 | 195 |
public static char makeCHAR() { |
196 |
// ldc |
|
197 |
return (char) 0xFFFF; |
|
198 |
} |
|
199 |
||
200 |
public static boolean makeBOOLEAN() { |
|
201 |
return true; |
|
202 |
} |
|
28194
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
203 |
} |
8c6c124a108b
8059575: JEP-JDK-8043304: Test task: Tiered Compilation level transition tests
ppunegov
parents:
diff
changeset
|
204 |
} |
50068 | 205 |
} |