< prev index next >
test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNewAcmp.java
Print this page
*** 28,60 ****
--- 28,66 ----
* @compile -XDenableValueTypes -XDallowFlattenabilityModifiers TestNewAcmp.java
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbatch
* -XX:+EnableValhalla -XX:TypeProfileLevel=222
* -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
+ * -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmpAlways*
* compiler.valhalla.valuetypes.TestNewAcmp 0
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -Xbatch -XX:+EnableValhalla -XX:TypeProfileLevel=222
* -XX:+AlwaysIncrementalInline
* -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
+ * -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmpAlways*
* compiler.valhalla.valuetypes.TestNewAcmp 0
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbatch
* -XX:+EnableValhalla -XX:TypeProfileLevel=222
* -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
+ * -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmpAlways*
* compiler.valhalla.valuetypes.TestNewAcmp 1
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -Xbatch -XX:+EnableValhalla -XX:TypeProfileLevel=222
* -XX:+AlwaysIncrementalInline
* -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
+ * -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmpAlways*
* compiler.valhalla.valuetypes.TestNewAcmp 1
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbatch
* -XX:+EnableValhalla -XX:TypeProfileLevel=222
* -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
+ * -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmpAlways*
* compiler.valhalla.valuetypes.TestNewAcmp 2
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -Xbatch -XX:+EnableValhalla -XX:TypeProfileLevel=222
* -XX:+AlwaysIncrementalInline
* -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::test*
+ * -XX:CompileCommand=dontinline,compiler.valhalla.valuetypes.TestNewAcmp::cmpAlways*
* compiler.valhalla.valuetypes.TestNewAcmp 2
*/
package compiler.valhalla.valuetypes;
*** 1334,1343 ****
--- 1340,1366 ----
public boolean isNegated(Method m) {
return m.getName().startsWith("testNot");
}
+ // Tests with profiling
+ public boolean cmpAlwaysEqual1(Object a, Object b) {
+ return a == b;
+ }
+
+ public boolean cmpAlwaysEqual2(Object a, Object b) {
+ return a != b;
+ }
+
+ public boolean cmpAlwaysUnEqual1(Object a, Object b) {
+ return a == b;
+ }
+
+ public boolean cmpAlwaysUnEqual2(Object a, Object b) {
+ return a != b;
+ }
+
protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
protected static final int COMP_LEVEL_FULL_OPTIMIZATION = 4;
public void runTest(Method m, Object[] args, int warmup, int nullMode) throws Exception {
Class<?>[] parameterTypes = m.getParameterTypes();
*** 1398,1416 ****
args[5] = new MyObject[10];
// Run tests
for (Method m : getClass().getMethods()) {
if (m.getName().startsWith("test")) {
! // Do same warmup runs
runTest(m, args, 1000, nullMode);
// Make sure method is compiled
WHITE_BOX.enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
Asserts.assertTrue(WHITE_BOX.isMethodCompiled(m, false), m + " not compiled");
// Run again to verify correctness of compiled code
runTest(m, args, 1, nullMode);
}
}
}
public static void main(String[] args) throws Exception {
int nullMode = Integer.valueOf(args[0]);
TestNewAcmp t = new TestNewAcmp();
--- 1421,1446 ----
args[5] = new MyObject[10];
// Run tests
for (Method m : getClass().getMethods()) {
if (m.getName().startsWith("test")) {
! // Do some warmup runs
runTest(m, args, 1000, nullMode);
// Make sure method is compiled
WHITE_BOX.enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
Asserts.assertTrue(WHITE_BOX.isMethodCompiled(m, false), m + " not compiled");
// Run again to verify correctness of compiled code
runTest(m, args, 1, nullMode);
}
}
+
+ for (int i = 0; i < 10_000; ++i) {
+ Asserts.assertTrue(cmpAlwaysEqual1(args[1], args[1]));
+ Asserts.assertFalse(cmpAlwaysEqual2(args[1], args[1]));
+ Asserts.assertFalse(cmpAlwaysUnEqual1(args[1], args[2]));
+ Asserts.assertTrue(cmpAlwaysUnEqual2(args[1], args[2]));
+ }
}
public static void main(String[] args) throws Exception {
int nullMode = Integer.valueOf(args[0]);
TestNewAcmp t = new TestNewAcmp();
< prev index next >