annotate graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/ArrayCopy02.java @ 14991:64dcb92ee75a

Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 06 Apr 2014 17:46:24 +0200
parents 390448a6b535
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
1 /*
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
4 *
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
7 * published by the Free Software Foundation.
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
8 *
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
13 * accompanied this code).
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
14 *
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
18 *
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
21 * questions.
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
22 */
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
23 package com.oracle.graal.jtt.optimize;
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
24
14991
64dcb92ee75a Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7282
diff changeset
25 import org.junit.*;
64dcb92ee75a Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7282
diff changeset
26
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
27 import com.oracle.graal.jtt.*;
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
28
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
29 /*
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
30 * Tests calls to the array copy method.
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
31 */
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
32 public class ArrayCopy02 extends JTTTest {
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
33
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
34 public static int[] src = new int[]{0, 1, 2, 3, 4, 5};
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
35 public static int[] dest0 = new int[]{5, 4, 3, 2, 1, 0};
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
36 public static int[] dest = new int[]{5, 4, 3, 2, 1, 0};
5744
51cee50d1d11 ensure System.arrycopy is resolved in JTT tests that use it
Doug Simon <doug.simon@oracle.com>
parents: 5613
diff changeset
37 static {
5746
17d2c3b72762 Fix aliased case problem intoduced in last array copy snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5744
diff changeset
38 // Ensure System is resolved
5744
51cee50d1d11 ensure System.arrycopy is resolved in JTT tests that use it
Doug Simon <doug.simon@oracle.com>
parents: 5613
diff changeset
39 System.arraycopy(src, 0, src, 0, src.length);
51cee50d1d11 ensure System.arrycopy is resolved in JTT tests that use it
Doug Simon <doug.simon@oracle.com>
parents: 5613
diff changeset
40 }
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
41
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
42 @Before
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
43 public void setUp() {
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
44 System.currentTimeMillis();
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
45 for (int i = 0; i < dest.length; i++) {
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
46 dest[i] = dest0[i];
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
47 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
48 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
49
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
50 public static int[] test(int srcPos, int destPos, int length) {
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
51 System.arraycopy(src, srcPos, dest, destPos, length);
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
52 return dest;
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
53 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
54
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
55 @Test
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
56 public void run0() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
57 runTest("test", 0, 0, 0);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
58 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
59
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
60 @Test
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
61 public void run1() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
62 runTest("test", 0, 0, -1);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
63 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
64
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
65 @Test
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
66 public void run2() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
67 runTest("test", -1, 0, 0);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
68 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
69
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
70 @Test
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
71 public void run3() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
72 runTest("test", 0, -1, 0);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
73 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
74
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
75 @Test
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
76 public void run4() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
77 runTest("test", 0, 0, 2);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
78 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
79
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
80 @Test
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
81 public void run5() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
82 runTest("test", 0, 1, 6);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
83 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
84
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
85 @Test
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
86 public void run6() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
87 runTest("test", 1, 0, 6);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
88 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
89
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
90 @Test
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
91 public void run7() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
92 runTest("test", 1, 1, -1);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
93 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
94
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
95 @Test
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
96 public void run8() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
97 runTest("test", 0, 1, 2);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
98 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
99
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
100 @Test
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
101 public void run9() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
102 runTest("test", 1, 0, 2);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
103 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
104
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
105 @Test
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
106 public void run10() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
107 runTest("test", 1, 1, 2);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
108 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
109
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
110 @Test
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
111 public void run11() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
112 runTest("test", 0, 0, 6);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
113 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
114
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
115 @Test
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
116 public void run12() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
117 runTest("test", 0, 1, 5);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
118 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
119
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
120 @Test
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
121 public void run13() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
122 runTest("test", 1, 0, 5);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
123 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
124
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
125 @Test
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
126 public void run14() throws Throwable {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents: 5746
diff changeset
127 runTest("test", 1, 1, 5);
5613
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
128 }
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
129
4cd97b3be234 Add 2 array copy tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
130 }