< prev index next >

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

Print this page




 880     }
 881 
 882     @Test()
 883     public Object test50(Class c, Object obj) {
 884         return c.cast(obj);
 885     }
 886 
 887     @DontCompile
 888     public void test50_verifier(boolean warmup) {
 889         MyValue1 vt = MyValue1.createWithFieldsInline(rI, rL);
 890         MyValue1[] va  = new MyValue1[42];
 891         MyValue1?[] vba = new MyValue1?[42];
 892         Object result = test50(MyValue1.class.asValueType(), vt);
 893         Asserts.assertEQ(((MyValue1)result).hash(), vt.hash());
 894         result = test50(MyValue1.class.asBoxType(), vt);
 895         Asserts.assertEQ(((MyValue1)result).hash(), vt.hash());
 896         result = test50(MyValue1[].class, va);
 897         Asserts.assertEQ(result, va);
 898         result = test50(MyValue1?[].class, vba);
 899         Asserts.assertEQ(result, vba);


 900         try {
 901             test50(MyValue1.class.asValueType(), null);
 902             throw new RuntimeException("should have thrown");
 903         } catch (NullPointerException npe) {
 904         }
 905         try {
 906             test50(MyValue1?[].class, va);
 907             throw new RuntimeException("should have thrown");
 908         } catch (ClassCastException cce) {
 909         }
 910         try {
 911             test50(MyValue1[].class, vba);
 912             throw new RuntimeException("should have thrown");
 913         } catch (ClassCastException cce) {
 914         }
 915     }
 916 
 917     // value type array creation via reflection
 918     @Test()
 919     public void test51(int len) {
 920         Object[] va = (Object[])Array.newInstance(MyValue1.class.asBoxType().asValueType().asBoxType(), len);
 921         for (int i = 0; i < len; ++i) {
 922             Asserts.assertEQ(va[i], null);
 923         }
 924     }
 925 
 926     @DontCompile
 927     public void test51_verifier(boolean warmup) {
 928         int len = Math.abs(rI) % 42;




 880     }
 881 
 882     @Test()
 883     public Object test50(Class c, Object obj) {
 884         return c.cast(obj);
 885     }
 886 
 887     @DontCompile
 888     public void test50_verifier(boolean warmup) {
 889         MyValue1 vt = MyValue1.createWithFieldsInline(rI, rL);
 890         MyValue1[] va  = new MyValue1[42];
 891         MyValue1?[] vba = new MyValue1?[42];
 892         Object result = test50(MyValue1.class.asValueType(), vt);
 893         Asserts.assertEQ(((MyValue1)result).hash(), vt.hash());
 894         result = test50(MyValue1.class.asBoxType(), vt);
 895         Asserts.assertEQ(((MyValue1)result).hash(), vt.hash());
 896         result = test50(MyValue1[].class, va);
 897         Asserts.assertEQ(result, va);
 898         result = test50(MyValue1?[].class, vba);
 899         Asserts.assertEQ(result, vba);
 900         result = test50(MyValue1?[].class, va);
 901         Asserts.assertEQ(result, va);
 902         try {
 903             test50(MyValue1.class.asValueType(), null);
 904             throw new RuntimeException("should have thrown");
 905         } catch (NullPointerException npe) {





 906         }
 907         try {
 908             test50(MyValue1[].class, vba);
 909             throw new RuntimeException("should have thrown");
 910         } catch (ClassCastException cce) {
 911         }
 912     }
 913 
 914     // value type array creation via reflection
 915     @Test()
 916     public void test51(int len) {
 917         Object[] va = (Object[])Array.newInstance(MyValue1.class.asBoxType().asValueType().asBoxType(), len);
 918         for (int i = 0; i < len; ++i) {
 919             Asserts.assertEQ(va[i], null);
 920         }
 921     }
 922 
 923     @DontCompile
 924     public void test51_verifier(boolean warmup) {
 925         int len = Math.abs(rI) % 42;


< prev index next >