--- old/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestLWorld.java 2019-09-16 13:55:23.000000000 +0200 +++ new/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestLWorld.java 2019-09-16 13:55:18.000000000 +0200 @@ -2089,6 +2089,7 @@ 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); @@ -2117,8 +2118,8 @@ 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]; @@ -2232,4 +2233,47 @@ 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 || compiled == (j == extra-1)); + if (!compiled) { + enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION); + } + } + } + } }