< prev index next >

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

Print this page

        

@@ -2087,10 +2087,11 @@
 
     @DontCompile
     public void test83_verifier(boolean warmup) {
         MyValue2[] dst = new MyValue2[1];
         test83(dst, testValue2, false);
+        test83(dst, testValue2, true);
         if (!warmup) {
             try {
                 test83(dst, null, true);
                 throw new RuntimeException("No ArrayStoreException thrown");
             } catch (NullPointerException e) {

@@ -2115,12 +2116,12 @@
         MyValue2[] dst = new MyValue2[100];
         test84(src, dst);
         Asserts.assertTrue(Arrays.equals(src, dst));
     }
 
-    @Test(valid = G1GCOn, match = { COUNTEDLOOP }, matchCount = { 2 } )
-    @Test(valid = G1GCOff, match = { COUNTEDLOOP }, matchCount = { 3 } )
+    @Test(valid = G1GCOn, match = { COUNTEDLOOP, LOAD_UNKNOWN_VALUE }, matchCount = { 2, 1 } )
+    @Test(valid = G1GCOff, match = { COUNTEDLOOP, LOAD_UNKNOWN_VALUE }, matchCount = { 3, 4 } )
     public void test85(Object[] src, Object[] dst) {
         for (int i = 0; i < src.length; i++) {
             dst[i] = src[i];
         }
     }

@@ -2230,6 +2231,49 @@
     @DontCompile
     public void test91_verifier(boolean warmup) {
         Asserts.assertTrue(test91(new MyValue2[1]));
         Asserts.assertFalse(test91(new Object()));
     }
+
+    static inline class Test92Value {
+        final int field;
+        public Test92Value() {
+            field = 0x42;
+        }
+    }
+
+    // If the class check succeeds, the flattened array check that
+    // precedes will never succeed and the flat array branch should
+    // trigger an uncommon trap.
+    @Test
+    @Warmup(10000)
+    public Object test92(Object[] array) {
+        Object v = array[0];
+        if (v instanceof Integer) {
+        }
+        return v;
+    }
+
+    @DontCompile
+    public void test92_verifier(boolean warmup) {
+        if (warmup) {
+            Object[] array = new Object[1];
+            array[0] = 0x42;
+            Object result = test92(array);
+            Asserts.assertEquals(result, 0x42);
+        } else {
+            Object[] array = new Test92Value[1];
+            Method m = tests.get("TestLWorld::test92");
+            int extra = 2;
+            for (int j = 0; j < extra; j++) {
+                for (int i = 0; i < 10; i++) {
+                    test92(array);
+                }
+                boolean compiled = isCompiledByC2(m);
+                Asserts.assertTrue(!USE_COMPILER || XCOMP || TEST_C1 || compiled == (j == extra-1));
+                if (!compiled) {
+                    enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
+                }
+            }
+        }
+    }
 }
< prev index next >