< prev index next >

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

Print this page




1272         MyValue1[] vals = new MyValue1[] {test42VT1, test42VT2};
1273 
1274         if (deopt) {
1275             // uncommon trap
1276             WHITE_BOX.deoptimizeMethod(tests.get(getClass().getSimpleName() + "::test43"));
1277             Asserts.assertEQ(vals[0].hash(), test42VT1.hash());
1278             Asserts.assertEQ(vals[1].hash(), test42VT2.hash());
1279         }
1280 
1281         return vals[0].hash();
1282     }
1283 
1284     @DontCompile
1285     public void test43_verifier(boolean warmup) {
1286         test43(!warmup);
1287     }
1288 
1289     // Tests writing an array element with a (statically known) incompatible type
1290     private static final MethodHandle setArrayElementIncompatible = MethodHandleBuilder.loadCode(MethodHandles.lookup(),
1291         "setArrayElementIncompatible",
1292         MethodType.methodType(void.class, TestLWorld.class, MyValue1[].class, int.class, MyValue2.class),
1293         CODE -> {
1294             CODE.
1295             aload_1().
1296             iload_2().
1297             aload_3().
1298             aastore().
1299             return_();
1300         });
1301 
1302     @Test()
1303     public void test44(MyValue1[] va, int index, MyValue2 v) throws Throwable {
1304         setArrayElementIncompatible.invoke(this, va, index, v);
1305     }
1306 
1307     @DontCompile
1308     public void test44_verifier(boolean warmup) throws Throwable {
1309         int index = Math.abs(rI) % 3;
1310         try {
1311             test44(testValue1Array, index, testValue2);
1312             throw new RuntimeException("No ArrayStoreException thrown");




1272         MyValue1[] vals = new MyValue1[] {test42VT1, test42VT2};
1273 
1274         if (deopt) {
1275             // uncommon trap
1276             WHITE_BOX.deoptimizeMethod(tests.get(getClass().getSimpleName() + "::test43"));
1277             Asserts.assertEQ(vals[0].hash(), test42VT1.hash());
1278             Asserts.assertEQ(vals[1].hash(), test42VT2.hash());
1279         }
1280 
1281         return vals[0].hash();
1282     }
1283 
1284     @DontCompile
1285     public void test43_verifier(boolean warmup) {
1286         test43(!warmup);
1287     }
1288 
1289     // Tests writing an array element with a (statically known) incompatible type
1290     private static final MethodHandle setArrayElementIncompatible = MethodHandleBuilder.loadCode(MethodHandles.lookup(),
1291         "setArrayElementIncompatible",
1292         MethodType.methodType(void.class, TestLWorld.class, MyValue1[].class, int.class, MyValue2.class.asValueType()),
1293         CODE -> {
1294             CODE.
1295             aload_1().
1296             iload_2().
1297             aload_3().
1298             aastore().
1299             return_();
1300         });
1301 
1302     @Test()
1303     public void test44(MyValue1[] va, int index, MyValue2 v) throws Throwable {
1304         setArrayElementIncompatible.invoke(this, va, index, v);
1305     }
1306 
1307     @DontCompile
1308     public void test44_verifier(boolean warmup) throws Throwable {
1309         int index = Math.abs(rI) % 3;
1310         try {
1311             test44(testValue1Array, index, testValue2);
1312             throw new RuntimeException("No ArrayStoreException thrown");


< prev index next >