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 ConstantGettersTransitionsTest
26 * @library /testlibrary /test/lib /
27 * @modules java.base/jdk.internal.misc
28 * java.management
29 * @build TransitionsTestExecutor ConstantGettersTransitionsTest
30 * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
31 * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
32 * -XX:+WhiteBoxAPI -XX:+TieredCompilation -XX:-UseCounterDecay
33 * -XX:CompileCommand=compileonly,ConstantGettersTestCase$TrivialMethods::*
34 * TransitionsTestExecutor ConstantGettersTransitionsTest
35 * @summary Test the correctness of compilation level transitions for constant getters methods
36 */
37
38 import java.lang.reflect.Executable;
39 import java.util.concurrent.Callable;
40 import compiler.whitebox.CompilerWhiteBoxTest;
41
42 public class ConstantGettersTransitionsTest extends LevelTransitionTest {
43 public static void main(String[] args) {
44 assert (!CompilerWhiteBoxTest.skipOnTieredCompilation(false));
45
46 // run test cases
47 for (TestCase testCase : ConstantGettersTestCase.values()) {
48 new ConstantGettersTransitionsTest(testCase).runTest();
49 }
50 }
51
52 @Override
53 protected boolean isTrivial() {
54 return true;
55 }
56
57 private ConstantGettersTransitionsTest(TestCase testCase) {
58 super(testCase);
59 }
60 }
61
62 enum ConstantGettersTestCase implements CompilerWhiteBoxTest.TestCase {
63 ICONST_M1,
64 ICONST_0,
65 ICONST_1,
66 ICONST_2,
67 ICONST_3,
68 ICONST_4,
69 ICONST_5,
70 LCONST_0,
71 LCONST_1,
72 FCONST_0,
73 FCONST_1,
74 FCONST_2,
75 DCONST_0,
76 DCONST_1,
77 DCONST_W,
78 BYTE,
79 SHORT,
80 CHAR;
81
82 private final Executable executable;
177
178 public static byte makeBYTE() {
179 // bipush
180 return (byte) 0x7F;
181 }
182
183 public static short makeSHORT() {
184 // sipush
185 return (short) 0x7FFF;
186 }
187
188 public static char makeCHAR() {
189 // ldc
190 return (char) 0xFFFF;
191 }
192
193 public static boolean makeBOOLEAN() {
194 return true;
195 }
196 }
197 }
|
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 ConstantGettersTransitionsTest
26 * @summary Test the correctness of compilation level transitions for constant getters methods
27 * @library /testlibrary /test/lib /
28 * @modules java.base/jdk.internal.misc
29 * java.management
30 *
31 * @build compiler.tiered.TransitionsTestExecutor
32 * compiler.tiered.ConstantGettersTransitionsTest
33 * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
34 * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
35 * -XX:+WhiteBoxAPI -XX:+TieredCompilation -XX:-UseCounterDecay
36 * -XX:CompileCommand=compileonly,compiler.tiered.ConstantGettersTransitionsTest$ConstantGettersTestCase$TrivialMethods::*
37 * compiler.tiered.TransitionsTestExecutor
38 * compiler.tiered.ConstantGettersTransitionsTest
39 */
40
41 package compiler.tiered;
42
43 import compiler.whitebox.CompilerWhiteBoxTest;
44
45 import java.lang.reflect.Executable;
46 import java.util.concurrent.Callable;
47
48 public class ConstantGettersTransitionsTest extends LevelTransitionTest {
49 public static void main(String[] args) {
50 assert (!CompilerWhiteBoxTest.skipOnTieredCompilation(false));
51
52 // run test cases
53 for (TestCase testCase : ConstantGettersTestCase.values()) {
54 new ConstantGettersTransitionsTest(testCase).runTest();
55 }
56 }
57
58 @Override
59 protected boolean isTrivial() {
60 return true;
61 }
62
63 private ConstantGettersTransitionsTest(TestCase testCase) {
64 super(testCase);
65 }
66
67 private static enum ConstantGettersTestCase implements CompilerWhiteBoxTest.TestCase {
68 ICONST_M1,
69 ICONST_0,
70 ICONST_1,
71 ICONST_2,
72 ICONST_3,
73 ICONST_4,
74 ICONST_5,
75 LCONST_0,
76 LCONST_1,
77 FCONST_0,
78 FCONST_1,
79 FCONST_2,
80 DCONST_0,
81 DCONST_1,
82 DCONST_W,
83 BYTE,
84 SHORT,
85 CHAR;
86
87 private final Executable executable;
182
183 public static byte makeBYTE() {
184 // bipush
185 return (byte) 0x7F;
186 }
187
188 public static short makeSHORT() {
189 // sipush
190 return (short) 0x7FFF;
191 }
192
193 public static char makeCHAR() {
194 // ldc
195 return (char) 0xFFFF;
196 }
197
198 public static boolean makeBOOLEAN() {
199 return true;
200 }
201 }
202 }
|