< prev index next >

test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNewAcmp.java

Print this page

        

*** 86,107 **** class MyObject implements MyInterface { int x; } - // Mark test methods that return always false - @Retention(RetentionPolicy.RUNTIME) - @interface AlwaysFalse { - int[] valid_for() default {1, 2}; - } - - // Mark test methods that return always true - @Retention(RetentionPolicy.RUNTIME) - @interface AlwaysTrue { - int[] valid_for() default {1, 2}; - } - // Mark test methods that return false if the argument is null @Retention(RetentionPolicy.RUNTIME) @interface FalseIfNull { } // Mark test methods that return true if the argument is null --- 86,95 ----
*** 195,275 **** public boolean testEq06_3(MyValue1 v, MyObject o) { return get(v) == get(o); // only true if both null } - @AlwaysFalse public boolean testEq07_1(MyValue1 v1, MyValue1 v2) { return getNotNull(v1) == (Object)v2; // false } - @AlwaysFalse public boolean testEq07_2(MyValue1 v1, MyValue1 v2) { return (Object)v1 == getNotNull(v2); // false } - @AlwaysFalse public boolean testEq07_3(MyValue1 v1, MyValue1 v2) { return getNotNull(v1) == getNotNull(v2); // false } - @AlwaysFalse public boolean testEq08_1(MyValue1 v, Object u) { return getNotNull(v) == u; // false } - @AlwaysFalse public boolean testEq08_2(MyValue1 v, Object u) { return (Object)v == getNotNull(u); // false } - @AlwaysFalse public boolean testEq08_3(MyValue1 v, Object u) { return getNotNull(v) == getNotNull(u); // false } - @AlwaysFalse public boolean testEq09_1(Object u, MyValue1 v) { return getNotNull(u) == (Object)v; // false } - @AlwaysFalse public boolean testEq09_2(Object u, MyValue1 v) { return u == getNotNull(v); // false } - @AlwaysFalse public boolean testEq09_3(Object u, MyValue1 v) { return getNotNull(u) == getNotNull(v); // false } - @AlwaysFalse public boolean testEq10_1(MyObject o, MyValue1 v) { return getNotNull(o) == (Object)v; // false } - @AlwaysFalse public boolean testEq10_2(MyObject o, MyValue1 v) { return o == getNotNull(v); // false } - @AlwaysFalse public boolean testEq10_3(MyObject o, MyValue1 v) { return getNotNull(o) == getNotNull(v); // false } - @AlwaysFalse public boolean testEq11_1(MyValue1 v, MyObject o) { return getNotNull(v) == o; // false } - @AlwaysFalse public boolean testEq11_2(MyValue1 v, MyObject o) { return (Object)v == getNotNull(o); // false } - @AlwaysFalse public boolean testEq11_3(MyValue1 v, MyObject o) { return getNotNull(v) == getNotNull(o); // false } public boolean testEq12_1(MyObject o1, MyObject o2) { --- 183,248 ----
*** 354,389 **** public boolean testEq18_3(MyValue1 v, Object[] a) { return get(v) == get(a); // only true if both null } - @AlwaysFalse public boolean testEq19_1(Object[] a, MyValue1 v) { return getNotNull(a) == (Object)v; // false } - @AlwaysFalse public boolean testEq19_2(Object[] a, MyValue1 v) { return a == getNotNull(v); // false } - @AlwaysFalse public boolean testEq19_3(Object[] a, MyValue1 v) { return getNotNull(a) == getNotNull(v); // false } - @AlwaysFalse public boolean testEq20_1(MyValue1 v, Object[] a) { return getNotNull(v) == a; // false } - @AlwaysFalse public boolean testEq20_2(MyValue1 v, Object[] a) { return (Object)v == getNotNull(a); // false } - @AlwaysFalse public boolean testEq20_3(MyValue1 v, Object[] a) { return getNotNull(v) == getNotNull(a); // false } public boolean testEq21_1(MyInterface u1, MyInterface u2) { --- 327,356 ----
*** 435,470 **** public boolean testEq23_3(MyInterface u, MyValue1 v) { return get(u) == get(v); // only true if both null } - @AlwaysFalse public boolean testEq24_1(MyValue1 v, MyInterface u) { return getNotNull(v) == u; // false } - @AlwaysFalse public boolean testEq24_2(MyValue1 v, MyInterface u) { return (Object)v == getNotNull(u); // false } - @AlwaysFalse public boolean testEq24_3(MyValue1 v, MyInterface u) { return getNotNull(v) == getNotNull(u); // false } - @AlwaysFalse public boolean testEq25_1(MyInterface u, MyValue1 v) { return getNotNull(u) == (Object)v; // false } - @AlwaysFalse public boolean testEq25_2(MyInterface u, MyValue1 v) { return u == getNotNull(v); // false } - @AlwaysFalse public boolean testEq25_3(MyInterface u, MyValue1 v) { return getNotNull(u) == getNotNull(v); // false } public boolean testEq26_1(MyInterface u, MyObject o) { --- 402,431 ----
*** 537,572 **** public boolean testEq31_3(MyValue1 v, MyInterface[] a) { return get(v) == get(a); // only true if both null } - @AlwaysFalse public boolean testEq32_1(MyInterface[] a, MyValue1 v) { return getNotNull(a) == (Object)v; // false } - @AlwaysFalse public boolean testEq32_2(MyInterface[] a, MyValue1 v) { return a == getNotNull(v); // false } - @AlwaysFalse public boolean testEq32_3(MyInterface[] a, MyValue1 v) { return getNotNull(a) == getNotNull(v); // false } - @AlwaysFalse public boolean testEq33_1(MyValue1 v, MyInterface[] a) { return getNotNull(v) == a; // false } - @AlwaysFalse public boolean testEq33_2(MyValue1 v, MyInterface[] a) { return (Object)v == getNotNull(a); // false } - @AlwaysFalse public boolean testEq33_3(MyValue1 v, MyInterface[] a) { return getNotNull(v) == getNotNull(a); // false } --- 498,527 ----
*** 787,867 **** public boolean testNotEq06_3(MyValue1 v, MyObject o) { return get(v) != get(o); // only false if both null } - @AlwaysTrue public boolean testNotEq07_1(MyValue1 v1, MyValue1 v2) { return getNotNull(v1) != (Object)v2; // true } - @AlwaysTrue public boolean testNotEq07_2(MyValue1 v1, MyValue1 v2) { return (Object)v1 != getNotNull(v2); // true } - @AlwaysTrue public boolean testNotEq07_3(MyValue1 v1, MyValue1 v2) { return getNotNull(v1) != getNotNull(v2); // true } - @AlwaysTrue public boolean testNotEq08_1(MyValue1 v, Object u) { return getNotNull(v) != u; // true } - @AlwaysTrue public boolean testNotEq08_2(MyValue1 v, Object u) { return (Object)v != getNotNull(u); // true } - @AlwaysTrue public boolean testNotEq08_3(MyValue1 v, Object u) { return getNotNull(v) != getNotNull(u); // true } - @AlwaysTrue public boolean testNotEq09_1(Object u, MyValue1 v) { return getNotNull(u) != (Object)v; // true } - @AlwaysTrue public boolean testNotEq09_2(Object u, MyValue1 v) { return u != getNotNull(v); // true } - @AlwaysTrue public boolean testNotEq09_3(Object u, MyValue1 v) { return getNotNull(u) != getNotNull(v); // true } - @AlwaysTrue public boolean testNotEq10_1(MyObject o, MyValue1 v) { return getNotNull(o) != (Object)v; // true } - @AlwaysTrue public boolean testNotEq10_2(MyObject o, MyValue1 v) { return o != getNotNull(v); // true } - @AlwaysTrue public boolean testNotEq10_3(MyObject o, MyValue1 v) { return getNotNull(o) != getNotNull(v); // true } - @AlwaysTrue public boolean testNotEq11_1(MyValue1 v, MyObject o) { return getNotNull(v) != o; // true } - @AlwaysTrue public boolean testNotEq11_2(MyValue1 v, MyObject o) { return (Object)v != getNotNull(o); // true } - @AlwaysTrue public boolean testNotEq11_3(MyValue1 v, MyObject o) { return getNotNull(v) != getNotNull(o); // true } public boolean testNotEq12_1(MyObject o1, MyObject o2) { --- 742,807 ----
*** 946,981 **** public boolean testNotEq18_3(MyValue1 v, Object[] a) { return get(v) != get(a); // only false if both null } - @AlwaysTrue public boolean testNotEq19_1(Object[] a, MyValue1 v) { return getNotNull(a) != (Object)v; // true } - @AlwaysTrue public boolean testNotEq19_2(Object[] a, MyValue1 v) { return a != getNotNull(v); // true } - @AlwaysTrue public boolean testNotEq19_3(Object[] a, MyValue1 v) { return getNotNull(a) != getNotNull(v); // true } - @AlwaysTrue public boolean testNotEq20_1(MyValue1 v, Object[] a) { return getNotNull(v) != a; // true } - @AlwaysTrue public boolean testNotEq20_2(MyValue1 v, Object[] a) { return (Object)v != getNotNull(a); // true } - @AlwaysTrue public boolean testNotEq20_3(MyValue1 v, Object[] a) { return getNotNull(v) != getNotNull(a); // true } public boolean testNotEq21_1(MyInterface u1, MyInterface u2) { --- 886,915 ----
*** 1027,1062 **** public boolean testNotEq23_3(MyInterface u, MyValue1 v) { return get(u) != get(v); // only false if both null } - @AlwaysTrue public boolean testNotEq24_1(MyValue1 v, MyInterface u) { return getNotNull(v) != u; // true } - @AlwaysTrue public boolean testNotEq24_2(MyValue1 v, MyInterface u) { return (Object)v != getNotNull(u); // true } - @AlwaysTrue public boolean testNotEq24_3(MyValue1 v, MyInterface u) { return getNotNull(v) != getNotNull(u); // true } - @AlwaysTrue public boolean testNotEq25_1(MyInterface u, MyValue1 v) { return getNotNull(u) != (Object)v; // true } - @AlwaysTrue public boolean testNotEq25_2(MyInterface u, MyValue1 v) { return u != getNotNull(v); // true } - @AlwaysTrue public boolean testNotEq25_3(MyInterface u, MyValue1 v) { return getNotNull(u) != getNotNull(v); // true } public boolean testNotEq26_1(MyInterface u, MyObject o) { --- 961,990 ----
*** 1129,1164 **** public boolean testNotEq31_3(MyValue1 v, MyInterface[] a) { return get(v) != get(a); // only false if both null } - @AlwaysTrue public boolean testNotEq32_1(MyInterface[] a, MyValue1 v) { return getNotNull(a) != (Object)v; // true } - @AlwaysTrue public boolean testNotEq32_2(MyInterface[] a, MyValue1 v) { return a != getNotNull(v); // true } - @AlwaysTrue public boolean testNotEq32_3(MyInterface[] a, MyValue1 v) { return getNotNull(a) != getNotNull(v); // true } - @AlwaysTrue public boolean testNotEq33_1(MyValue1 v, MyInterface[] a) { return getNotNull(v) != a; // true } - @AlwaysTrue public boolean testNotEq33_2(MyValue1 v, MyInterface[] a) { return (Object)v != getNotNull(a); // true } - @AlwaysTrue public boolean testNotEq33_3(MyValue1 v, MyInterface[] a) { return getNotNull(v) != getNotNull(a); // true } // Null tests --- 1057,1086 ----
*** 1331,1350 **** public boolean falseIfNull(Method m) { return m.isAnnotationPresent(FalseIfNull.class); } - public boolean alwaysTrue(Method m) { - return m.isAnnotationPresent(AlwaysTrue.class) && - Arrays.asList(((AlwaysTrue)m.getAnnotation(AlwaysTrue.class)).valid_for()).contains(ACmpOnValues); - } - - public boolean alwaysFalse(Method m) { - return m.isAnnotationPresent(AlwaysFalse.class) && - Arrays.asList(((AlwaysFalse)m.getAnnotation(AlwaysFalse.class)).valid_for()).contains(ACmpOnValues); - } - public boolean isNegated(Method m) { return m.getName().startsWith("testNot"); } // Tests with profiling --- 1253,1262 ----
*** 1396,1406 **** return n; } protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); protected static final long TieredStopAtLevel = (Long)WHITE_BOX.getVMFlag("TieredStopAtLevel"); protected static final int COMP_LEVEL_FULL_OPTIMIZATION = get_full_opt_level(); - protected static final long ACmpOnValues = (Long)WHITE_BOX.getVMFlag("ACmpOnValues"); // FIXME: temp -- special handling for C1 testing. protected static final boolean EnableValhallaC1 = (Boolean)WHITE_BOX.getVMFlag("EnableValhallaC1"); public void runTest(Method m, Object[] args, int warmup, int nullMode, boolean[][] equalities) throws Exception { --- 1308,1317 ----
*** 1441,1451 **** } System.out.print("Testing " + m.getName() + "(" + args[i] + ", " + args[j] + ")"); // Avoid acmp in the computation of the expected result! boolean equal = equalities[i][j]; equal = isNegated(m) ? !equal : equal; ! boolean expected = alwaysTrue(m) || ((i == 0 || j == 0) && trueIfNull(m)) || (!alwaysFalse(m) && equal && !(i == 0 && falseIfNull(m))); for (int run = 0; run < warmup; ++run) { Boolean result = (Boolean)m.invoke(this, args[i], args[j]); if (result != expected && WHITE_BOX.isMethodCompiled(m, false) && warmup == 1) { System.out.println(" = " + result); throw new RuntimeException("Test failed: should return " + expected); --- 1352,1362 ---- } System.out.print("Testing " + m.getName() + "(" + args[i] + ", " + args[j] + ")"); // Avoid acmp in the computation of the expected result! boolean equal = equalities[i][j]; equal = isNegated(m) ? !equal : equal; ! boolean expected = ((i == 0 || j == 0) && trueIfNull(m)) || (equal && !(i == 0 && falseIfNull(m))); for (int run = 0; run < warmup; ++run) { Boolean result = (Boolean)m.invoke(this, args[i], args[j]); if (result != expected && WHITE_BOX.isMethodCompiled(m, false) && warmup == 1) { System.out.println(" = " + result); throw new RuntimeException("Test failed: should return " + expected);
*** 1470,1485 **** MyValue2.setX(MyValue2.createDefault(), 42), }; boolean[][] equalities = { { true, false, false, false, false, false, false, false, false }, { false, true, false, false, false, false, false, false, false }, { false, false, true, false, false, false, false, false, false }, ! { false, false, false, ACmpOnValues == 3,false, false, false, ACmpOnValues == 3, false }, { false, false, false, false, true, false, false, false, false }, { false, false, false, false, false, true, false, false, false }, ! { false, false, false, false, false, false, ACmpOnValues == 3, false, false }, ! { false, false, false, ACmpOnValues == 3,false, false, false, ACmpOnValues == 3, false }, ! { false, false, false, false, false, false, false, false, ACmpOnValues == 3 } }; // Run tests for (Method m : getClass().getMethods()) { if (m.getName().startsWith("test")) { // Do some warmup runs --- 1381,1396 ---- MyValue2.setX(MyValue2.createDefault(), 42), }; boolean[][] equalities = { { true, false, false, false, false, false, false, false, false }, { false, true, false, false, false, false, false, false, false }, { false, false, true, false, false, false, false, false, false }, ! { false, false, false, true, false, false, false, true, false }, { false, false, false, false, true, false, false, false, false }, { false, false, false, false, false, true, false, false, false }, ! { false, false, false, false, false, false, true, false, false }, ! { false, false, false, true, false, false, false, true, false }, ! { false, false, false, false, false, false, false, false, true } }; // Run tests for (Method m : getClass().getMethods()) { if (m.getName().startsWith("test")) { // Do some warmup runs
*** 1503,1544 **** Asserts.assertTrue(cmpAlwaysEqual3(args[1])); Asserts.assertFalse(cmpAlwaysEqual4(args[1])); Asserts.assertFalse(cmpAlwaysUnEqual1(args[1], args[2])); Asserts.assertTrue(cmpAlwaysUnEqual2(args[1], args[2])); - boolean compiled = WHITE_BOX.isMethodCompiled(cmpAlwaysUnEqual3_m, false); boolean res = cmpAlwaysUnEqual3(args[3]); - if (ACmpOnValues != 3) { - Asserts.assertFalse(res); - } else if (compiled) { Asserts.assertTrue(res); - } - compiled = WHITE_BOX.isMethodCompiled(cmpAlwaysUnEqual4_m, false); res = cmpAlwaysUnEqual4(args[3]); - if (ACmpOnValues != 3) { - Asserts.assertTrue(res); - } else if (compiled) { Asserts.assertFalse(res); - } int idx = i % args.length; - compiled = WHITE_BOX.isMethodCompiled(cmpSometimesEqual1_m, false); res = cmpSometimesEqual1(args[idx]); - if (ACmpOnValues != 3) { - Asserts.assertEQ(res, args[idx] == null || !args[idx].getClass().isInlineClass()); - } else if (compiled) { Asserts.assertTrue(res); - } - compiled = WHITE_BOX.isMethodCompiled(cmpSometimesEqual2_m, false); res = cmpSometimesEqual2(args[idx]); - if (ACmpOnValues != 3) { - Asserts.assertNE(res, args[idx] == null || !args[idx].getClass().isInlineClass()); - } else if (compiled) { Asserts.assertFalse(res); } } - } public static void main(String[] args) throws Exception { if (args.length == 0) { enumerateVMOptions(); } else { --- 1414,1435 ----
*** 1581,1617 **** scenarios = Arrays.asList(SCENARIOS.split(",")); } int scenario = -1; for (int nullMode = 0; nullMode <= 2; nullMode++) { // null mode - for (int onVal = 0; onVal < 2; onVal++) { // 0 = default, 1 = -XX:ACmpOnValues=3 for (int incrInline = 0; incrInline < 2; incrInline++) { // 0 = default, 1 = -XX:+AlwaysIncrementalInline scenario++; System.out.println("Scenario #" + scenario + " -------------------"); String[] cmds = baseOptions; if (incrInline != 0) { cmds = addOptions(cmds, "-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AlwaysIncrementalInline"); } - if (onVal != 0) { - cmds = addOptions(cmds, "-XX:+UnlockExperimentalVMOptions", "-XX:ACmpOnValues=3"); - } cmds = addOptions(cmds, "compiler.valhalla.valuetypes.TestNewAcmp"); cmds = addOptions(cmds, Integer.toString(nullMode)); if (scenarios != null && !scenarios.contains(Integer.toString(scenario))) { System.out.println("Scenario #" + scenario + " is skipped due to -Dscenarios=" + SCENARIOS); continue; - } else if (EnableValhallaC1 && onVal == 0) { - System.out.println("Scenario #" + scenario + " is skipped because C1 requires -XX:ACmpOnValues=3"); - continue; } OutputAnalyzer oa = ProcessTools.executeTestJvm(cmds); String output = oa.getOutput(); oa.shouldHaveExitValue(0); System.out.println(output); } } } - } } --- 1472,1500 ----
< prev index next >