Skip to content

Commit

Permalink
8243625: [lworld] Co-evolve hotspot-compiler tests along with JDK-823…
Browse files Browse the repository at this point in the history
…7072

Reviewed-by: thartmann
  • Loading branch information
Srikanth Adayapalam committed May 5, 2020
1 parent 4c2f8be commit 08bfa8f
Show file tree
Hide file tree
Showing 16 changed files with 490 additions and 479 deletions.
Expand Up @@ -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;
}

Expand All @@ -67,19 +67,19 @@ 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;
}

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;
}

Expand All @@ -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);
Expand Down
36 changes: 20 additions & 16 deletions test/hotspot/jtreg/compiler/valhalla/valuetypes/TestArrays.java
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand All @@ -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);
Expand All @@ -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 {
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down
Expand Up @@ -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
*/

Expand Down
48 changes: 24 additions & 24 deletions test/hotspot/jtreg/compiler/valhalla/valuetypes/TestC2CCalls.java
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand All @@ -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);
}

Expand Down Expand Up @@ -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 {
Expand All @@ -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);
}

Expand Down Expand Up @@ -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; }

Expand Down Expand Up @@ -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; }

Expand Down Expand Up @@ -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 {
Expand All @@ -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);
}

Expand Down
Expand Up @@ -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() {
Expand Down Expand Up @@ -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 {
Expand All @@ -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());
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 08bfa8f

Please sign in to comment.