< prev index next >

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

Print this page




2773 
2774     @DontCompile
2775     public static void test106_verifier(boolean warmup) {
2776         Object[] dst = new Object[1];
2777         Object obj = new Object();
2778         Object[] result = test106(dst, obj);
2779         Asserts.assertEquals(result[0], obj);
2780         Integer[] myInt = new Integer[1];
2781         myInt[0] = rI;
2782         result = test106(myInt, (Object[])myInt);
2783         Asserts.assertEquals(result[0], rI);
2784         if (!warmup) {
2785             MyValue1[] va = new MyValue1[1];
2786             MyValue1?[] vab = new MyValue1?[1];
2787             result = test106(va, (Object[])va);
2788             Asserts.assertEquals(((MyValue1)result[0]).hash(), MyValue1.default.hash());
2789             result = test106(vab, (Object[])vab);
2790             Asserts.assertEquals(((MyValue1)result[0]).hash(), testValue1.hash());
2791         }
2792     }
























2793 }


2773 
2774     @DontCompile
2775     public static void test106_verifier(boolean warmup) {
2776         Object[] dst = new Object[1];
2777         Object obj = new Object();
2778         Object[] result = test106(dst, obj);
2779         Asserts.assertEquals(result[0], obj);
2780         Integer[] myInt = new Integer[1];
2781         myInt[0] = rI;
2782         result = test106(myInt, (Object[])myInt);
2783         Asserts.assertEquals(result[0], rI);
2784         if (!warmup) {
2785             MyValue1[] va = new MyValue1[1];
2786             MyValue1?[] vab = new MyValue1?[1];
2787             result = test106(va, (Object[])va);
2788             Asserts.assertEquals(((MyValue1)result[0]).hash(), MyValue1.default.hash());
2789             result = test106(vab, (Object[])vab);
2790             Asserts.assertEquals(((MyValue1)result[0]).hash(), testValue1.hash());
2791         }
2792     }
2793 
2794     // Test that allocation is not replaced by non-dominating allocation
2795     public long test107_helper(MyValue1?[] va, MyValue1 vt) {
2796         try {
2797             va[0] = vt;
2798         } catch (NullPointerException npe) { }
2799         return va[1].hash();
2800     }
2801 
2802     @Test()
2803     public void test107() {
2804         MyValue1[] va = new MyValue1[2];
2805         MyValue1?[] tmp = new MyValue1?[2];
2806         long res1 = test107_helper(va, testValue1);
2807         long res2 = test107_helper(va, testValue1);
2808         Asserts.assertEquals(va[0].hash(), testValue1.hash());
2809         Asserts.assertEquals(res1, MyValue1.default.hash());
2810         Asserts.assertEquals(res2, MyValue1.default.hash());
2811     }
2812 
2813     @DontCompile
2814     public void test107_verifier(boolean warmup) {
2815         test107();
2816     }
2817 }
< prev index next >