8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 6912521
27 * @summary small array copy as loads/stores
28 * @compile TestArrayCopyAsLoadsStores.java TestArrayCopyUtils.java
29 * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestArrayCopyAsLoadsStores::m* -XX:TypeProfileLevel=200 TestArrayCopyAsLoadsStores
30 * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestArrayCopyAsLoadsStores::m* -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode -XX:TypeProfileLevel=200 TestArrayCopyAsLoadsStores
31 *
32 */
33
34 import java.util.*;
35
36 public class TestArrayCopyAsLoadsStores extends TestArrayCopyUtils {
37
38 // array clone should be compiled as loads/stores
39 @Args(src=ArraySrc.SMALL)
40 static A[] m1() throws CloneNotSupportedException {
41 return (A[])small_a_src.clone();
42 }
43
44 @Args(src=ArraySrc.SMALL)
45 static int[] m2() throws CloneNotSupportedException {
46 return (int[])small_int_src.clone();
47 }
48
49 // new array allocation should be optimized out
50 @Args(src=ArraySrc.SMALL)
51 static int m3() throws CloneNotSupportedException {
52 int[] array_clone = (int[])small_int_src.clone();
53 return array_clone[0] + array_clone[1] + array_clone[2] +
54 array_clone[3] + array_clone[4];
55 }
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 6912521
27 * @summary small array copy as loads/stores
28 * @library /
29 *
30 * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
31 * -XX:CompileCommand=dontinline,compiler.arraycopy.TestArrayCopyAsLoadsStores::m*
32 * -XX:TypeProfileLevel=200
33 * compiler.arraycopy.TestArrayCopyAsLoadsStores
34 * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
35 * -XX:CompileCommand=dontinline,compiler.arraycopy.TestArrayCopyAsLoadsStores::m*
36 * -XX:TypeProfileLevel=200
37 * -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode
38 * compiler.arraycopy.TestArrayCopyAsLoadsStores
39 */
40
41 package compiler.arraycopy;
42
43 import java.util.Arrays;
44
45 public class TestArrayCopyAsLoadsStores extends TestArrayCopyUtils {
46
47 // array clone should be compiled as loads/stores
48 @Args(src=ArraySrc.SMALL)
49 static A[] m1() throws CloneNotSupportedException {
50 return (A[])small_a_src.clone();
51 }
52
53 @Args(src=ArraySrc.SMALL)
54 static int[] m2() throws CloneNotSupportedException {
55 return (int[])small_int_src.clone();
56 }
57
58 // new array allocation should be optimized out
59 @Args(src=ArraySrc.SMALL)
60 static int m3() throws CloneNotSupportedException {
61 int[] array_clone = (int[])small_int_src.clone();
62 return array_clone[0] + array_clone[1] + array_clone[2] +
63 array_clone[3] + array_clone[4];
64 }
|