From 08bfa8fe76ffd22b1a8afe93b5f221bec624dc4c Mon Sep 17 00:00:00 2001 From: Srikanth Adayapalam Date: Tue, 5 May 2020 11:33:59 +0000 Subject: [PATCH] 8243625: [lworld] Co-evolve hotspot-compiler tests along with JDK-8237072 Reviewed-by: thartmann --- .../valuetypes/TestArrayAccessDeopt.java | 16 +- .../valhalla/valuetypes/TestArrays.java | 36 +- .../valuetypes/TestBufferTearing.java | 10 +- .../valhalla/valuetypes/TestC2CCalls.java | 48 +- .../valuetypes/TestCallingConvention.java | 14 +- .../valuetypes/TestCallingConventionC1.java | 18 +- .../TestDeoptimizationWhenBuffering.java | 4 +- .../valuetypes/TestFlatArrayThreshold.java | 26 +- .../valhalla/valuetypes/TestIntrinsics.java | 71 +-- .../valhalla/valuetypes/TestLWorld.java | 30 +- .../valuetypes/TestLWorldProfiling.java | 2 +- .../valuetypes/TestNullableArrays.java | 542 +++++++++--------- .../valuetypes/TestNullableValueTypes.java | 102 ++-- .../valuetypes/TestOnStackReplacement.java | 4 +- .../TestUnloadedValueTypeArray.java | 40 +- .../valhalla/valuetypes/TestWithfieldC1.java | 6 +- 16 files changed, 490 insertions(+), 479 deletions(-) diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestArrayAccessDeopt.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestArrayAccessDeopt.java index 84f7ca1403a..6040289d2c9 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestArrayAccessDeopt.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestArrayAccessDeopt.java @@ -43,15 +43,15 @@ public static void test1(Object[] va, Object vt) { va[0] = vt; } - public static void test2(Object[] va, MyValue1? vt) { + public static void test2(Object[] va, MyValue1.ref vt) { va[0] = vt; } - public static void test3(MyValue1?[] va, Object vt) { - va[0] = (MyValue1?)vt; + public static void test3(MyValue1.ref[] va, Object vt) { + va[0] = (MyValue1.ref)vt; } - public static void test4(MyValue1?[] va, MyValue1? vt) { + public static void test4(MyValue1.ref[] va, MyValue1.ref vt) { va[0] = vt; } @@ -67,11 +67,11 @@ public static void test7(MyValue1[] va, MyValue1 vt) { va[0] = vt; } - public static void test8(MyValue1?[] va, MyValue1 vt) { + public static void test8(MyValue1.ref[] va, MyValue1 vt) { va[0] = vt; } - public static void test9(MyValue1[] va, MyValue1? vt) { + public static void test9(MyValue1[] va, MyValue1.ref vt) { va[0] = (MyValue1)vt; } @@ -79,7 +79,7 @@ public static void test10(Object[] va) { va[0] = null; } - public static void test11(MyValue1?[] va) { + public static void test11(MyValue1.ref[] va) { va[0] = null; } @@ -93,7 +93,7 @@ static public void main(String[] args) throws Exception { oa.shouldNotContain("Uncommon trap occurred"); } else { MyValue1[] va = new MyValue1[1]; - MyValue1?[] vaB = new MyValue1?[1]; + MyValue1.ref[] vaB = new MyValue1.ref[1]; MyValue1 vt = new MyValue1(); for (int i = 0; i < 10_000; ++i) { test1(va, vt); diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestArrays.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestArrays.java index 4de17087a84..0a0a8c5b222 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestArrays.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestArrays.java @@ -1251,7 +1251,8 @@ public void test50_verifier(boolean warmup) { @Test public MyValue1[] test51(MyValue1[] va) { - return Arrays.copyOf(va, va.length, MyValue1[].class); + // TODO Remove cast as workaround once javac is fixed + return (MyValue1[])Arrays.copyOf(va, va.length, MyValue1[].class); } @DontCompile @@ -1269,7 +1270,8 @@ public void test51_verifier(boolean warmup) { @Test public MyValue1[] test52() { - return Arrays.copyOf(test52_va, 8, MyValue1[].class); + // TODO Remove cast as workaround once javac is fixed + return (MyValue1[])Arrays.copyOf(test52_va, 8, MyValue1[].class); } @DontCompile @@ -1283,7 +1285,8 @@ public void test52_verifier(boolean warmup) { @Test public MyValue1[] test53(Object[] va) { - return Arrays.copyOf(va, va.length, MyValue1[].class); + // TODO Remove cast as workaround once javac is fixed + return (MyValue1[])Arrays.copyOf(va, va.length, MyValue1[].class); } @DontCompile @@ -1331,7 +1334,8 @@ public void test55_verifier(boolean warmup) { @Test public MyValue1[] test56(Object[] va) { - return Arrays.copyOf(va, va.length, MyValue1[].class); + // TODO Remove cast as workaround once javac is fixed + return (MyValue1[])Arrays.copyOf(va, va.length, MyValue1[].class); } @DontCompile @@ -1967,7 +1971,7 @@ public Object test84(Object[] array, int i) { @DontCompile public void test84_verifier(boolean warmup) { - NotFlattenable?[] array1 = new NotFlattenable?[2]; + NotFlattenable.ref[] array1 = new NotFlattenable.ref[2]; Object[] array2 = new Object[2]; Object result = test84(array1, 0); Asserts.assertEquals(array1[0], null); @@ -2023,7 +2027,7 @@ public void test85_verifier(boolean warmup) { // Same as test85 but with not-flattenable inline type array @Test(failOn = ALLOC_G + ALLOCA_G + LOAD_UNKNOWN_VALUE + STORE_UNKNOWN_VALUE, match = { VALUE_ARRAY_NULL_GUARD }, matchCount = { 2 }) - public void test86(NotFlattenable?[] array, NotFlattenable? o, boolean b) { + public void test86(NotFlattenable.ref[] array, NotFlattenable.ref o, boolean b) { if (b) { array[0] = null; } else { @@ -2035,7 +2039,7 @@ public void test86(NotFlattenable?[] array, NotFlattenable? o, boolean b) { @DontCompile public void test86_verifier(boolean warmup) { NotFlattenable vt = new NotFlattenable(); - NotFlattenable?[] array1 = new NotFlattenable?[2]; + NotFlattenable.ref[] array1 = new NotFlattenable.ref[2]; test86(array1, vt, true); Asserts.assertEquals(array1[1], vt); test86(array1, null, false); @@ -2053,7 +2057,7 @@ public void test86_verifier(boolean warmup) { // Same as test85 but with inline type array @Test(failOn = ALLOC_G + ALLOCA_G + LOAD_UNKNOWN_VALUE + STORE_UNKNOWN_VALUE, match = { VALUE_ARRAY_NULL_GUARD }, matchCount = { 2 }) - public void test87(MyValue1?[] array, MyValue1? o, boolean b) { + public void test87(MyValue1.ref[] array, MyValue1.ref o, boolean b) { if (b) { array[0] = null; } else { @@ -2065,7 +2069,7 @@ public void test87(MyValue1?[] array, MyValue1? o, boolean b) { @DontCompile public void test87_verifier(boolean warmup) { MyValue1 vt = MyValue1.createWithFieldsInline(rI, rL); - MyValue1?[] array1 = new MyValue1?[2]; + MyValue1.ref[] array1 = new MyValue1.ref[2]; test87(array1, vt, true); Asserts.assertEquals(array1[1], vt); test87(array1, null, false); @@ -2107,14 +2111,14 @@ public void test88_verifier(boolean warmup) { } @Test() - public void test89(MyValue1?[] array, Integer v) { + public void test89(MyValue1.ref[] array, Integer v) { Object o = v; - array[0] = (MyValue1?)o; + array[0] = (MyValue1.ref)o; } @DontCompile public void test89_verifier(boolean warmup) { - MyValue1?[] array1 = new MyValue1?[1]; + MyValue1.ref[] array1 = new MyValue1.ref[1]; test89(array1, null); Asserts.assertEquals(array1[0], null); if (!warmup) { @@ -2133,16 +2137,16 @@ public boolean test90() { boolean b = true; MyValue1[] qArray = new MyValue1[0]; - MyValue1?[] lArray = new MyValue1?[0]; + MyValue1.ref[] lArray = new MyValue1.ref[0]; b = b && (qArray instanceof MyValue1[]); - b = b && (lArray instanceof MyValue1?[]); + b = b && (lArray instanceof MyValue1.ref[]); MyValue1[][] qArray2 = new MyValue1[0][0]; - MyValue1?[][] lArray2 = new MyValue1?[0][0]; + MyValue1.ref[][] lArray2 = new MyValue1.ref[0][0]; b = b && (qArray2 instanceof MyValue1[][]); - b = b && (lArray2 instanceof MyValue1?[][]); + b = b && (lArray2 instanceof MyValue1.ref[][]); return b; } diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestBufferTearing.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestBufferTearing.java index 8ac5e5a32ef..4ecc89ef815 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestBufferTearing.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestBufferTearing.java @@ -36,18 +36,20 @@ * @library /testlibrary /test/lib /compiler/whitebox / * @modules java.base/jdk.internal.misc * @run main/othervm -XX:ValueFieldMaxFlatSize=0 -XX:ValueArrayElemMaxFlatSize=0 - * -XX:+StressGCM -XX:+StressLCM + * -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM -XX:+StressLCM * compiler.valhalla.valuetypes.TestBufferTearing * @run main/othervm -XX:ValueFieldMaxFlatSize=0 -XX:ValueArrayElemMaxFlatSize=0 - * -XX:+StressGCM -XX:+StressLCM -XX:+AlwaysIncrementalInline + * -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM -XX:+StressLCM + * -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline * compiler.valhalla.valuetypes.TestBufferTearing * @run main/othervm -XX:ValueFieldMaxFlatSize=0 -XX:ValueArrayElemMaxFlatSize=0 * -XX:CompileCommand=dontinline,*::incrementAndCheck* - * -XX:+StressGCM -XX:+StressLCM + * -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM -XX:+StressLCM * compiler.valhalla.valuetypes.TestBufferTearing * @run main/othervm -XX:ValueFieldMaxFlatSize=0 -XX:ValueArrayElemMaxFlatSize=0 * -XX:CompileCommand=dontinline,*::incrementAndCheck* - * -XX:+StressGCM -XX:+StressLCM -XX:+AlwaysIncrementalInline + * -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM -XX:+StressLCM + * -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline * compiler.valhalla.valuetypes.TestBufferTearing */ diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestC2CCalls.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestC2CCalls.java index 5e5d4865873..8b366b31dcb 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestC2CCalls.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestC2CCalls.java @@ -75,10 +75,10 @@ private OtherVal(int x) { static interface MyInterface1 { public MyInterface1 test1(OtherVal other, int y); - public MyInterface1 test2(OtherVal other1, OtherVal? other2, int y); - public MyInterface1 test3(OtherVal other1, OtherVal? other2, int y, boolean deopt); - public MyInterface1 test4(OtherVal other1, OtherVal? other2, int y); - public MyInterface1 test5(OtherVal other1, OtherVal? other2, int y); + public MyInterface1 test2(OtherVal other1, OtherVal.ref other2, int y); + public MyInterface1 test3(OtherVal other1, OtherVal.ref other2, int y, boolean deopt); + public MyInterface1 test4(OtherVal other1, OtherVal.ref other2, int y); + public MyInterface1 test5(OtherVal other1, OtherVal.ref other2, int y); public MyInterface1 test6(); public MyInterface1 test7(int i1, int i2, int i3, int i4, int i5, int i6); public MyInterface1 test8(int i1, int i2, int i3, int i4, int i5, int i6, int i7); @@ -106,12 +106,12 @@ public MyValue1 test1(OtherVal other, int y) { } @Override - public MyValue1 test2(OtherVal other1, OtherVal? other2, int y) { + public MyValue1 test2(OtherVal other1, OtherVal.ref other2, int y) { return new MyValue1(x + other1.x + other2.x + y); } @Override - public MyValue1 test3(OtherVal other1, OtherVal? other2, int y, boolean deopt) { + public MyValue1 test3(OtherVal other1, OtherVal.ref other2, int y, boolean deopt) { if (!deopt) { return new MyValue1(x + other1.x + other2.x + y); } else { @@ -121,12 +121,12 @@ public MyValue1 test3(OtherVal other1, OtherVal? other2, int y, boolean deopt) { } @Override - public MyValue1 test4(OtherVal other1, OtherVal? other2, int y) { + public MyValue1 test4(OtherVal other1, OtherVal.ref other2, int y) { return new MyValue1(x + other1.x + other2.x + y); } @Override - public MyValue1 test5(OtherVal other1, OtherVal? other2, int y) { + public MyValue1 test5(OtherVal other1, OtherVal.ref other2, int y) { return new MyValue1(x + other1.x + other2.x + y); } @@ -172,12 +172,12 @@ public MyValue2 test1(OtherVal other, int y) { } @Override - public MyValue2 test2(OtherVal other1, OtherVal? other2, int y) { + public MyValue2 test2(OtherVal other1, OtherVal.ref other2, int y) { return new MyValue2(x + other1.x + other2.x + y); } @Override - public MyValue2 test3(OtherVal other1, OtherVal? other2, int y, boolean deopt) { + public MyValue2 test3(OtherVal other1, OtherVal.ref other2, int y, boolean deopt) { if (!deopt) { return new MyValue2(x + other1.x + other2.x + y); } else { @@ -187,12 +187,12 @@ public MyValue2 test3(OtherVal other1, OtherVal? other2, int y, boolean deopt) { } @Override - public MyValue2 test4(OtherVal other1, OtherVal? other2, int y) { + public MyValue2 test4(OtherVal other1, OtherVal.ref other2, int y) { return new MyValue2(x + other1.x + other2.x + y); } @Override - public MyValue2 test5(OtherVal other1, OtherVal? other2, int y) { + public MyValue2 test5(OtherVal other1, OtherVal.ref other2, int y) { return new MyValue2(x + other1.x + other2.x + y); } @@ -241,13 +241,13 @@ public int getValue() { @Override public MyValue3 test1(OtherVal other, int y) { return MyValue3.default; } @Override - public MyValue3 test2(OtherVal other1, OtherVal? other2, int y) { return MyValue3.default; } + public MyValue3 test2(OtherVal other1, OtherVal.ref other2, int y) { return MyValue3.default; } @Override - public MyValue3 test3(OtherVal other1, OtherVal? other2, int y, boolean deopt) { return MyValue3.default; } + public MyValue3 test3(OtherVal other1, OtherVal.ref other2, int y, boolean deopt) { return MyValue3.default; } @Override - public MyValue3 test4(OtherVal other1, OtherVal? other2, int y) { return MyValue3.default; } + public MyValue3 test4(OtherVal other1, OtherVal.ref other2, int y) { return MyValue3.default; } @Override - public MyValue3 test5(OtherVal other1, OtherVal? other2, int y) { return MyValue3.default; } + public MyValue3 test5(OtherVal other1, OtherVal.ref other2, int y) { return MyValue3.default; } @Override public MyValue3 test6() { return MyValue3.default; } @@ -291,13 +291,13 @@ public int getValue() { @Override public MyValue4 test1(OtherVal other, int y) { return MyValue4.default; } @Override - public MyValue4 test2(OtherVal other1, OtherVal? other2, int y) { return MyValue4.default; } + public MyValue4 test2(OtherVal other1, OtherVal.ref other2, int y) { return MyValue4.default; } @Override - public MyValue4 test3(OtherVal other1, OtherVal? other2, int y, boolean deopt) { return MyValue4.default; } + public MyValue4 test3(OtherVal other1, OtherVal.ref other2, int y, boolean deopt) { return MyValue4.default; } @Override - public MyValue4 test4(OtherVal other1, OtherVal? other2, int y) { return MyValue4.default; } + public MyValue4 test4(OtherVal other1, OtherVal.ref other2, int y) { return MyValue4.default; } @Override - public MyValue4 test5(OtherVal other1, OtherVal? other2, int y) { return MyValue4.default; } + public MyValue4 test5(OtherVal other1, OtherVal.ref other2, int y) { return MyValue4.default; } @Override public MyValue4 test6() { return MyValue4.default; } @@ -338,12 +338,12 @@ public MyObject test1(OtherVal other, int y) { } @Override - public MyObject test2(OtherVal other1, OtherVal? other2, int y) { + public MyObject test2(OtherVal other1, OtherVal.ref other2, int y) { return new MyObject(x + other1.x + other2.x + y); } @Override - public MyObject test3(OtherVal other1, OtherVal? other2, int y, boolean deopt) { + public MyObject test3(OtherVal other1, OtherVal.ref other2, int y, boolean deopt) { if (!deopt) { return new MyObject(x + other1.x + other2.x + y); } else { @@ -353,12 +353,12 @@ public MyObject test3(OtherVal other1, OtherVal? other2, int y, boolean deopt) { } @Override - public MyObject test4(OtherVal other1, OtherVal? other2, int y) { + public MyObject test4(OtherVal other1, OtherVal.ref other2, int y) { return new MyObject(x + other1.x + other2.x + y); } @Override - public MyObject test5(OtherVal other1, OtherVal? other2, int y) { + public MyObject test5(OtherVal other1, OtherVal.ref other2, int y) { return new MyObject(x + other1.x + other2.x + y); } diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestCallingConvention.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestCallingConvention.java index 6748e26a7e2..648b76627ca 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestCallingConvention.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestCallingConvention.java @@ -440,7 +440,7 @@ public void test21_verifier(boolean warmup) { } // Test returning a non-flattened value type as fields - MyValue3? test22_vt = MyValue3.create(); + MyValue3.ref test22_vt = MyValue3.create(); @Test public MyValue3 test22() { @@ -492,19 +492,19 @@ public void test23_verifier(boolean warmup) { // Should not return a nullable value type as fields @Test - public MyValue2? test24() { + public MyValue2.ref test24() { return null; } @DontCompile public void test24_verifier(boolean warmup) { - MyValue2? vt = test24(); + MyValue2.ref vt = test24(); Asserts.assertEQ(vt, null); } // Same as test24 but with control flow and inlining @ForceInline - public MyValue2? test26_callee(boolean b) { + public MyValue2.ref test26_callee(boolean b) { if (b) { return null; } else { @@ -513,13 +513,13 @@ public MyValue2? test26_callee(boolean b) { } @Test - public MyValue2? test26(boolean b) { + public MyValue2.ref test26(boolean b) { return test26_callee(b); } @DontCompile public void test26_verifier(boolean warmup) { - MyValue2? vt = test26(true); + MyValue2.ref vt = test26(true); Asserts.assertEQ(vt, null); vt = test26(false); Asserts.assertEQ(vt.hash(), MyValue2.createWithFieldsInline(rI, true).hash()); @@ -579,7 +579,7 @@ public void test27_verifier(boolean warmup) { Asserts.assertEQ(result, 8*rI); } - static final MyValue1? test28Val = MyValue1.createWithFieldsDontInline(rI, rL); + static final MyValue1.ref test28Val = MyValue1.createWithFieldsDontInline(rI, rL); @Test @Warmup(0) diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestCallingConventionC1.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestCallingConventionC1.java index e22b67252c2..c0bea8db81d 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestCallingConventionC1.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestCallingConventionC1.java @@ -1763,15 +1763,15 @@ public void test86_verifier(boolean warmup) { // Tests for how C1 handles ValueTypeReturnedAsFields in both calls and returns (RefPoint?) //------------------------------------------------------------------------------- - // C2->C1 invokestatic with ValueTypeReturnedAsFields (RefPoint?) + // C2->C1 invokestatic with ValueTypeReturnedAsFields (RefPoint.ref) @Test(compLevel = C2) - public RefPoint? test87(RefPoint? p) { + public RefPoint.ref test87(RefPoint.ref p) { return test87_helper(p); } @DontInline @ForceCompile(compLevel = C1) - private static RefPoint? test87_helper(RefPoint? p) { + private static RefPoint.ref test87_helper(RefPoint.ref p) { return p; } @@ -1781,15 +1781,15 @@ public void test87_verifier(boolean warmup) { Asserts.assertEQ(result, null); } - // C2->C1 invokestatic with ValueTypeReturnedAsFields (RefPoint? with constant null) + // C2->C1 invokestatic with ValueTypeReturnedAsFields (RefPoint.ref with constant null) @Test(compLevel = C2) - public RefPoint? test88() { + public RefPoint.ref test88() { return test88_helper(); } @DontInline @ForceCompile(compLevel = C1) - private static RefPoint? test88_helper() { + private static RefPoint.ref test88_helper() { return null; } @@ -1799,15 +1799,15 @@ public void test88_verifier(boolean warmup) { Asserts.assertEQ(result, null); } - // C1->C2 invokestatic with ValueTypeReturnedAsFields (RefPoint?) + // C1->C2 invokestatic with ValueTypeReturnedAsFields (RefPoint.ref) @Test(compLevel = C1) - public RefPoint? test89(RefPoint? p) { + public RefPoint.ref test89(RefPoint.ref p) { return test89_helper(p); } @DontInline @ForceCompile(compLevel = C2) - private static RefPoint? test89_helper(RefPoint? p) { + private static RefPoint.ref test89_helper(RefPoint.ref p) { return p; } diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestDeoptimizationWhenBuffering.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestDeoptimizationWhenBuffering.java index 3681a48d380..a2a5e551a6a 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestDeoptimizationWhenBuffering.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestDeoptimizationWhenBuffering.java @@ -78,7 +78,7 @@ final inline class MyValue1 { static int cnt = 0; final int x; final MyValue2 vtField1; - final MyValue2? vtField2; + final MyValue2.ref vtField2; public MyValue1() { this.x = ++cnt; @@ -162,7 +162,7 @@ Object test7(Object[] obj) { return obj[0]; } - MyValue1? test8(MyValue1?[] obj) { + MyValue1.ref test8(MyValue1.ref[] obj) { return obj[0]; } diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestFlatArrayThreshold.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestFlatArrayThreshold.java index 5620ec3efbe..f8b659058a7 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestFlatArrayThreshold.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestFlatArrayThreshold.java @@ -49,7 +49,7 @@ public static MyValue1 test1(MyValue1[] va, MyValue1 vt) { return va[1]; } - public static MyValue1? test2(MyValue1?[] va, MyValue1? vt) { + public static MyValue1.ref test2(MyValue1.ref[] va, MyValue1.ref vt) { va[0] = vt; return va[1]; } @@ -59,7 +59,7 @@ public static Object test3(Object[] va, MyValue1 vt) { return va[1]; } - public static Object test4(Object[] va, MyValue1? vt) { + public static Object test4(Object[] va, MyValue1.ref vt) { va[0] = vt; return va[1]; } @@ -69,8 +69,8 @@ public static MyValue1 test5(MyValue1[] va, Object vt) { return va[1]; } - public static MyValue1? test6(MyValue1?[] va, Object vt) { - va[0] = (MyValue1?)vt; + public static MyValue1.ref test6(MyValue1.ref[] va, Object vt) { + va[0] = (MyValue1.ref)vt; return va[1]; } @@ -82,45 +82,45 @@ public static Object test7(Object[] va, Object vt) { static public void main(String[] args) { MyValue1 vt = new MyValue1(); MyValue1[] va = new MyValue1[2]; - MyValue1?[] vaB = new MyValue1?[2]; + MyValue1.ref[] vaB = new MyValue1.ref[2]; va[1] = vt; for (int i = 0; i < 10_000; ++i) { MyValue1 result1 = test1(va, vt); Asserts.assertEQ(result1.o1, 42); Asserts.assertEQ(result1.o2, 43); - MyValue1? result2 = test2(va, vt); + MyValue1.ref result2 = test2(va, vt); Asserts.assertEQ(result2.o1, 42); Asserts.assertEQ(result2.o2, 43); result2 = test2(vaB, null); Asserts.assertEQ(result2, null); - MyValue1? result3 = (MyValue1?)test3(va, vt); + MyValue1.ref result3 = (MyValue1.ref)test3(va, vt); Asserts.assertEQ(result3.o1, 42); Asserts.assertEQ(result3.o2, 43); - result3 = (MyValue1?)test3(vaB, vt); + result3 = (MyValue1.ref)test3(vaB, vt); Asserts.assertEQ(result3, null); - MyValue1? result4 = (MyValue1?)test4(va, vt); + MyValue1.ref result4 = (MyValue1.ref)test4(va, vt); Asserts.assertEQ(result4.o1, 42); Asserts.assertEQ(result4.o2, 43); - result4 = (MyValue1?)test4(vaB, null); + result4 = (MyValue1.ref)test4(vaB, null); Asserts.assertEQ(result4, null); MyValue1 result5 = test5(va, vt); Asserts.assertEQ(result5.o1, 42); Asserts.assertEQ(result5.o2, 43); - MyValue1? result6 = test6(va, vt); + MyValue1.ref result6 = test6(va, vt); Asserts.assertEQ(result6.o1, 42); Asserts.assertEQ(result6.o2, 43); result6 = test6(vaB, null); Asserts.assertEQ(result6, null); - MyValue1? result7 = (MyValue1?)test7(va, vt); + MyValue1.ref result7 = (MyValue1.ref)test7(va, vt); Asserts.assertEQ(result7.o1, 42); Asserts.assertEQ(result7.o2, 43); - result7 = (MyValue1?)test7(vaB, null); + result7 = (MyValue1.ref)test7(vaB, null); Asserts.assertEQ(result7, null); } try { diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestIntrinsics.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestIntrinsics.java index 8373e7187d9..c2ac5700427 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestIntrinsics.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestIntrinsics.java @@ -107,6 +107,7 @@ public Class test3(Class cls) { public void test3_verifier(boolean warmup) { Asserts.assertTrue(test3(Object.class) == null, "test3_1 failed"); + Asserts.assertTrue(test3(MyValue1.class.asIndirectType()) == MyAbstract.class, "test3_2 failed"); Asserts.assertTrue(test3(MyValue1.class.asPrimaryType()) == MyAbstract.class, "test3_3 failed"); Asserts.assertTrue(test3(Class.class) == Object.class, "test3_4 failed"); @@ -116,8 +117,11 @@ public void test3_verifier(boolean warmup) { @Test(failOn = LOADK) public boolean test4() { boolean check1 = Object.class.getSuperclass() == null; - boolean check2 = MyValue1.class.asIndirectType().getSuperclass() == MyAbstract.class; - boolean check3 = MyValue1.class.asPrimaryType().getSuperclass() == MyAbstract.class; + + // TODO Remove cast as workaround once javac is fixed + boolean check2 = (Class)MyValue1.class.asIndirectType().getSuperclass() == MyAbstract.class; + // TODO Remove cast as workaround once javac is fixed + boolean check3 = (Class)MyValue1.class.asPrimaryType().getSuperclass() == MyAbstract.class; boolean check4 = Class.class.getSuperclass() == Object.class; return check1 && check2 && check3 && check4; } @@ -434,7 +438,8 @@ public Test25Value() { @Test public Test25Value[] test25(Test25Value element) { - Test25Value[] newArray = Arrays.copyOf(test25Array, test25Array.length + 1); + // TODO Remove cast as workaround once javac is fixed + Test25Value[] newArray = (Test25Value[])Arrays.copyOf(test25Array, test25Array.length + 1); newArray[test25Array.length] = element; return newArray; } @@ -462,7 +467,7 @@ public void test26_verifier(boolean warmup) { } // Load non-flattenable value type field with unsafe - MyValue1? test27_vt = MyValue1.createWithFieldsInline(rI, rL); + MyValue1.ref test27_vt = MyValue1.createWithFieldsInline(rI, rL); private static final long TEST27_OFFSET; static { try { @@ -747,13 +752,13 @@ public void test40_verifier(boolean warmup) { // Class.isInstance @Test() - public boolean test41(Class c, MyValue1? vt) { + public boolean test41(Class c, MyValue1.ref vt) { return c.isInstance(vt); } @DontCompile public void test41_verifier(boolean warmup) { - MyValue1? vt = MyValue1.createWithFieldsInline(rI, rL); + MyValue1.ref vt = MyValue1.createWithFieldsInline(rI, rL); boolean result = test41(MyValue1.class.asIndirectType(), vt); Asserts.assertTrue(result); result = test41(MyValue1.class, vt); @@ -761,13 +766,13 @@ public void test41_verifier(boolean warmup) { } @Test() - public boolean test42(Class c, MyValue1? vt) { + public boolean test42(Class c, MyValue1.ref vt) { return c.isInstance(vt); } @DontCompile public void test42_verifier(boolean warmup) { - MyValue1? vt = MyValue1.createWithFieldsInline(rI, rL); + MyValue1.ref vt = MyValue1.createWithFieldsInline(rI, rL); boolean result = test42(MyValue2.class.asIndirectType(), vt); Asserts.assertFalse(result); result = test42(MyValue2.class, vt); @@ -776,13 +781,13 @@ public void test42_verifier(boolean warmup) { // Class.cast @Test() - public Object test43(Class c, MyValue1? vt) { + public Object test43(Class c, MyValue1.ref vt) { return c.cast(vt); } @DontCompile public void test43_verifier(boolean warmup) { - MyValue1? vt = MyValue1.createWithFieldsInline(rI, rL); + MyValue1.ref vt = MyValue1.createWithFieldsInline(rI, rL); Object result = test43(MyValue1.class.asIndirectType(), vt); Asserts.assertEQ(((MyValue1)result).hash(), vt.hash()); result = test43(MyValue1.class.asIndirectType(), null); @@ -790,13 +795,13 @@ public void test43_verifier(boolean warmup) { } @Test() - public Object test44(Class c, MyValue1? vt) { + public Object test44(Class c, MyValue1.ref vt) { return c.cast(vt); } @DontCompile public void test44_verifier(boolean warmup) { - MyValue1? vt = MyValue1.createWithFieldsInline(rI, rL); + MyValue1.ref vt = MyValue1.createWithFieldsInline(rI, rL); try { test44(MyValue2.class.asIndirectType(), vt); throw new RuntimeException("should have thrown"); @@ -805,13 +810,13 @@ public void test44_verifier(boolean warmup) { } @Test() - public Object test45(MyValue1? vt) { + public Object test45(MyValue1.ref vt) { return MyValue1.class.asIndirectType().cast(vt); } @DontCompile public void test45_verifier(boolean warmup) { - MyValue1? vt = MyValue1.createWithFieldsInline(rI, rL); + MyValue1.ref vt = MyValue1.createWithFieldsInline(rI, rL); Object result = test45(vt); Asserts.assertEQ(((MyValue1)result).hash(), vt.hash()); result = test45(null); @@ -819,13 +824,13 @@ public void test45_verifier(boolean warmup) { } @Test() - public Object test46(MyValue1? vt) { + public Object test46(MyValue1.ref vt) { return MyValue2.class.asIndirectType().cast(vt); } @DontCompile public void test46_verifier(boolean warmup) { - MyValue1? vt = MyValue1.createWithFieldsInline(rI, rL); + MyValue1.ref vt = MyValue1.createWithFieldsInline(rI, rL); test46(null); try { test46(vt); @@ -835,13 +840,13 @@ public void test46_verifier(boolean warmup) { } @Test() - public Object test47(MyValue1? vt) { + public Object test47(MyValue1.ref vt) { return MyValue1.class.asPrimaryType().cast(vt); } @DontCompile public void test47_verifier(boolean warmup) { - MyValue1? vt = MyValue1.createWithFieldsInline(rI, rL); + MyValue1.ref vt = MyValue1.createWithFieldsInline(rI, rL); Object result = test47(vt); Asserts.assertEQ(((MyValue1)result).hash(), vt.hash()); try { @@ -852,13 +857,13 @@ public void test47_verifier(boolean warmup) { } @Test() - public Object test48(Class c, MyValue1? vt) { + public Object test48(Class c, MyValue1.ref vt) { return c.cast(vt); } @DontCompile public void test48_verifier(boolean warmup) { - MyValue1? vt = MyValue1.createWithFieldsInline(rI, rL); + MyValue1.ref vt = MyValue1.createWithFieldsInline(rI, rL); Object result = test48(MyValue1.class, vt); Asserts.assertEQ(((MyValue1)result).hash(), vt.hash()); try { @@ -889,16 +894,16 @@ public Object test50(Class c, Object obj) { public void test50_verifier(boolean warmup) { MyValue1 vt = MyValue1.createWithFieldsInline(rI, rL); MyValue1[] va = new MyValue1[42]; - MyValue1?[] vba = new MyValue1?[42]; + MyValue1.ref[] vba = new MyValue1.ref[42]; Object result = test50(MyValue1.class, vt); Asserts.assertEQ(((MyValue1)result).hash(), vt.hash()); result = test50(MyValue1.class.asIndirectType(), vt); Asserts.assertEQ(((MyValue1)result).hash(), vt.hash()); result = test50(MyValue1[].class, va); Asserts.assertEQ(result, va); - result = test50(MyValue1?[].class, vba); + result = test50(MyValue1.ref[].class, vba); Asserts.assertEQ(result, vba); - result = test50(MyValue1?[].class, va); + result = test50(MyValue1.ref[].class, va); Asserts.assertEQ(result, va); try { test50(MyValue1.class, null); @@ -931,13 +936,13 @@ public void test51_verifier(boolean warmup) { @Test() public Object[][] test52(int len, int val) { MyValue1[][] va1 = (MyValue1[][])Array.newInstance(MyValue1[].class, len); - MyValue1?[][] va2 = (MyValue1?[][])Array.newInstance(MyValue1?[].class, len); + MyValue1.ref[][] va2 = (MyValue1.ref[][])Array.newInstance(MyValue1.ref[].class, len); Object[][] result; if (val == 1) { va1[0] = new MyValue1[1]; result = va1; } else { - va2[0] = new MyValue1?[1]; + va2[0] = new MyValue1.ref[1]; result = va2; } if (val == 1) { @@ -958,7 +963,7 @@ public void test52_verifier(boolean warmup) { @Test() public Object[][] test53(Class c1, Class c2, int len, int val) { MyValue1[][] va1 = (MyValue1[][])Array.newInstance(MyValue1[].class, len); - MyValue1?[][] va2 = (MyValue1?[][])Array.newInstance(MyValue1?[].class, len); + MyValue1.ref[][] va2 = (MyValue1.ref[][])Array.newInstance(MyValue1.ref[].class, len); Object[][] va3 = (Object[][])Array.newInstance(c1, len); Object[][] va4 = (Object[][])Array.newInstance(c2, len); for (int i = 0; i < len; ++i) { @@ -967,9 +972,9 @@ public Object[][] test53(Class c1, Class c2, int len, int val) { Asserts.assertEQ(va3[i], null); Asserts.assertEQ(va4[i], null); va1[i] = new MyValue1[1]; - va2[i] = new MyValue1?[1]; + va2[i] = new MyValue1.ref[1]; va3[i] = new MyValue1[1]; - va4[i] = new MyValue1?[1]; + va4[i] = new MyValue1.ref[1]; Asserts.assertEQ(va1[i][0].hash(), ((MyValue1)va3[i][0]).hash()); Asserts.assertEQ(va2[i][0], null); Asserts.assertEQ(va4[i][0], null); @@ -996,10 +1001,10 @@ public Object[][] test53(Class c1, Class c2, int len, int val) { @DontCompile public void test53_verifier(boolean warmup) { int len = Math.abs(rI) % 42; - test53(MyValue1[].class, MyValue1?[].class, len, 1); - test53(MyValue1[].class, MyValue1?[].class, len, 2); - test53(MyValue1[].class, MyValue1?[].class, len, 3); - test53(MyValue1[].class, MyValue1?[].class, len, 4); + test53(MyValue1[].class, MyValue1.ref[].class, len, 1); + test53(MyValue1[].class, MyValue1.ref[].class, len, 2); + test53(MyValue1[].class, MyValue1.ref[].class, len, 3); + test53(MyValue1[].class, MyValue1.ref[].class, len, 4); } // Test asIndirectType intrinsic with non-value mirror @@ -1034,7 +1039,7 @@ public void test55_verifier(boolean warmup) { // Same as test39 but Unsafe.putInt to buffer is not intrinsified/compiled @DontCompile - public void test56_callee(MyValue1? v) { // Use ? here to make sure the argument is not scalarized (otherwise larval information is lost) + public void test56_callee(MyValue1.ref v) { // Use .ref here to make sure the argument is not scalarized (otherwise larval information is lost) U.putInt(v, X_OFFSET, rI); } diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestLWorld.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestLWorld.java index 05e7e248349..4ef4da426a0 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestLWorld.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestLWorld.java @@ -117,14 +117,14 @@ public void test1_verifier(boolean warmup) { MyValue1 valueField1 = testValue1; MyValue1 valueField2 = testValue1; - MyValue1? valueField3 = testValue1; + MyValue1.ref valueField3 = testValue1; MyValue1 valueField4; - MyValue1? valueField5; + MyValue1.ref valueField5; - static MyValue1? staticValueField1 = testValue1; + static MyValue1.ref staticValueField1 = testValue1; static MyValue1 staticValueField2 = testValue1; static MyValue1 staticValueField3; - static MyValue1? staticValueField4; + static MyValue1.ref staticValueField4; @DontInline public Object readValueField5() { @@ -1340,8 +1340,8 @@ public void test41_verifier(boolean warmup) { } // Test for bug in Escape Analysis - private static final MyValue1? test42VT1 = MyValue1.createWithFieldsInline(rI, rL); - private static final MyValue1? test42VT2 = MyValue1.createWithFieldsInline(rI + 1, rL + 1); + private static final MyValue1.ref test42VT1 = MyValue1.createWithFieldsInline(rI, rL); + private static final MyValue1.ref test42VT2 = MyValue1.createWithFieldsInline(rI + 1, rL + 1); @Test() public void test42() { @@ -1501,9 +1501,9 @@ final inline class Test51Value { final MyValue1 valueField1; final MyValue1 valueField2; - final MyValue1? valueField3; + final MyValue1.ref valueField3; final MyValue1 valueField4; - final MyValue1? valueField5; + final MyValue1.ref valueField5; public Test51Value() { objectField1 = null; @@ -1520,7 +1520,7 @@ public Test51Value() { } public Test51Value(Object o1, Object o2, Object o3, Object o4, Object o5, Object o6, - MyValue1 vt1, MyValue1 vt2, MyValue1? vt3, MyValue1 vt4, MyValue1? vt5) { + MyValue1 vt1, MyValue1 vt2, MyValue1.ref vt3, MyValue1 vt4, MyValue1.ref vt5) { objectField1 = o1; objectField2 = o2; objectField3 = o3; @@ -2091,12 +2091,12 @@ public void test77_verifier(boolean warmup) throws Throwable { // Casting a null Integer to a nullable value type should not throw @ForceInline - public MyValue1? test78_helper(Object o) { - return (MyValue1?)o; + public MyValue1.ref test78_helper(Object o) { + return (MyValue1.ref)o; } @Test - public MyValue1? test78(Integer i) throws Throwable { + public MyValue1.ref test78(Integer i) throws Throwable { return test78_helper(i); } @@ -2111,12 +2111,12 @@ public void test78_verifier(boolean warmup) throws Throwable { // Casting an Integer to a nullable value type should throw a ClassCastException @ForceInline - public MyValue1? test79_helper(Object o) { - return (MyValue1?)o; + public MyValue1.ref test79_helper(Object o) { + return (MyValue1.ref)o; } @Test - public MyValue1? test79(Integer i) throws Throwable { + public MyValue1.ref test79(Integer i) throws Throwable { return test79_helper(i); } diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestLWorldProfiling.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestLWorldProfiling.java index 84a618fdb86..3822170e60e 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestLWorldProfiling.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestLWorldProfiling.java @@ -83,7 +83,7 @@ public static void main(String[] args) throws Throwable { private static final Integer[] testIntegerArray = new Integer[] {42}; private static final Long[] testLongArray = new Long[] {42L}; private static final Double[] testDoubleArray = new Double[] {42.0D}; - private static final MyValue1?[] testValue1NotFlatArray = new MyValue1?[] {testValue1}; + private static final MyValue1.ref[] testValue1NotFlatArray = new MyValue1.ref[] {testValue1}; private static final MyValue1[][] testValue1ArrayArray = new MyValue1[][] {testValue1Array}; // aaload diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNullableArrays.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNullableArrays.java index d4c450ad7db..7f3b48a583a 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNullableArrays.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNullableArrays.java @@ -80,8 +80,8 @@ protected long hash(int x, long y) { // Test nullable value type array creation and initialization @Test(valid = ValueTypeArrayFlattenOn, match = { ALLOCA }, matchCount = { 1 }) @Test(valid = ValueTypeArrayFlattenOff, match = { ALLOCA }, matchCount = { 1 }, failOn = LOAD) - public MyValue1?[] test1(int len) { - MyValue1?[] va = new MyValue1?[len]; + public MyValue1.ref[] test1(int len) { + MyValue1.ref[] va = new MyValue1.ref[len]; if (len > 0) { va[0] = null; } @@ -94,7 +94,7 @@ public MyValue1?[] test1(int len) { @DontCompile public void test1_verifier(boolean warmup) { int len = Math.abs(rI % 10); - MyValue1?[] va = test1(len); + MyValue1.ref[] va = test1(len); if (len > 0) { Asserts.assertEQ(va[0], null); } @@ -108,7 +108,7 @@ public void test1_verifier(boolean warmup) { // TODO 8227588 // @Test(failOn = ALLOC + ALLOCA + LOOP + LOAD + STORE + TRAP) public long test2() { - MyValue1?[] va = new MyValue1?[1]; + MyValue1.ref[] va = new MyValue1.ref[1]; va[0] = MyValue1.createWithFieldsInline(rI, rL); return va[0].hash(); } @@ -122,7 +122,7 @@ public void test2_verifier(boolean warmup) { // Test receiving a value type array from the interpreter, // updating its elements in a loop and computing a hash. @Test(failOn = ALLOCA) - public long test3(MyValue1?[] va) { + public long test3(MyValue1.ref[] va) { long result = 0; for (int i = 0; i < 10; ++i) { if (va[i] != null) { @@ -136,7 +136,7 @@ public long test3(MyValue1?[] va) { @DontCompile public void test3_verifier(boolean warmup) { - MyValue1?[] va = new MyValue1?[10]; + MyValue1.ref[] va = new MyValue1.ref[10]; long expected = 0; for (int i = 1; i < 10; ++i) { va[i] = MyValue1.createWithFieldsDontInline(rI + i, rL + i); @@ -154,13 +154,13 @@ public void test3_verifier(boolean warmup) { // Test returning a value type array received from the interpreter @Test(failOn = ALLOC + ALLOCA + LOAD + STORE + LOOP + TRAP) - public MyValue1?[] test4(MyValue1?[] va) { + public MyValue1.ref[] test4(MyValue1.ref[] va) { return va; } @DontCompile public void test4_verifier(boolean warmup) { - MyValue1?[] va = new MyValue1?[10]; + MyValue1.ref[] va = new MyValue1.ref[10]; for (int i = 0; i < 10; ++i) { va[i] = MyValue1.createWithFieldsDontInline(rI + i, rL + i); } @@ -172,16 +172,16 @@ public void test4_verifier(boolean warmup) { // Merge value type arrays created from two branches @Test - public MyValue1?[] test5(boolean b) { - MyValue1?[] va; + public MyValue1.ref[] test5(boolean b) { + MyValue1.ref[] va; if (b) { - va = new MyValue1?[5]; + va = new MyValue1.ref[5]; for (int i = 0; i < 5; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); } va[4] = null; } else { - va = new MyValue1?[10]; + va = new MyValue1.ref[10]; for (int i = 0; i < 10; ++i) { va[i] = MyValue1.createWithFieldsInline(rI + i, rL + i); } @@ -198,7 +198,7 @@ public MyValue1?[] test5(boolean b) { @DontCompile public void test5_verifier(boolean warmup) { - MyValue1?[] va = test5(true); + MyValue1.ref[] va = test5(true); Asserts.assertEQ(va.length, 5); Asserts.assertEQ(va[0].hash(), hash(rI, hash())); for (int i = 1; i < 4; ++i) { @@ -216,28 +216,28 @@ public void test5_verifier(boolean warmup) { // Test creation of value type array with single element @Test(failOn = ALLOC + ALLOCA + LOOP + LOAD + STORE + TRAP) - public MyValue1? test6() { - MyValue1?[] va = new MyValue1?[1]; + public MyValue1.ref test6() { + MyValue1.ref[] va = new MyValue1.ref[1]; return va[0]; } @DontCompile public void test6_verifier(boolean warmup) { - MyValue1?[] va = new MyValue1?[1]; - MyValue1? v = test6(); + MyValue1.ref[] va = new MyValue1.ref[1]; + MyValue1.ref v = test6(); Asserts.assertEQ(v, null); } // Test default initialization of value type arrays @Test(failOn = LOAD) - public MyValue1?[] test7(int len) { - return new MyValue1?[len]; + public MyValue1.ref[] test7(int len) { + return new MyValue1.ref[len]; } @DontCompile public void test7_verifier(boolean warmup) { int len = Math.abs(rI % 10); - MyValue1?[] va = test7(len); + MyValue1.ref[] va = test7(len); for (int i = 0; i < len; ++i) { Asserts.assertEQ(va[i], null); va[i] = null; @@ -246,17 +246,17 @@ public void test7_verifier(boolean warmup) { // Test creation of value type array with zero length @Test(failOn = ALLOC + LOAD + STORE + LOOP + TRAP) - public MyValue1?[] test8() { - return new MyValue1?[0]; + public MyValue1.ref[] test8() { + return new MyValue1.ref[0]; } @DontCompile public void test8_verifier(boolean warmup) { - MyValue1?[] va = test8(); + MyValue1.ref[] va = test8(); Asserts.assertEQ(va.length, 0); } - static MyValue1?[] test9_va; + static MyValue1.ref[] test9_va; // Test that value type array loaded from field has correct type @Test(failOn = LOOP) @@ -266,7 +266,7 @@ public long test9() { @DontCompile public void test9_verifier(boolean warmup) { - test9_va = new MyValue1?[1]; + test9_va = new MyValue1.ref[1]; test9_va[0] = testValue1; long result = test9(); Asserts.assertEQ(result, hash()); @@ -274,8 +274,8 @@ public void test9_verifier(boolean warmup) { // Multi-dimensional arrays @Test - public MyValue1?[][][] test10(int len1, int len2, int len3) { - MyValue1?[][][] arr = new MyValue1?[len1][len2][len3]; + public MyValue1.ref[][][] test10(int len1, int len2, int len3) { + MyValue1.ref[][][] arr = new MyValue1.ref[len1][len2][len3]; for (int i = 0; i < len1; i++) { for (int j = 0; j < len2; j++) { for (int k = 0; k < len3; k++) { @@ -291,7 +291,7 @@ public MyValue1?[][][] test10(int len1, int len2, int len3) { @DontCompile public void test10_verifier(boolean warmup) { - MyValue1?[][][] arr = test10(2, 3, 4); + MyValue1.ref[][][] arr = test10(2, 3, 4); for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 4; k++) { @@ -307,7 +307,7 @@ public void test10_verifier(boolean warmup) { } @Test - public void test11(MyValue1?[][][] arr, long[] res) { + public void test11(MyValue1.ref[][][] arr, long[] res) { int l = 0; for (int i = 0; i < arr.length; i++) { for (int j = 0; j < arr[i].length; j++) { @@ -324,7 +324,7 @@ public void test11(MyValue1?[][][] arr, long[] res) { @DontCompile public void test11_verifier(boolean warmup) { - MyValue1?[][][] arr = new MyValue1?[2][3][4]; + MyValue1.ref[][][] arr = new MyValue1.ref[2][3][4]; long[] res = new long[2*3*4]; long[] verif = new long[2*3*4]; int l = 0; @@ -349,7 +349,7 @@ public void test11_verifier(boolean warmup) { @Test public int test12() { int arraySize = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[arraySize]; + MyValue1.ref[] va = new MyValue1.ref[arraySize]; for (int i = 0; i < arraySize; i++) { va[i] = MyValue1.createWithFieldsDontInline(rI + 1, rL); @@ -370,7 +370,7 @@ public void test12_verifier(boolean warmup) { @Test public int test13() { int arraySize = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[arraySize]; + MyValue1.ref[] va = new MyValue1.ref[arraySize]; for (int i = 0; i < arraySize; i++) { va[i] = MyValue1.createWithFieldsDontInline(rI + i, rL); @@ -389,13 +389,13 @@ public void test13_verifier(boolean warmup) { // Array load out of bound not known to compiler (both lower and upper bound) @Test - public int test14(MyValue1?[] va, int index) { + public int test14(MyValue1.ref[] va, int index) { return va[index].x; } public void test14_verifier(boolean warmup) { int arraySize = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[arraySize]; + MyValue1.ref[] va = new MyValue1.ref[arraySize]; for (int i = 0; i < arraySize; i++) { va[i] = MyValue1.createWithFieldsDontInline(rI, rL); @@ -416,7 +416,7 @@ public void test14_verifier(boolean warmup) { @Test public int test15() { int arraySize = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[arraySize]; + MyValue1.ref[] va = new MyValue1.ref[arraySize]; try { for (int i = 0; i <= arraySize; i++) { @@ -436,7 +436,7 @@ public void test15_verifier(boolean warmup) { @Test public int test16() { int arraySize = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[arraySize]; + MyValue1.ref[] va = new MyValue1.ref[arraySize]; try { for (int i = -1; i <= arraySize; i++) { @@ -454,7 +454,7 @@ public void test16_verifier(boolean warmup) { // Array store out of bound not known to compiler (both lower and upper bound) @Test - public int test17(MyValue1?[] va, int index, MyValue1 vt) { + public int test17(MyValue1.ref[] va, int index, MyValue1 vt) { va[index] = vt; return va[index].x; } @@ -462,7 +462,7 @@ public int test17(MyValue1?[] va, int index, MyValue1 vt) { @DontCompile public void test17_verifier(boolean warmup) { int arraySize = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[arraySize]; + MyValue1.ref[] va = new MyValue1.ref[arraySize]; for (int i = 0; i < arraySize; i++) { va[i] = MyValue1.createWithFieldsDontInline(rI, rL); @@ -486,20 +486,20 @@ public void test17_verifier(boolean warmup) { // clone() as stub call @Test - public MyValue1?[] test18(MyValue1?[] va) { + public MyValue1.ref[] test18(MyValue1.ref[] va) { return va.clone(); } @DontCompile public void test18_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] va1 = new MyValue1?[len]; + MyValue1.ref[] va1 = new MyValue1.ref[len]; MyValue1[] va2 = new MyValue1[len]; for (int i = 1; i < len; ++i) { va1[i] = testValue1; va2[i] = testValue1; } - MyValue1?[] result1 = test18(va1); + MyValue1.ref[] result1 = test18(va1); if (len > 0) { Asserts.assertEQ(result1[0], null); } @@ -509,14 +509,14 @@ public void test18_verifier(boolean warmup) { // make sure we do deopt: GraphKit::new_array assumes an // array of references for (int j = 0; j < 10; j++) { - MyValue1?[] result2 = test18(va2); + MyValue1.ref[] result2 = test18(va2); for (int i = 0; i < len; ++i) { Asserts.assertEQ(result2[i].hash(), va2[i].hash()); } } if (compile_and_run_again_if_deoptimized(warmup, "TestNullableArrays::test18")) { - MyValue1?[] result2 = test18(va2); + MyValue1.ref[] result2 = test18(va2); for (int i = 0; i < len; ++i) { Asserts.assertEQ(result2[i].hash(), va2[i].hash()); } @@ -524,11 +524,11 @@ public void test18_verifier(boolean warmup) { } // clone() as series of loads/stores - static MyValue1?[] test19_orig = null; + static MyValue1.ref[] test19_orig = null; @Test - public MyValue1?[] test19() { - MyValue1?[] va = new MyValue1?[8]; + public MyValue1.ref[] test19() { + MyValue1.ref[] va = new MyValue1.ref[8]; for (int i = 1; i < va.length; ++i) { va[i] = MyValue1.createWithFieldsInline(rI, rL); } @@ -539,7 +539,7 @@ public MyValue1?[] test19() { @DontCompile public void test19_verifier(boolean warmup) { - MyValue1?[] result = test19(); + MyValue1.ref[] result = test19(); Asserts.assertEQ(result[0], null); for (int i = 1; i < test19_orig.length; ++i) { Asserts.assertEQ(result[i].hash(), test19_orig[i].hash()); @@ -548,20 +548,20 @@ public void test19_verifier(boolean warmup) { // arraycopy() of value type array with oop fields @Test - public void test20(MyValue1?[] src, MyValue1?[] dst) { + public void test20(MyValue1.ref[] src, MyValue1.ref[] dst) { System.arraycopy(src, 0, dst, 0, src.length); } @DontCompile public void test20_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] src1 = new MyValue1?[len]; - MyValue1?[] src2 = new MyValue1?[len]; + MyValue1.ref[] src1 = new MyValue1.ref[len]; + MyValue1.ref[] src2 = new MyValue1.ref[len]; MyValue1[] src3 = new MyValue1[len]; MyValue1[] src4 = new MyValue1[len]; - MyValue1?[] dst1 = new MyValue1?[len]; + MyValue1.ref[] dst1 = new MyValue1.ref[len]; MyValue1[] dst2 = new MyValue1[len]; - MyValue1?[] dst3 = new MyValue1?[len]; + MyValue1.ref[] dst3 = new MyValue1.ref[len]; MyValue1[] dst4 = new MyValue1[len]; if (len > 0) { src2[0] = testValue1; @@ -592,20 +592,20 @@ public void test20_verifier(boolean warmup) { // arraycopy() of value type array with no oop field @Test - public void test21(MyValue2?[] src, MyValue2?[] dst) { + public void test21(MyValue2.ref[] src, MyValue2.ref[] dst) { System.arraycopy(src, 0, dst, 0, src.length); } @DontCompile public void test21_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue2?[] src1 = new MyValue2?[len]; - MyValue2?[] src2 = new MyValue2?[len]; + MyValue2.ref[] src1 = new MyValue2.ref[len]; + MyValue2.ref[] src2 = new MyValue2.ref[len]; MyValue2[] src3 = new MyValue2[len]; MyValue2[] src4 = new MyValue2[len]; - MyValue2?[] dst1 = new MyValue2?[len]; + MyValue2.ref[] dst1 = new MyValue2.ref[len]; MyValue2[] dst2 = new MyValue2[len]; - MyValue2?[] dst3 = new MyValue2?[len]; + MyValue2.ref[] dst3 = new MyValue2.ref[len]; MyValue2[] dst4 = new MyValue2[len]; if (len > 0) { src2[0] = MyValue2.createWithFieldsInline(rI, true); @@ -637,8 +637,8 @@ public void test21_verifier(boolean warmup) { // arraycopy() of value type array with oop field and tightly // coupled allocation as dest @Test - public MyValue1?[] test22(MyValue1?[] src) { - MyValue1?[] dst = new MyValue1?[src.length]; + public MyValue1.ref[] test22(MyValue1.ref[] src) { + MyValue1.ref[] dst = new MyValue1.ref[src.length]; System.arraycopy(src, 0, dst, 0, src.length); return dst; } @@ -646,14 +646,14 @@ public MyValue1?[] test22(MyValue1?[] src) { @DontCompile public void test22_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] src1 = new MyValue1?[len]; + MyValue1.ref[] src1 = new MyValue1.ref[len]; MyValue1[] src2 = new MyValue1[len]; for (int i = 1; i < len; ++i) { src1[i] = testValue1; src2[i] = testValue1; } - MyValue1?[] dst1 = test22(src1); - MyValue1?[] dst2 = test22(src2); + MyValue1.ref[] dst1 = test22(src1); + MyValue1.ref[] dst2 = test22(src2); if (len > 0) { Asserts.assertEQ(dst1[0], null); Asserts.assertEQ(dst2[0].hash(), MyValue1.default.hash()); @@ -667,8 +667,8 @@ public void test22_verifier(boolean warmup) { // arraycopy() of value type array with oop fields and tightly // coupled allocation as dest @Test - public MyValue1?[] test23(MyValue1?[] src) { - MyValue1?[] dst = new MyValue1?[src.length + 10]; + public MyValue1.ref[] test23(MyValue1.ref[] src) { + MyValue1.ref[] dst = new MyValue1.ref[src.length + 10]; System.arraycopy(src, 0, dst, 5, src.length); return dst; } @@ -676,14 +676,14 @@ public MyValue1?[] test23(MyValue1?[] src) { @DontCompile public void test23_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] src1 = new MyValue1?[len]; + MyValue1.ref[] src1 = new MyValue1.ref[len]; MyValue1[] src2 = new MyValue1[len]; for (int i = 0; i < len; ++i) { src1[i] = testValue1; src2[i] = testValue1; } - MyValue1?[] dst1 = test23(src1); - MyValue1?[] dst2 = test23(src2); + MyValue1.ref[] dst1 = test23(src1); + MyValue1.ref[] dst2 = test23(src2); for (int i = 0; i < 5; ++i) { Asserts.assertEQ(dst1[i], null); Asserts.assertEQ(dst2[i], null); @@ -696,20 +696,20 @@ public void test23_verifier(boolean warmup) { // arraycopy() of value type array passed as Object @Test - public void test24(MyValue1?[] src, Object dst) { + public void test24(MyValue1.ref[] src, Object dst) { System.arraycopy(src, 0, dst, 0, src.length); } @DontCompile public void test24_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] src1 = new MyValue1?[len]; - MyValue1?[] src2 = new MyValue1?[len]; + MyValue1.ref[] src1 = new MyValue1.ref[len]; + MyValue1.ref[] src2 = new MyValue1.ref[len]; MyValue1[] src3 = new MyValue1[len]; MyValue1[] src4 = new MyValue1[len]; - MyValue1?[] dst1 = new MyValue1?[len]; + MyValue1.ref[] dst1 = new MyValue1.ref[len]; MyValue1[] dst2 = new MyValue1[len]; - MyValue1?[] dst3 = new MyValue1?[len]; + MyValue1.ref[] dst3 = new MyValue1.ref[len]; MyValue1[] dst4 = new MyValue1[len]; if (len > 0) { src2[0] = testValue1; @@ -740,19 +740,19 @@ public void test24_verifier(boolean warmup) { // short arraycopy() with no oop field @Test - public void test25(MyValue2?[] src, MyValue2?[] dst) { + public void test25(MyValue2.ref[] src, MyValue2.ref[] dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test25_verifier(boolean warmup) { - MyValue2?[] src1 = new MyValue2?[8]; - MyValue2?[] src2 = new MyValue2?[8]; + MyValue2.ref[] src1 = new MyValue2.ref[8]; + MyValue2.ref[] src2 = new MyValue2.ref[8]; MyValue2[] src3 = new MyValue2[8]; MyValue2[] src4 = new MyValue2[8]; - MyValue2?[] dst1 = new MyValue2?[8]; + MyValue2.ref[] dst1 = new MyValue2.ref[8]; MyValue2[] dst2 = new MyValue2[8]; - MyValue2?[] dst3 = new MyValue2?[8]; + MyValue2.ref[] dst3 = new MyValue2.ref[8]; MyValue2[] dst4 = new MyValue2[8]; src2[0] = MyValue2.createWithFieldsInline(rI, true); for (int i = 1; i < 8; ++i) { @@ -779,19 +779,19 @@ public void test25_verifier(boolean warmup) { // short arraycopy() with oop fields @Test - public void test26(MyValue1?[] src, MyValue1?[] dst) { + public void test26(MyValue1.ref[] src, MyValue1.ref[] dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test26_verifier(boolean warmup) { - MyValue1?[] src1 = new MyValue1?[8]; - MyValue1?[] src2 = new MyValue1?[8]; + MyValue1.ref[] src1 = new MyValue1.ref[8]; + MyValue1.ref[] src2 = new MyValue1.ref[8]; MyValue1[] src3 = new MyValue1[8]; MyValue1[] src4 = new MyValue1[8]; - MyValue1?[] dst1 = new MyValue1?[8]; + MyValue1.ref[] dst1 = new MyValue1.ref[8]; MyValue1[] dst2 = new MyValue1[8]; - MyValue1?[] dst3 = new MyValue1?[8]; + MyValue1.ref[] dst3 = new MyValue1.ref[8]; MyValue1[] dst4 = new MyValue1[8]; src2[0] = testValue1; for (int i = 1; i < 8 ; ++i) { @@ -818,19 +818,19 @@ public void test26_verifier(boolean warmup) { // short arraycopy() with oop fields and offsets @Test - public void test27(MyValue1?[] src, MyValue1?[] dst) { + public void test27(MyValue1.ref[] src, MyValue1.ref[] dst) { System.arraycopy(src, 1, dst, 2, 6); } @DontCompile public void test27_verifier(boolean warmup) { - MyValue1?[] src1 = new MyValue1?[8]; - MyValue1?[] src2 = new MyValue1?[8]; + MyValue1.ref[] src1 = new MyValue1.ref[8]; + MyValue1.ref[] src2 = new MyValue1.ref[8]; MyValue1[] src3 = new MyValue1[8]; MyValue1[] src4 = new MyValue1[8]; - MyValue1?[] dst1 = new MyValue1?[8]; + MyValue1.ref[] dst1 = new MyValue1.ref[8]; MyValue1[] dst2 = new MyValue1[8]; - MyValue1?[] dst3 = new MyValue1?[8]; + MyValue1.ref[] dst3 = new MyValue1.ref[8]; MyValue1[] dst4 = new MyValue1[8]; for (int i = 1; i < 8; ++i) { src1[i] = testValue1; @@ -860,36 +860,36 @@ public void test27_verifier(boolean warmup) { // TODO ZGC does not support the clone intrinsic, remove this once JDK-8232896 is fixed @Test(valid = ZGCOff, failOn = ALLOC + ALLOCA + LOOP + LOAD + STORE + TRAP) @Test(valid = ZGCOn) - public MyValue2? test28() { - MyValue2?[] src = new MyValue2?[10]; + public MyValue2.ref test28() { + MyValue2.ref[] src = new MyValue2.ref[10]; src[0] = null; - MyValue2?[] dst = (MyValue2?[])src.clone(); + MyValue2.ref[] dst = (MyValue2.ref[])src.clone(); return dst[0]; } @DontCompile public void test28_verifier(boolean warmup) { MyValue2 v = MyValue2.createWithFieldsInline(rI, false); - MyValue2? result = test28(); + MyValue2.ref result = test28(); Asserts.assertEQ(result, null); } // non escaping allocations // TODO 8227588: shouldn't this have the same IR matching rules as test6? @Test(failOn = ALLOCA + LOOP + TRAP) - public MyValue2? test29(MyValue2?[] src) { - MyValue2?[] dst = new MyValue2?[10]; + public MyValue2.ref test29(MyValue2.ref[] src) { + MyValue2.ref[] dst = new MyValue2.ref[10]; System.arraycopy(src, 0, dst, 0, 10); return dst[0]; } @DontCompile public void test29_verifier(boolean warmup) { - MyValue2?[] src = new MyValue2?[10]; + MyValue2.ref[] src = new MyValue2.ref[10]; for (int i = 0; i < 10; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } - MyValue2? v = test29(src); + MyValue2.ref v = test29(src); Asserts.assertEQ(src[0].hash(), v.hash()); } @@ -897,8 +897,8 @@ public void test29_verifier(boolean warmup) { // eliminated value type array element as debug info @Test @Warmup(10000) - public MyValue2? test30(MyValue2?[] src, boolean flag) { - MyValue2?[] dst = new MyValue2?[10]; + public MyValue2.ref test30(MyValue2.ref[] src, boolean flag) { + MyValue2.ref[] dst = new MyValue2.ref[10]; System.arraycopy(src, 0, dst, 0, 10); if (flag) { } return dst[0]; @@ -906,11 +906,11 @@ public MyValue2? test30(MyValue2?[] src, boolean flag) { @DontCompile public void test30_verifier(boolean warmup) { - MyValue2?[] src = new MyValue2?[10]; + MyValue2.ref[] src = new MyValue2.ref[10]; for (int i = 0; i < 10; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } - MyValue2? v = test30(src, !warmup); + MyValue2.ref v = test30(src, !warmup); Asserts.assertEQ(src[0].hash(), v.hash()); } @@ -919,7 +919,7 @@ public void test30_verifier(boolean warmup) { // TODO 8227588 // @Test(failOn = ALLOC + ALLOCA + LOOP + LOAD + STORE + TRAP) public long test31(boolean b, boolean deopt) { - MyValue2?[] src = new MyValue2?[1]; + MyValue2.ref[] src = new MyValue2.ref[1]; if (b) { src[0] = MyValue2.createWithFieldsInline(rI, true); } else { @@ -952,14 +952,14 @@ public Object[] test32(Object[] va) { @DontCompile public void test32_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] va1 = new MyValue1?[len]; + MyValue1.ref[] va1 = new MyValue1.ref[len]; MyValue1[] va2 = new MyValue1[len]; for (int i = 1; i < len; ++i) { va1[i] = testValue1; va2[i] = testValue1; } - MyValue1?[] result1 = (MyValue1?[])test32(va1); - MyValue1?[] result2 = (MyValue1?[])test32(va2); + MyValue1.ref[] result1 = (MyValue1.ref[])test32(va1); + MyValue1.ref[] result2 = (MyValue1.ref[])test32(va2); if (len > 0) { Asserts.assertEQ(result1[0], null); Asserts.assertEQ(result2[0].hash(), MyValue1.default.hash()); @@ -995,7 +995,7 @@ public void test33_verifier(boolean warmup) { public Object[] test34_helper(boolean flag) { Object[] va = null; if (flag) { - va = new MyValue1?[8]; + va = new MyValue1.ref[8]; for (int i = 0; i < va.length; ++i) { va[i] = MyValue1.createWithFieldsDontInline(rI, rL); } @@ -1035,7 +1035,7 @@ static void verify(Object[] src, Object[] dst) { } } - static void verify(MyValue1?[] src, MyValue1?[] dst) { + static void verify(MyValue1.ref[] src, MyValue1.ref[] dst) { for (int i = 0; i < src.length; ++i) { if (src[i] != null) { Asserts.assertEQ(src[i].hash(), dst[i].hash()); @@ -1045,7 +1045,7 @@ static void verify(MyValue1?[] src, MyValue1?[] dst) { } } - static void verify(MyValue1?[] src, Object[] dst) { + static void verify(MyValue1.ref[] src, Object[] dst) { for (int i = 0; i < src.length; ++i) { if (src[i] != null) { Asserts.assertEQ(src[i].hash(), ((MyInterface)dst[i]).hash()); @@ -1055,7 +1055,7 @@ static void verify(MyValue1?[] src, Object[] dst) { } } - static void verify(MyValue2?[] src, MyValue2?[] dst) { + static void verify(MyValue2.ref[] src, MyValue2.ref[] dst) { for (int i = 0; i < src.length; ++i) { if (src[i] != null) { Asserts.assertEQ(src[i].hash(), dst[i].hash()); @@ -1065,7 +1065,7 @@ static void verify(MyValue2?[] src, MyValue2?[] dst) { } } - static void verify(MyValue2?[] src, Object[] dst) { + static void verify(MyValue2.ref[] src, Object[] dst) { for (int i = 0; i < src.length; ++i) { if (src[i] != null) { Asserts.assertEQ(src[i].hash(), ((MyInterface)dst[i]).hash()); @@ -1098,8 +1098,8 @@ public void test35(Object src, Object dst, int len) { @DontCompile public void test35_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] src = new MyValue1?[len]; - MyValue1?[] dst = new MyValue1?[len]; + MyValue1.ref[] src = new MyValue1.ref[len]; + MyValue1.ref[] dst = new MyValue1.ref[len]; for (int i = 1; i < len; ++i) { src[i] = testValue1; } @@ -1112,15 +1112,15 @@ public void test35_verifier(boolean warmup) { } @Test - public void test36(Object src, MyValue2?[] dst) { + public void test36(Object src, MyValue2.ref[] dst) { System.arraycopy(src, 0, dst, 0, dst.length); } @DontCompile public void test36_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue2?[] src = new MyValue2?[len]; - MyValue2?[] dst = new MyValue2?[len]; + MyValue2.ref[] src = new MyValue2.ref[len]; + MyValue2.ref[] dst = new MyValue2.ref[len]; for (int i = 1; i < len; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } @@ -1133,15 +1133,15 @@ public void test36_verifier(boolean warmup) { } @Test - public void test37(MyValue2?[] src, Object dst) { + public void test37(MyValue2.ref[] src, Object dst) { System.arraycopy(src, 0, dst, 0, src.length); } @DontCompile public void test37_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue2?[] src = new MyValue2?[len]; - MyValue2?[] dst = new MyValue2?[len]; + MyValue2.ref[] src = new MyValue2.ref[len]; + MyValue2.ref[] dst = new MyValue2.ref[len]; for (int i = 1; i < len; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } @@ -1155,7 +1155,7 @@ public void test37_verifier(boolean warmup) { @Test @Warmup(1) // Avoid early compilation - public void test38(Object src, MyValue2?[] dst) { + public void test38(Object src, MyValue2.ref[] dst) { System.arraycopy(src, 0, dst, 0, dst.length); } @@ -1163,7 +1163,7 @@ public void test38(Object src, MyValue2?[] dst) { public void test38_verifier(boolean warmup) { int len = Math.abs(rI) % 10; Object[] src = new Object[len]; - MyValue2?[] dst = new MyValue2?[len]; + MyValue2.ref[] dst = new MyValue2.ref[len]; for (int i = 1; i < len; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } @@ -1182,14 +1182,14 @@ public void test38_verifier(boolean warmup) { } @Test - public void test39(MyValue2?[] src, Object dst) { + public void test39(MyValue2.ref[] src, Object dst) { System.arraycopy(src, 0, dst, 0, src.length); } @DontCompile public void test39_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue2?[] src = new MyValue2?[len]; + MyValue2.ref[] src = new MyValue2.ref[len]; Object[] dst = new Object[len]; for (int i = 1; i < len; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); @@ -1212,7 +1212,7 @@ public void test40(Object[] src, Object dst) { public void test40_verifier(boolean warmup) { int len = Math.abs(rI) % 10; Object[] src = new Object[len]; - MyValue2?[] dst = new MyValue2?[len]; + MyValue2.ref[] dst = new MyValue2.ref[len]; for (int i = 1; i < len; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } @@ -1238,7 +1238,7 @@ public void test41(Object src, Object[] dst) { @DontCompile public void test41_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue2?[] src = new MyValue2?[len]; + MyValue2.ref[] src = new MyValue2.ref[len]; Object[] dst = new Object[len]; for (int i = 1; i < len; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); @@ -1282,8 +1282,8 @@ public void test43(Object src, Object dst) { @DontCompile public void test43_verifier(boolean warmup) { - MyValue1?[] src = new MyValue1?[8]; - MyValue1?[] dst = new MyValue1?[8]; + MyValue1.ref[] src = new MyValue1.ref[8]; + MyValue1.ref[] dst = new MyValue1.ref[8]; for (int i = 1; i < 8; ++i) { src[i] = testValue1; } @@ -1296,14 +1296,14 @@ public void test43_verifier(boolean warmup) { } @Test - public void test44(Object src, MyValue2?[] dst) { + public void test44(Object src, MyValue2.ref[] dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test44_verifier(boolean warmup) { - MyValue2?[] src = new MyValue2?[8]; - MyValue2?[] dst = new MyValue2?[8]; + MyValue2.ref[] src = new MyValue2.ref[8]; + MyValue2.ref[] dst = new MyValue2.ref[8]; for (int i = 1; i < 8; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } @@ -1316,14 +1316,14 @@ public void test44_verifier(boolean warmup) { } @Test - public void test45(MyValue2?[] src, Object dst) { + public void test45(MyValue2.ref[] src, Object dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test45_verifier(boolean warmup) { - MyValue2?[] src = new MyValue2?[8]; - MyValue2?[] dst = new MyValue2?[8]; + MyValue2.ref[] src = new MyValue2.ref[8]; + MyValue2.ref[] dst = new MyValue2.ref[8]; for (int i = 1; i < 8; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } @@ -1337,14 +1337,14 @@ public void test45_verifier(boolean warmup) { @Test @Warmup(1) // Avoid early compilation - public void test46(Object[] src, MyValue2?[] dst) { + public void test46(Object[] src, MyValue2.ref[] dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test46_verifier(boolean warmup) { Object[] src = new Object[8]; - MyValue2?[] dst = new MyValue2?[8]; + MyValue2.ref[] dst = new MyValue2.ref[8]; for (int i = 1; i < 8; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } @@ -1363,13 +1363,13 @@ public void test46_verifier(boolean warmup) { } @Test - public void test47(MyValue2?[] src, Object[] dst) { + public void test47(MyValue2.ref[] src, Object[] dst) { System.arraycopy(src, 0, dst, 0, 8); } @DontCompile public void test47_verifier(boolean warmup) { - MyValue2?[] src = new MyValue2?[8]; + MyValue2.ref[] src = new MyValue2.ref[8]; Object[] dst = new Object[8]; for (int i = 1; i < 8; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); @@ -1391,7 +1391,7 @@ public void test48(Object[] src, Object dst) { @DontCompile public void test48_verifier(boolean warmup) { Object[] src = new Object[8]; - MyValue2?[] dst = new MyValue2?[8]; + MyValue2.ref[] dst = new MyValue2.ref[8]; for (int i = 1; i < 8; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); } @@ -1416,7 +1416,7 @@ public void test49(Object src, Object[] dst) { @DontCompile public void test49_verifier(boolean warmup) { - MyValue2?[] src = new MyValue2?[8]; + MyValue2.ref[] src = new MyValue2.ref[8]; Object[] dst = new Object[8]; for (int i = 1; i < 8; ++i) { src[i] = MyValue2.createWithFieldsInline(rI, (i % 2) == 0); @@ -1452,26 +1452,26 @@ public void test50_verifier(boolean warmup) { } @Test - public MyValue1?[] test51(MyValue1?[] va) { - return Arrays.copyOf(va, va.length, MyValue1?[].class); + public MyValue1.ref[] test51(MyValue1.ref[] va) { + return Arrays.copyOf(va, va.length, MyValue1.ref[].class); } @DontCompile public void test51_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[len]; + MyValue1.ref[] va = new MyValue1.ref[len]; for (int i = 1; i < len; ++i) { va[i] = testValue1; } - MyValue1?[] result = test51(va); + MyValue1.ref[] result = test51(va); verify(va, result); } - static final MyValue1?[] test52_va = new MyValue1?[8]; + static final MyValue1.ref[] test52_va = new MyValue1.ref[8]; @Test - public MyValue1?[] test52() { - return Arrays.copyOf(test52_va, 8, MyValue1?[].class); + public MyValue1.ref[] test52() { + return Arrays.copyOf(test52_va, 8, MyValue1.ref[].class); } @DontCompile @@ -1479,35 +1479,35 @@ public void test52_verifier(boolean warmup) { for (int i = 1; i < 8; ++i) { test52_va[i] = testValue1; } - MyValue1?[] result = test52(); + MyValue1.ref[] result = test52(); verify(test52_va, result); } @Test - public MyValue1?[] test53(Object[] va) { - return Arrays.copyOf(va, va.length, MyValue1?[].class); + public MyValue1.ref[] test53(Object[] va) { + return Arrays.copyOf(va, va.length, MyValue1.ref[].class); } @DontCompile public void test53_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[len]; + MyValue1.ref[] va = new MyValue1.ref[len]; for (int i = 1; i < len; ++i) { va[i] = testValue1; } - MyValue1?[] result = test53(va); + MyValue1.ref[] result = test53(va); verify(result, va); } @Test - public Object[] test54(MyValue1?[] va) { + public Object[] test54(MyValue1.ref[] va) { return Arrays.copyOf(va, va.length, Object[].class); } @DontCompile public void test54_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[len]; + MyValue1.ref[] va = new MyValue1.ref[len]; for (int i = 1; i < len; ++i) { va[i] = testValue1; } @@ -1523,7 +1523,7 @@ public Object[] test55(Object[] va) { @DontCompile public void test55_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[len]; + MyValue1.ref[] va = new MyValue1.ref[len]; for (int i = 1; i < len; ++i) { va[i] = testValue1; } @@ -1532,8 +1532,8 @@ public void test55_verifier(boolean warmup) { } @Test - public MyValue1?[] test56(Object[] va) { - return Arrays.copyOf(va, va.length, MyValue1?[].class); + public MyValue1.ref[] test56(Object[] va) { + return Arrays.copyOf(va, va.length, MyValue1.ref[].class); } @DontCompile @@ -1543,7 +1543,7 @@ public void test56_verifier(boolean warmup) { for (int i = 1; i < len; ++i) { va[i] = testValue1; } - MyValue1?[] result = test56(va); + MyValue1.ref[] result = test56(va); verify(result, va); } @@ -1555,46 +1555,46 @@ public Object[] test57(Object[] va, Class klass) { @DontCompile public void test57_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - Object[] va = new MyValue1?[len]; + Object[] va = new MyValue1.ref[len]; for (int i = 1; i < len; ++i) { va[i] = testValue1; } - Object[] result = test57(va, MyValue1?[].class); + Object[] result = test57(va, MyValue1.ref[].class); verify(va, result); } @Test - public Object[] test58(MyValue1?[] va, Class klass) { + public Object[] test58(MyValue1.ref[] va, Class klass) { return Arrays.copyOf(va, va.length, klass); } @DontCompile public void test58_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[len]; + MyValue1.ref[] va = new MyValue1.ref[len]; for (int i = 1; i < len; ++i) { va[i] = testValue1; } for (int i = 1; i < 10; i++) { - Object[] result = test58(va, MyValue1?[].class); + Object[] result = test58(va, MyValue1.ref[].class); verify(va, result); } if (compile_and_run_again_if_deoptimized(warmup, "TestNullableArrays::test58")) { - Object[] result = test58(va, MyValue1?[].class); + Object[] result = test58(va, MyValue1.ref[].class); verify(va, result); } } @Test - public Object[] test59(MyValue1?[] va) { - return Arrays.copyOf(va, va.length+1, MyValue1?[].class); + public Object[] test59(MyValue1.ref[] va) { + return Arrays.copyOf(va, va.length+1, MyValue1.ref[].class); } @DontCompile public void test59_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[len]; - MyValue1?[] verif = new MyValue1?[len+1]; + MyValue1.ref[] va = new MyValue1.ref[len]; + MyValue1.ref[] verif = new MyValue1.ref[len+1]; for (int i = 1; i < len; ++i) { va[i] = testValue1; verif[i] = va[i]; @@ -1611,13 +1611,13 @@ public Object[] test60(Object[] va, Class klass) { @DontCompile public void test60_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[len]; - MyValue1?[] verif = new MyValue1?[len+1]; + MyValue1.ref[] va = new MyValue1.ref[len]; + MyValue1.ref[] verif = new MyValue1.ref[len+1]; for (int i = 1; i < len; ++i) { va[i] = testValue1; verif[i] = (MyValue1)va[i]; } - Object[] result = test60(va, MyValue1?[].class); + Object[] result = test60(va, MyValue1.ref[].class); verify(verif, result); } @@ -1640,7 +1640,7 @@ public void test61_verifier(boolean warmup) { } @ForceInline - public Object[] test62_helper(int i, MyValue1?[] va, Integer[] oa) { + public Object[] test62_helper(int i, MyValue1.ref[] va, Integer[] oa) { Object[] arr = null; if (i == 10) { arr = oa; @@ -1651,7 +1651,7 @@ public Object[] test62_helper(int i, MyValue1?[] va, Integer[] oa) { } @Test - public Object[] test62(MyValue1?[] va, Integer[] oa) { + public Object[] test62(MyValue1.ref[] va, Integer[] oa) { int i = 0; for (; i < 10; i++); @@ -1663,7 +1663,7 @@ public Object[] test62(MyValue1?[] va, Integer[] oa) { @DontCompile public void test62_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[len]; + MyValue1.ref[] va = new MyValue1.ref[len]; Integer[] oa = new Integer[len]; for (int i = 1; i < len; ++i) { oa[i] = new Integer(rI); @@ -1676,7 +1676,7 @@ public void test62_verifier(boolean warmup) { } @ForceInline - public Object[] test63_helper(int i, MyValue1?[] va, Integer[] oa) { + public Object[] test63_helper(int i, MyValue1.ref[] va, Integer[] oa) { Object[] arr = null; if (i == 10) { arr = va; @@ -1687,7 +1687,7 @@ public Object[] test63_helper(int i, MyValue1?[] va, Integer[] oa) { } @Test - public Object[] test63(MyValue1?[] va, Integer[] oa) { + public Object[] test63(MyValue1.ref[] va, Integer[] oa) { int i = 0; for (; i < 10; i++); @@ -1699,8 +1699,8 @@ public Object[] test63(MyValue1?[] va, Integer[] oa) { @DontCompile public void test63_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[len]; - MyValue1?[] verif = new MyValue1?[len+1]; + MyValue1.ref[] va = new MyValue1.ref[len]; + MyValue1.ref[] verif = new MyValue1.ref[len+1]; for (int i = 1; i < len; ++i) { va[i] = testValue1; verif[i] = va[i]; @@ -1713,13 +1713,13 @@ public void test63_verifier(boolean warmup) { // Test default initialization of value type arrays: small array @Test - public MyValue1?[] test64() { - return new MyValue1?[8]; + public MyValue1.ref[] test64() { + return new MyValue1.ref[8]; } @DontCompile public void test64_verifier(boolean warmup) { - MyValue1?[] va = test64(); + MyValue1.ref[] va = test64(); for (int i = 0; i < 8; ++i) { Asserts.assertEQ(va[i], null); } @@ -1727,13 +1727,13 @@ public void test64_verifier(boolean warmup) { // Test default initialization of value type arrays: large array @Test - public MyValue1?[] test65() { - return new MyValue1?[32]; + public MyValue1.ref[] test65() { + return new MyValue1.ref[32]; } @DontCompile public void test65_verifier(boolean warmup) { - MyValue1?[] va = test65(); + MyValue1.ref[] va = test65(); for (int i = 0; i < 32; ++i) { Asserts.assertEQ(va[i], null); } @@ -1741,31 +1741,31 @@ public void test65_verifier(boolean warmup) { // Check init store elimination @Test(match = { ALLOCA }, matchCount = { 1 }) - public MyValue1?[] test66(MyValue1? vt) { - MyValue1?[] va = new MyValue1?[1]; + public MyValue1.ref[] test66(MyValue1.ref vt) { + MyValue1.ref[] va = new MyValue1.ref[1]; va[0] = vt; return va; } @DontCompile public void test66_verifier(boolean warmup) { - MyValue1? vt = MyValue1.createWithFieldsDontInline(rI, rL); - MyValue1?[] va = test66(vt); + MyValue1.ref vt = MyValue1.createWithFieldsDontInline(rI, rL); + MyValue1.ref[] va = test66(vt); Asserts.assertEQ(va[0].hashPrimitive(), vt.hashPrimitive()); } // Zeroing elimination and arraycopy @Test - public MyValue1?[] test67(MyValue1?[] src) { - MyValue1?[] dst = new MyValue1?[16]; + public MyValue1.ref[] test67(MyValue1.ref[] src) { + MyValue1.ref[] dst = new MyValue1.ref[16]; System.arraycopy(src, 0, dst, 0, 13); return dst; } @DontCompile public void test67_verifier(boolean warmup) { - MyValue1?[] va = new MyValue1?[16]; - MyValue1?[] var = test67(va); + MyValue1.ref[] va = new MyValue1.ref[16]; + MyValue1.ref[] var = test67(va); for (int i = 0; i < 16; ++i) { Asserts.assertEQ(var[i], null); } @@ -1773,15 +1773,15 @@ public void test67_verifier(boolean warmup) { // A store with a default value can be eliminated @Test - public MyValue1?[] test68() { - MyValue1?[] va = new MyValue1?[2]; + public MyValue1.ref[] test68() { + MyValue1.ref[] va = new MyValue1.ref[2]; va[0] = va[1]; return va; } @DontCompile public void test68_verifier(boolean warmup) { - MyValue1?[] va = test68(); + MyValue1.ref[] va = test68(); for (int i = 0; i < 2; ++i) { Asserts.assertEQ(va[i], null); } @@ -1789,8 +1789,8 @@ public void test68_verifier(boolean warmup) { // Requires individual stores to init array @Test - public MyValue1?[] test69(MyValue1? vt) { - MyValue1?[] va = new MyValue1?[4]; + public MyValue1.ref[] test69(MyValue1.ref vt) { + MyValue1.ref[] va = new MyValue1.ref[4]; va[0] = vt; va[3] = vt; return va; @@ -1798,11 +1798,11 @@ public MyValue1?[] test69(MyValue1? vt) { @DontCompile public void test69_verifier(boolean warmup) { - MyValue1? vt = MyValue1.createWithFieldsDontInline(rI, rL); - MyValue1?[] va = new MyValue1?[4]; + MyValue1.ref vt = MyValue1.createWithFieldsDontInline(rI, rL); + MyValue1.ref[] va = new MyValue1.ref[4]; va[0] = vt; va[3] = vt; - MyValue1?[] var = test69(vt); + MyValue1.ref[] var = test69(vt); for (int i = 0; i < va.length; ++i) { Asserts.assertEQ(va[i], var[i]); } @@ -1811,9 +1811,9 @@ public void test69_verifier(boolean warmup) { // A store with a default value can be eliminated: same as test68 // but store is farther away from allocation @Test - public MyValue1?[] test70(MyValue1?[] other) { + public MyValue1.ref[] test70(MyValue1.ref[] other) { other[1] = other[0]; - MyValue1?[] va = new MyValue1?[2]; + MyValue1.ref[] va = new MyValue1.ref[2]; other[0] = va[1]; va[0] = va[1]; return va; @@ -1821,8 +1821,8 @@ public MyValue1?[] test70(MyValue1?[] other) { @DontCompile public void test70_verifier(boolean warmup) { - MyValue1?[] va = new MyValue1?[2]; - MyValue1?[] var = test70(va); + MyValue1.ref[] va = new MyValue1.ref[2]; + MyValue1.ref[] var = test70(va); for (int i = 0; i < 2; ++i) { Asserts.assertEQ(va[i], var[i]); } @@ -1832,8 +1832,8 @@ public void test70_verifier(boolean warmup) { @Test public void test71() { int len = 10; - MyValue2?[] src = new MyValue2?[len]; - MyValue2?[] dst = new MyValue2?[len]; + MyValue2.ref[] src = new MyValue2.ref[len]; + MyValue2.ref[] dst = new MyValue2.ref[len]; for (int i = 1; i < len; ++i) { src[i] = MyValue2.createWithFieldsDontInline(rI, (i % 2) == 0); } @@ -1873,7 +1873,7 @@ public void test72_verifier(boolean warmup) { } @Test - public void test73(Object[] oa, MyValue1? v, Object o) { + public void test73(Object[] oa, MyValue1.ref v, Object o) { // TestLWorld.test38 use a C1 Phi node for the array. This test // adds the case where the stored value is a C1 Phi node. Object o2 = (o == null) ? v : o; @@ -1885,9 +1885,9 @@ public void test73(Object[] oa, MyValue1? v, Object o) { @DontCompile public void test73_verifier(boolean warmup) { - MyValue1? v0 = MyValue1.createWithFieldsDontInline(rI, rL); - MyValue1? v1 = MyValue1.createWithFieldsDontInline(rI+1, rL+1); - MyValue1?[] arr = new MyValue1?[3]; + MyValue1.ref v0 = MyValue1.createWithFieldsDontInline(rI, rL); + MyValue1.ref v1 = MyValue1.createWithFieldsDontInline(rI+1, rL+1); + MyValue1.ref[] arr = new MyValue1.ref[3]; try { test73(arr, v0, v1); throw new RuntimeException("ArrayStoreException expected"); @@ -1901,7 +1901,7 @@ public void test73_verifier(boolean warmup) { // Some more array clone tests @ForceInline - public Object[] test74_helper(int i, MyValue1?[] va, Integer[] oa) { + public Object[] test74_helper(int i, MyValue1.ref[] va, Integer[] oa) { Object[] arr = null; if (i == 10) { arr = oa; @@ -1912,7 +1912,7 @@ public Object[] test74_helper(int i, MyValue1?[] va, Integer[] oa) { } @Test - public Object[] test74(MyValue1?[] va, Integer[] oa) { + public Object[] test74(MyValue1.ref[] va, Integer[] oa) { int i = 0; for (; i < 10; i++); @@ -1923,7 +1923,7 @@ public Object[] test74(MyValue1?[] va, Integer[] oa) { @DontCompile public void test74_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[len]; + MyValue1.ref[] va = new MyValue1.ref[len]; Integer[] oa = new Integer[len]; for (int i = 1; i < len; ++i) { oa[i] = new Integer(rI); @@ -1939,7 +1939,7 @@ public void test74_verifier(boolean warmup) { } @ForceInline - public Object[] test75_helper(int i, MyValue1?[] va, Integer[] oa) { + public Object[] test75_helper(int i, MyValue1.ref[] va, Integer[] oa) { Object[] arr = null; if (i == 10) { arr = va; @@ -1950,7 +1950,7 @@ public Object[] test75_helper(int i, MyValue1?[] va, Integer[] oa) { } @Test - public Object[] test75(MyValue1?[] va, Integer[] oa) { + public Object[] test75(MyValue1.ref[] va, Integer[] oa) { int i = 0; for (; i < 10; i++); @@ -1961,8 +1961,8 @@ public Object[] test75(MyValue1?[] va, Integer[] oa) { @DontCompile public void test75_verifier(boolean warmup) { int len = Math.abs(rI) % 10; - MyValue1?[] va = new MyValue1?[len]; - MyValue1?[] verif = new MyValue1?[len]; + MyValue1.ref[] va = new MyValue1.ref[len]; + MyValue1.ref[] verif = new MyValue1.ref[len]; for (int i = 1; i < len; ++i) { va[i] = testValue1; verif[i] = va[i]; @@ -1979,7 +1979,7 @@ public void test75_verifier(boolean warmup) { // Test mixing nullable and non-nullable arrays @Test - public Object[] test76(MyValue1[] vva, MyValue1?[] vba, MyValue1 vt, Object[] out, int n) { + public Object[] test76(MyValue1[] vva, MyValue1.ref[] vba, MyValue1 vt, Object[] out, int n) { Object[] result = null; if (n == 0) { result = vva; @@ -1988,7 +1988,7 @@ public Object[] test76(MyValue1[] vva, MyValue1?[] vba, MyValue1 vt, Object[] ou } else if (n == 2) { result = new MyValue1[42]; } else if (n == 3) { - result = new MyValue1?[42]; + result = new MyValue1.ref[42]; } result[0] = vt; out[0] = result[1]; @@ -2002,8 +2002,8 @@ public void test76_verifier(boolean warmup) { MyValue1[] vva = new MyValue1[42]; MyValue1[] vva_r = new MyValue1[42]; vva_r[0] = vt; - MyValue1?[] vba = new MyValue1?[42]; - MyValue1?[] vba_r = new MyValue1?[42]; + MyValue1.ref[] vba = new MyValue1.ref[42]; + MyValue1.ref[] vba_r = new MyValue1.ref[42]; vba_r[0] = vt; Object[] result = test76(vva, vba, vt, out, 0); verify(result, vva_r); @@ -2023,7 +2023,7 @@ public void test76_verifier(boolean warmup) { public Object[] test77(boolean b) { Object[] va; if (b) { - va = new MyValue1?[5]; + va = new MyValue1.ref[5]; for (int i = 0; i < 5; ++i) { va[i] = testValue1; } @@ -2060,7 +2060,7 @@ public void test77_verifier(boolean warmup) { // Same as test76 but with non value type array cases @Test - public Object[] test78(MyValue1[] vva, MyValue1?[] vba, Object val, Object[] out, int n) { + public Object[] test78(MyValue1[] vva, MyValue1.ref[] vba, Object val, Object[] out, int n) { Object[] result = null; if (n == 0) { result = vva; @@ -2069,7 +2069,7 @@ public Object[] test78(MyValue1[] vva, MyValue1?[] vba, Object val, Object[] out } else if (n == 2) { result = new MyValue1[42]; } else if (n == 3) { - result = new MyValue1?[42]; + result = new MyValue1.ref[42]; } else if (n == 4) { result = new Integer[42]; } @@ -2086,8 +2086,8 @@ public void test78_verifier(boolean warmup) { MyValue1[] vva = new MyValue1[42]; MyValue1[] vva_r = new MyValue1[42]; vva_r[0] = vt; - MyValue1?[] vba = new MyValue1?[42]; - MyValue1?[] vba_r = new MyValue1?[42]; + MyValue1.ref[] vba = new MyValue1.ref[42]; + MyValue1.ref[] vba_r = new MyValue1.ref[42]; vba_r[0] = vt; Object[] result = test78(vva, vba, vt, out, 0); verify(result, vva_r); @@ -2108,7 +2108,7 @@ public void test78_verifier(boolean warmup) { // Test widening conversions from [Q to [L @Test(failOn = ALLOC + ALLOCA + LOOP + LOAD + STORE + TRAP) - public static MyValue1?[] test79(MyValue1[] va) { + public static MyValue1.ref[] test79(MyValue1[] va) { return va; } @@ -2116,7 +2116,7 @@ public static MyValue1?[] test79(MyValue1[] va) { public void test79_verifier(boolean warmup) { MyValue1[] va = new MyValue1[1]; va[0] = testValue1; - MyValue1?[] res = test79(va); + MyValue1.ref[] res = test79(va); Asserts.assertEquals(res[0].hash(), testValue1.hash()); try { res[0] = null; @@ -2131,7 +2131,7 @@ public void test79_verifier(boolean warmup) { // Same as test79 but with explicit cast and Object return @Test(failOn = ALLOC + ALLOCA + LOOP + LOAD + STORE + TRAP) public static Object[] test80(MyValue1[] va) { - return (MyValue1?[])va; + return (MyValue1.ref[])va; } @DontCompile @@ -2152,8 +2152,8 @@ public void test80_verifier(boolean warmup) { // Test mixing widened and boxed array type @Test() - public static long test81(MyValue1[] va1, MyValue1?[] va2, MyValue1 vt, boolean b, boolean shouldThrow) { - MyValue1?[] result = b ? va1 : va2; + public static long test81(MyValue1[] va1, MyValue1.ref[] va2, MyValue1 vt, boolean b, boolean shouldThrow) { + MyValue1.ref[] result = b ? va1 : va2; try { result[0] = vt; } catch (NullPointerException npe) { @@ -2165,7 +2165,7 @@ public static long test81(MyValue1[] va1, MyValue1?[] va2, MyValue1 vt, boolean @DontCompile public void test81_verifier(boolean warmup) { MyValue1[] va = new MyValue1[2]; - MyValue1?[] vaB = new MyValue1?[2]; + MyValue1.ref[] vaB = new MyValue1.ref[2]; va[1] = testValue1; vaB[1] = testValue1; long res = test81(va, vaB, testValue1, true, true); @@ -2181,14 +2181,14 @@ public void test81_verifier(boolean warmup) { // Same as test81 but more cases and null writes @Test() - public static long test82(MyValue1[] va1, MyValue1?[] va2, MyValue1 vt1, MyValue1? vt2, int i, boolean shouldThrow) { - MyValue1?[] result = null; + public static long test82(MyValue1[] va1, MyValue1.ref[] va2, MyValue1 vt1, MyValue1.ref vt2, int i, boolean shouldThrow) { + MyValue1.ref[] result = null; if (i == 0) { result = va1; } else if (i == 1) { result = va2; } else if (i == 2) { - result = new MyValue1?[2]; + result = new MyValue1.ref[2]; result[1] = vt1; } else if (i == 3) { result = new MyValue1[2]; @@ -2209,7 +2209,7 @@ public static long test82(MyValue1[] va1, MyValue1?[] va2, MyValue1 vt1, MyValue @DontCompile public void test82_verifier(boolean warmup) { MyValue1[] va = new MyValue1[2]; - MyValue1?[] vaB = new MyValue1?[2]; + MyValue1.ref[] vaB = new MyValue1.ref[2]; va[1] = testValue1; vaB[1] = testValue1; long res = test82(va, vaB, testValue1, testValue1, 0, true); @@ -2231,7 +2231,7 @@ public void test82_verifier(boolean warmup) { @Test(failOn = ALLOC + ALLOCA + STORE) public static long test83(MyValue1[] va) { - MyValue1?[] result = va; + MyValue1.ref[] result = va; return result[0].hash(); } @@ -2245,8 +2245,8 @@ public void test83_verifier(boolean warmup) { @Test(valid = ValueTypeArrayFlattenOn, failOn = ALLOC + LOOP + STORE + TRAP) @Test(valid = ValueTypeArrayFlattenOff) - public static MyValue1?[] test84(MyValue1 vt1, MyValue1? vt2) { - MyValue1?[] result = new MyValue1[2]; + public static MyValue1.ref[] test84(MyValue1 vt1, MyValue1.ref vt2) { + MyValue1.ref[] result = new MyValue1[2]; result[0] = vt1; result[1] = vt2; return result; @@ -2254,7 +2254,7 @@ public static MyValue1?[] test84(MyValue1 vt1, MyValue1? vt2) { @DontCompile public void test84_verifier(boolean warmup) { - MyValue1?[] res = test84(testValue1, testValue1); + MyValue1.ref[] res = test84(testValue1, testValue1); Asserts.assertEquals(res[0].hash(), testValue1.hash()); Asserts.assertEquals(res[1].hash(), testValue1.hash()); try { @@ -2266,7 +2266,7 @@ public void test84_verifier(boolean warmup) { } @Test() - public static long test85(MyValue1?[] va, MyValue1 val) { + public static long test85(MyValue1.ref[] va, MyValue1 val) { va[0] = val; return va[1].hash(); } @@ -2274,7 +2274,7 @@ public static long test85(MyValue1?[] va, MyValue1 val) { @DontCompile public void test85_verifier(boolean warmup) { MyValue1[] va = new MyValue1[2]; - MyValue1?[] vab = new MyValue1?[2]; + MyValue1.ref[] vab = new MyValue1.ref[2]; va[1] = testValue1; vab[1] = testValue1; long res = test85(va, testValue1); @@ -2287,7 +2287,7 @@ public void test85_verifier(boolean warmup) { // Same as test85 but with box value @Test() - public static long test86(MyValue1?[] va, MyValue1? val) { + public static long test86(MyValue1.ref[] va, MyValue1.ref val) { va[0] = val; return va[1].hash(); } @@ -2295,7 +2295,7 @@ public static long test86(MyValue1?[] va, MyValue1? val) { @DontCompile public void test86_verifier(boolean warmup) { MyValue1[] va = new MyValue1[2]; - MyValue1?[] vab = new MyValue1?[2]; + MyValue1.ref[] vab = new MyValue1.ref[2]; va[1] = testValue1; vab[1] = testValue1; long res = test86(va, testValue1); @@ -2318,7 +2318,7 @@ public void test86_verifier(boolean warmup) { // Test initialization of nullable array with constant @Test() public long test87() { - MyValue1?[] va = new MyValue1?[1]; + MyValue1.ref[] va = new MyValue1.ref[1]; va[0] = testValue1; return va[0].hash(); } @@ -2331,7 +2331,7 @@ public void test87_verifier(boolean warmup) { // Test narrowing conversion from [L to [Q @Test(failOn = ALLOC + ALLOCA + LOOP + LOAD + STORE + TRAP) - public static MyValue1[] test88(MyValue1?[] va) { + public static MyValue1[] test88(MyValue1.ref[] va) { return (MyValue1[])va; } @@ -2344,7 +2344,7 @@ public void test88_verifier(boolean warmup) { res[0] = testValue1; test88(null); // Should not throw NPE try { - test88(new MyValue1?[1]); + test88(new MyValue1.ref[1]); throw new RuntimeException("ClassCastException expected"); } catch (ClassCastException cce) { // Expected @@ -2366,7 +2366,7 @@ public void test89_verifier(boolean warmup) { res[0] = testValue1; test89(null); // Should not throw NPE try { - test89(new MyValue1?[1]); + test89(new MyValue1.ref[1]); throw new RuntimeException("ClassCastException expected"); } catch (ClassCastException cce) { // Expected @@ -2375,14 +2375,14 @@ public void test89_verifier(boolean warmup) { // More cast tests @Test() - public static MyValue1?[] test90(Object va) { - return (MyValue1?[])va; + public static MyValue1.ref[] test90(Object va) { + return (MyValue1.ref[])va; } @DontCompile public void test90_verifier(boolean warmup) { MyValue1[] va = new MyValue1[1]; - MyValue1?[] vab = new MyValue1?[1]; + MyValue1.ref[] vab = new MyValue1.ref[1]; try { // Trigger some ClassCastExceptions so C2 does not add an uncommon trap test90(new Integer[0]); @@ -2395,14 +2395,14 @@ public void test90_verifier(boolean warmup) { } @Test() - public static MyValue1?[] test91(Object[] va) { - return (MyValue1?[])va; + public static MyValue1.ref[] test91(Object[] va) { + return (MyValue1.ref[])va; } @DontCompile public void test91_verifier(boolean warmup) { MyValue1[] va = new MyValue1[1]; - MyValue1?[] vab = new MyValue1?[1]; + MyValue1.ref[] vab = new MyValue1.ref[1]; try { // Trigger some ClassCastExceptions so C2 does not add an uncommon trap test91(new Integer[0]); @@ -2416,14 +2416,14 @@ public void test91_verifier(boolean warmup) { // Test if arraycopy intrinsic correctly checks for flattened source array @Test() - public static void test92(MyValue1?[] src, MyValue1?[] dst) { + public static void test92(MyValue1.ref[] src, MyValue1.ref[] dst) { System.arraycopy(src, 0, dst, 0, 2); } @DontCompile public void test92_verifier(boolean warmup) { MyValue1[] va = new MyValue1[2]; - MyValue1?[] vab = new MyValue1?[2]; + MyValue1.ref[] vab = new MyValue1.ref[2]; va[0] = testValue1; vab[0] = testValue1; test92(va, vab); @@ -2432,14 +2432,14 @@ public void test92_verifier(boolean warmup) { } @Test() - public static void test93(Object src, MyValue1?[] dst) { + public static void test93(Object src, MyValue1.ref[] dst) { System.arraycopy(src, 0, dst, 0, 2); } @DontCompile public void test93_verifier(boolean warmup) { MyValue1[] va = new MyValue1[2]; - MyValue1?[] vab = new MyValue1?[2]; + MyValue1.ref[] vab = new MyValue1.ref[2]; va[0] = testValue1; vab[0] = testValue1; test93(va, vab); @@ -2451,7 +2451,7 @@ public void test93_verifier(boolean warmup) { // that does not modify loaded array element. @Test() public static long test94() { - MyValue1?[] src = new MyValue1?[8]; + MyValue1.ref[] src = new MyValue1.ref[8]; MyValue1[] dst = new MyValue1[8]; for (int i = 1; i < 8; ++i) { src[i] = testValue1; @@ -2469,7 +2469,7 @@ public static void test94_verifier(boolean warmup) { // Test meeting constant TypeInstPtr with ValueTypeNode @ForceInline public long test95_callee() { - MyValue1?[] va = new MyValue1?[1]; + MyValue1.ref[] va = new MyValue1.ref[1]; va[0] = testValue1; return va[0].hashInterpreted(); } @@ -2507,12 +2507,12 @@ public Complex mul(Complex that) { } @Test() - public Complex?[][] test96(Complex?[][] A, Complex?[][] B) { + public Complex.ref[][] test96(Complex.ref[][] A, Complex.ref[][] B) { int size = A.length; - Complex?[][] R = new Complex?[size][size]; + Complex.ref[][] R = new Complex.ref[size][size]; for (int i = 0; i < size; i++) { for (int k = 0; k < size; k++) { - Complex? aik = A[i][k]; + Complex.ref aik = A[i][k]; for (int j = 0; j < size; j++) { R[i][j] = B[i][j].add(aik.mul((Complex)B[k][j])); } @@ -2521,9 +2521,9 @@ public Complex?[][] test96(Complex?[][] A, Complex?[][] B) { return R; } - static Complex?[][] test96_A = new Complex?[10][10]; - static Complex?[][] test96_B = new Complex?[10][10]; - static Complex?[][] test96_R; + static Complex.ref[][] test96_A = new Complex.ref[10][10]; + static Complex.ref[][] test96_B = new Complex.ref[10][10]; + static Complex.ref[][] test96_R; static { for (int i = 0; i < 10; i++) { @@ -2536,7 +2536,7 @@ public Complex?[][] test96(Complex?[][] A, Complex?[][] B) { @DontCompile public void test96_verifier(boolean warmup) { - Complex?[][] result = test96(test96_A, test96_B); + Complex.ref[][] result = test96(test96_A, test96_B); if (test96_R == null) { test96_R = result; } @@ -2580,7 +2580,7 @@ public static void test98_verifier(boolean warmup) { Asserts.assertEquals(result, rI); if (!warmup) { MyValue1[] va = new MyValue1[1]; - MyValue1?[] vab = new MyValue1?[1]; + MyValue1.ref[] vab = new MyValue1.ref[1]; result = test98((Object[])va); Asserts.assertEquals(((MyValue1)result).hash(), MyValue1.default.hash()); result = test98((Object[])vab); @@ -2669,7 +2669,7 @@ public static void test102_verifier(boolean warmup) { Asserts.assertEquals(myInt[0], null); if (!warmup) { MyValue1[] va = new MyValue1[1]; - MyValue1?[] vab = new MyValue1?[1]; + MyValue1.ref[] vab = new MyValue1.ref[1]; test102(testValue1, (Object[])va); Asserts.assertEquals(va[0].hash(), testValue1.hash()); test102(testValue1, (Object[])vab); @@ -2779,7 +2779,7 @@ public static void test106_verifier(boolean warmup) { Asserts.assertEquals(result[0], rI); if (!warmup) { MyValue1[] va = new MyValue1[1]; - MyValue1?[] vab = new MyValue1?[1]; + MyValue1.ref[] vab = new MyValue1.ref[1]; result = test106(va, (Object[])va); Asserts.assertEquals(((MyValue1)result[0]).hash(), MyValue1.default.hash()); result = test106(vab, (Object[])vab); @@ -2788,7 +2788,7 @@ public static void test106_verifier(boolean warmup) { } // Test that allocation is not replaced by non-dominating allocation - public long test107_helper(MyValue1?[] va, MyValue1 vt) { + public long test107_helper(MyValue1.ref[] va, MyValue1 vt) { try { va[0] = vt; } catch (NullPointerException npe) { } @@ -2798,7 +2798,7 @@ public long test107_helper(MyValue1?[] va, MyValue1 vt) { @Test() public void test107() { MyValue1[] va = new MyValue1[2]; - MyValue1?[] tmp = new MyValue1?[2]; + MyValue1.ref[] tmp = new MyValue1.ref[2]; long res1 = test107_helper(va, testValue1); long res2 = test107_helper(va, testValue1); Asserts.assertEquals(va[0].hash(), testValue1.hash()); @@ -2814,8 +2814,8 @@ public void test107_verifier(boolean warmup) { @Test @Warmup(10000) - public Object test108(MyValue1?[] src, boolean flag) { - MyValue1?[] dst = new MyValue1?[8]; + public Object test108(MyValue1.ref[] src, boolean flag) { + MyValue1.ref[] dst = new MyValue1.ref[8]; System.arraycopy(src, 1, dst, 2, 6); if (flag) {} // uncommon trap return dst[2]; @@ -2823,7 +2823,7 @@ public Object test108(MyValue1?[] src, boolean flag) { @DontCompile public void test108_verifier(boolean warmup) { - MyValue1?[] src = new MyValue1?[8]; + MyValue1.ref[] src = new MyValue1.ref[8]; test108(src, !warmup); } diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNullableValueTypes.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNullableValueTypes.java index e24c438d35f..d5e5c11f939 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNullableValueTypes.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNullableValueTypes.java @@ -63,11 +63,11 @@ public static void main(String[] args) throws Throwable { Class clazz = TestNullableValueTypes.class; MethodHandles.Lookup lookup = MethodHandles.lookup(); - MethodType test18_mt = MethodType.methodType(void.class, MyValue1.class.asNullableType()); + MethodType test18_mt = MethodType.methodType(void.class, MyValue1.ref.class); test18_mh1 = lookup.findStatic(clazz, "test18_target1", test18_mt); test18_mh2 = lookup.findStatic(clazz, "test18_target2", test18_mt); - MethodType test19_mt = MethodType.methodType(void.class, MyValue1.class.asNullableType()); + MethodType test19_mt = MethodType.methodType(void.class, MyValue1.ref.class); test19_mh1 = lookup.findStatic(clazz, "test19_target1", test19_mt); test19_mh2 = lookup.findStatic(clazz, "test19_target2", test19_mt); } catch (NoSuchMethodException | IllegalAccessException e) { @@ -81,11 +81,11 @@ public static void main(String[] args) throws Throwable { testValue1, testValue1}; - MyValue1? nullField; + MyValue1.ref nullField; MyValue1 valueField1 = testValue1; @Test - public long test1(MyValue1? vt) { + public long test1(MyValue1.ref vt) { long result = 0; try { result = vt.hash(); @@ -103,7 +103,7 @@ public void test1_verifier(boolean warmup) throws Throwable { } @Test - public long test2(MyValue1? vt) { + public long test2(MyValue1.ref vt) { long result = 0; try { result = vt.hashInterpreted(); @@ -157,7 +157,7 @@ public void test4_verifier(boolean warmup) { } @Test - public MyValue1? test5(MyValue1? vt) { + public MyValue1.ref test5(MyValue1.ref vt) { try { Object o = vt; vt = (MyValue1)o; @@ -174,17 +174,17 @@ public MyValue1? test5(MyValue1? vt) { @DontCompile public void test5_verifier(boolean warmup) { - MyValue1? vt = test5(nullField); + MyValue1.ref vt = test5(nullField); Asserts.assertEquals((Object)vt, null); } @DontInline - public MyValue1? test5_dontinline(MyValue1? vt) { + public MyValue1.ref test5_dontinline(MyValue1.ref vt) { return vt; } @ForceInline - public MyValue1? test5_inline(MyValue1? vt) { + public MyValue1.ref test5_inline(MyValue1.ref vt) { return vt; } @@ -207,12 +207,12 @@ public void test6_verifier(boolean warmup) { } @ForceInline - public MyValue1? getNullInline() { + public MyValue1.ref getNullInline() { return null; } @DontInline - public MyValue1? getNullDontInline() { + public MyValue1.ref getNullDontInline() { return null; } @@ -280,7 +280,7 @@ public void test9_verifier(boolean warmup) { // null constant @Test public void test10(boolean flag) throws Throwable { - MyValue1? val = flag ? valueField1 : null; + MyValue1.ref val = flag ? valueField1 : null; valueField1 = (MyValue1) val; } @@ -298,7 +298,7 @@ public void test10_verifier(boolean warmup) throws Throwable { // null constant @Test public void test11(boolean flag) throws Throwable { - MyValue1? val = flag ? null : valueField1; + MyValue1.ref val = flag ? null : valueField1; valueField1 = (MyValue1) val; } @@ -317,7 +317,7 @@ public void test11_verifier(boolean warmup) throws Throwable { int test12_cnt; @DontInline - public MyValue1? test12_helper() { + public MyValue1.ref test12_helper() { test12_cnt++; return nullField; } @@ -343,7 +343,7 @@ public void test12_verifier(boolean warmup) { // null return at virtual call class A { - public MyValue1? test13_helper() { + public MyValue1.ref test13_helper() { return nullField; } } @@ -355,7 +355,7 @@ public MyValue1 test13_helper() { } class C extends A { - public MyValue1? test13_helper() { + public MyValue1.ref test13_helper() { return nullField; } } @@ -427,7 +427,7 @@ public void test14_verifier(boolean warmup) { } @DontInline - MyValue1? getNullField1() { + MyValue1.ref getNullField1() { return nullField; } @@ -459,7 +459,7 @@ public void test15_verifier(boolean warmup) { } @DontInline - public boolean test16_dontinline(MyValue1? vt) { + public boolean test16_dontinline(MyValue1.ref vt) { return (Object)vt == null; } @@ -467,7 +467,7 @@ public boolean test16_dontinline(MyValue1? vt) { @Test @Warmup(10000) // Warmup to make sure 'test17_dontinline' is compiled public boolean test16(Object arg) throws Exception { - Method test16method = getClass().getMethod("test16_dontinline", MyValue1.class.asNullableType()); + Method test16method = getClass().getMethod("test16_dontinline", MyValue1.ref.class); return (boolean)test16method.invoke(this, arg); } @@ -479,10 +479,10 @@ public void test16_verifier(boolean warmup) throws Exception { // Test scalarization of default value type with non-flattenable field final inline class Test17Value { - public final MyValue1? valueField; + public final MyValue1.ref valueField; @ForceInline - public Test17Value(MyValue1? valueField) { + public Test17Value(MyValue1.ref valueField) { this.valueField = valueField; } } @@ -506,15 +506,15 @@ public void test17_verifier(boolean warmup) { static final MethodHandle test18_mh1; static final MethodHandle test18_mh2; - static MyValue1? nullValue; + static MyValue1.ref nullValue; @DontInline - static void test18_target1(MyValue1? vt) { + static void test18_target1(MyValue1.ref vt) { nullValue = vt; } @ForceInline - static void test18_target2(MyValue1? vt) { + static void test18_target2(MyValue1.ref vt) { nullValue = vt; } @@ -539,12 +539,12 @@ public void test18_verifier(boolean warmup) { static MethodHandle test19_mh2; @DontInline - static void test19_target1(MyValue1? vt) { + static void test19_target1(MyValue1.ref vt) { nullValue = vt; } @ForceInline - static void test19_target2(MyValue1? vt) { + static void test19_target2(MyValue1.ref vt) { nullValue = vt; } @@ -586,12 +586,12 @@ public void test20_verifier(boolean warmup) { // Test writing null to a flattenable/non-flattenable value type field in a value type final inline class Test21Value { - final MyValue1? valueField1; + final MyValue1.ref valueField1; final MyValue1 valueField2; - final MyValue1? alwaysNull = null; + final MyValue1.ref alwaysNull = null; @ForceInline - public Test21Value(MyValue1? valueField1, MyValue1 valueField2) { + public Test21Value(MyValue1.ref valueField1, MyValue1 valueField2) { this.valueField1 = testValue1; this.valueField2 = testValue1; } @@ -645,14 +645,14 @@ public void test22_verifier(boolean warmup) { } @Test - public void test23(MyValue1[] arr, MyValue1? b) { + public void test23(MyValue1[] arr, MyValue1.ref b) { arr[0] = (MyValue1) b; } @DontCompile public void test23_verifier(boolean warmup) { MyValue1[] arr = new MyValue1[2]; - MyValue1? b = null; + MyValue1.ref b = null; try { test23(arr, b); throw new RuntimeException("NullPointerException expected"); @@ -661,7 +661,7 @@ public void test23_verifier(boolean warmup) { } } - static MyValue1? nullBox; + static MyValue1.ref nullBox; @Test public MyValue1 test24() { @@ -684,7 +684,7 @@ public void test25_callee(MyValue1 val) { } // Test that when checkcasting from null-ok to null-free and back to null-ok we // keep track of the information that the value can never be null. @Test(failOn = ALLOC + STORE) - public int test25(boolean b, MyValue1? vt1, MyValue1 vt2) { + public int test25(boolean b, MyValue1.ref vt1, MyValue1 vt2) { vt1 = (MyValue1)vt1; Object obj = b ? vt1 : vt2; // We should not allocate here test25_callee((MyValue1) vt1); @@ -702,7 +702,7 @@ public void test25_verifier(boolean warmup) { // Test that chains of casts are folded and don't trigger an allocation @Test(failOn = ALLOC + STORE) public MyValue3 test26(MyValue3 vt) { - return ((MyValue3)((Object)((MyValue3?)(MyValue3)((MyValue3?)((Object)vt))))); + return ((MyValue3)((Object)((MyValue3.ref)(MyValue3)((MyValue3.ref)((Object)vt))))); } @DontCompile @@ -713,8 +713,8 @@ public void test26_verifier(boolean warmup) { } @Test(failOn = ALLOC + STORE) - public MyValue3? test27(MyValue3? vt) { - return ((MyValue3?)((Object)((MyValue3)(MyValue3?)((MyValue3)((Object)vt))))); + public MyValue3.ref test27(MyValue3.ref vt) { + return ((MyValue3.ref)((Object)((MyValue3)(MyValue3.ref)((MyValue3)((Object)vt))))); } @DontCompile @@ -726,13 +726,13 @@ public void test27_verifier(boolean warmup) { // Some more casting tests @Test() - public MyValue1? test28(MyValue1 vt, MyValue1? vtBox, int i) { - MyValue1? result = null; + public MyValue1.ref test28(MyValue1 vt, MyValue1.ref vtBox, int i) { + MyValue1.ref result = null; if (i == 0) { - result = (MyValue1?)vt; + result = (MyValue1.ref)vt; result = null; } else if (i == 1) { - result = (MyValue1?)vt; + result = (MyValue1.ref)vt; } else if (i == 2) { result = vtBox; } @@ -741,7 +741,7 @@ public MyValue1? test28(MyValue1 vt, MyValue1? vtBox, int i) { @DontCompile public void test28_verifier(boolean warmup) { - MyValue1? result = test28(testValue1, null, 0); + MyValue1.ref result = test28(testValue1, null, 0); Asserts.assertEquals(result, null); result = test28(testValue1, testValue1, 1); Asserts.assertEquals(result, testValue1); @@ -752,15 +752,15 @@ public void test28_verifier(boolean warmup) { } @Test() - public long test29(MyValue1 vt, MyValue1? vtBox) { + public long test29(MyValue1 vt, MyValue1.ref vtBox) { long result = 0; for (int i = 0; i < 100; ++i) { - MyValue1? box; + MyValue1.ref box; if (i == 0) { - box = (MyValue1?)vt; + box = (MyValue1.ref)vt; box = null; } else if (i < 99) { - box = (MyValue1?)vt; + box = (MyValue1.ref)vt; } else { box = vtBox; } @@ -780,7 +780,7 @@ public void test29_verifier(boolean warmup) { } // Test null check of value type receiver with incremental inlining - public long test30_callee(MyValue1? vt) { + public long test30_callee(MyValue1.ref vt) { long result = 0; try { result = vt.hashInterpreted(); @@ -822,16 +822,16 @@ public void test31_verifier(boolean warmup) { test31(null); } - private static final MyValue1? constNullField = null; + private static final MyValue1.ref constNullField = null; @Test - public MyValue1? test32() { + public MyValue1.ref test32() { return constNullField; } @DontCompile public void test32_verifier(boolean warmup) { - MyValue1? result = test32(); + MyValue1.ref result = test32(); Asserts.assertEquals(result, null); } @@ -840,7 +840,7 @@ static inline class Test33Value1 { } static inline class Test33Value2 { - Test33Value1? vt; + Test33Value1.ref vt; public Test33Value2() { vt = new Test33Value1(); @@ -862,7 +862,7 @@ public void test33_verifier(boolean warmup) { // Verify that static nullable inline-type fields are not // treated as never-null by C2 when initialized at compile time. - private static MyValue1? test34Val; + private static MyValue1.ref test34Val; @Test public void test34(MyValue1 vt) { diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestOnStackReplacement.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestOnStackReplacement.java index 05cbae6e127..8bdcc1533e9 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestOnStackReplacement.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestOnStackReplacement.java @@ -158,11 +158,11 @@ public void test4_verifier(boolean warmup) { // OSR compilation with null value type local - MyValue1? nullField; + MyValue1.ref nullField; @Test() @Warmup(0) @OSRCompileOnly public void test5() { - MyValue1? vt = nullField; + MyValue1.ref vt = nullField; for (int i = 0; i < 50_000; i++) { if (vt != null) { throw new RuntimeException("test5 failed: vt should be null"); diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestUnloadedValueTypeArray.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestUnloadedValueTypeArray.java index 0b3a01c08f9..8f804dbde55 100644 --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestUnloadedValueTypeArray.java +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestUnloadedValueTypeArray.java @@ -141,7 +141,7 @@ public MyValue6Box(int n) { foo = n; } - public MyValue6Box(MyValue6Box v, MyValue6Box?[] dummy) { + public MyValue6Box(MyValue6Box v, MyValue6Box.ref[] dummy) { foo = v.foo + 1; } } @@ -196,8 +196,8 @@ static void test1() { target1(); } - static MyValue1Box?[] target1Box() { - return new MyValue1Box?[10]; + static MyValue1Box.ref[] target1Box() { + return new MyValue1Box.ref[10]; } static void test1Box() { @@ -230,7 +230,7 @@ static void verifyTest2() { Asserts.assertEQ(m, 5678); } - static int test2Box(MyValue2Box?[] arr) { + static int test2Box(MyValue2Box.ref[] arr) { if (arr != null) { return arr[1].foo; } else { @@ -247,7 +247,7 @@ static void verifyTest2Box() { } Asserts.assertEQ(m, 1234); - MyValue2Box?[] arr = new MyValue2Box?[2]; + MyValue2Box.ref[] arr = new MyValue2Box.ref[2]; arr[1] = new MyValue2Box(5678); m = 9999; for (int i=0; i