2334 @Test(match = { CLASS_CHECK_TRAP, LOOP }, matchCount = { 2, 1 }, failOn = LOAD_UNKNOWN_VALUE + ALLOC_G) 2335 public int test94(Object[] array) { 2336 int res = 0; 2337 for (int i = 1; i < 4; i *= 2) { 2338 Object v = array[i]; 2339 res += (Integer)v; 2340 } 2341 return res; 2342 } 2343 2344 @DontCompile 2345 public void test94_verifier(boolean warmup) { 2346 Object[] array = new Object[4]; 2347 array[0] = 0x42; 2348 array[1] = 0x42; 2349 array[2] = 0x42; 2350 array[3] = 0x42; 2351 int result = test94(array); 2352 Asserts.assertEquals(result, 0x42 * 2); 2353 } 2354 } | 2334 @Test(match = { CLASS_CHECK_TRAP, LOOP }, matchCount = { 2, 1 }, failOn = LOAD_UNKNOWN_VALUE + ALLOC_G) 2335 public int test94(Object[] array) { 2336 int res = 0; 2337 for (int i = 1; i < 4; i *= 2) { 2338 Object v = array[i]; 2339 res += (Integer)v; 2340 } 2341 return res; 2342 } 2343 2344 @DontCompile 2345 public void test94_verifier(boolean warmup) { 2346 Object[] array = new Object[4]; 2347 array[0] = 0x42; 2348 array[1] = 0x42; 2349 array[2] = 0x42; 2350 array[3] = 0x42; 2351 int result = test94(array); 2352 Asserts.assertEquals(result, 0x42 * 2); 2353 } 2354 2355 // Test that no code for clearing the array klass property bits is emitted for acmp 2356 // because when loading the klass, we already know that the operand is a value type. 2357 @Warmup(10000) 2358 @Test(failOn = STORAGE_PROPERTY_CLEARING) 2359 public boolean test95(Object o1, Object o2) { 2360 return o1 == o2; 2361 } 2362 2363 @DontCompile 2364 public void test95_verifier(boolean warmup) { 2365 Object o1 = new Object(); 2366 Object o2 = new Object(); 2367 Asserts.assertTrue(test95(o1, o1)); 2368 Asserts.assertTrue(test95(null, null)); 2369 Asserts.assertFalse(test95(o1, null)); 2370 Asserts.assertFalse(test95(o1, o2)); 2371 } 2372 2373 // Same as test95 but operands are never null 2374 @Warmup(10000) 2375 @Test(failOn = STORAGE_PROPERTY_CLEARING) 2376 public boolean test96(Object o1, Object o2) { 2377 return o1 == o2; 2378 } 2379 2380 @DontCompile 2381 public void test96_verifier(boolean warmup) { 2382 Object o1 = new Object(); 2383 Object o2 = new Object(); 2384 Asserts.assertTrue(test96(o1, o1)); 2385 Asserts.assertFalse(test96(o1, o2)); 2386 if (!warmup) { 2387 Asserts.assertTrue(test96(null, null)); 2388 Asserts.assertFalse(test96(o1, null)); 2389 } 2390 } 2391 } |