Path: blob/master/test/hotspot/jtreg/compiler/arraycopy/TestMissingControl.java
41149 views
/*1* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 805515326* @summary missing control on LoadRange and LoadKlass when array copy macro node is expanded27*28* @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:-TieredCompilation29* compiler.arraycopy.TestMissingControl30*31*/3233package compiler.arraycopy;3435public class TestMissingControl {3637static int[] m1(int[] a2) {38int[] a1 = new int[10];39System.arraycopy(a1, 0, a2, 0, 10);40return a1;41}4243static class A {44}4546static Object m2(Object[] a2) {47A[] a1 = new A[10];48System.arraycopy(a1, 0, a2, 0, 10);49return a1;50}5152static void test1() {53int[] a2 = new int[10];54int[] a3 = new int[5];5556// compile m1 with arraycopy intrinsified57for (int i = 0; i < 20000; i++) {58m1(a2);59}6061// make m1 trap62for (int i = 0; i < 10; i++) {63try {64m1(a3);65} catch(IndexOutOfBoundsException ioobe) {66}67}6869// recompile m170for (int i = 0; i < 20000; i++) {71m1(a2);72}7374try {75m1(null);76} catch(NullPointerException npe) {}77}7879static void test2() {80A[] a2 = new A[10];81A[] a3 = new A[5];8283// compile m2 with arraycopy intrinsified84for (int i = 0; i < 20000; i++) {85m2(a2);86}8788// make m2 trap89for (int i = 0; i < 10; i++) {90try {91m2(a3);92} catch(IndexOutOfBoundsException ioobe) {93}94}9596// recompile m297for (int i = 0; i < 20000; i++) {98m2(a2);99}100101try {102m2(null);103} catch(NullPointerException npe) {}104}105106static public void main(String[] args) {107test1();108test2();109}110}111112113