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 8076188
27 * @summary arraycopy to non escaping destination may be eliminated
28 * @compile TestEliminateArrayCopy.java TestArrayCopyUtils.java
29 * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestEliminateArrayCopy*::m* TestEliminateArrayCopy
30 *
31 */
32
33 public class TestEliminateArrayCopy {
34
35 static class CloneTests extends TestInstanceCloneUtils {
36 // object allocation and ArrayCopyNode should be eliminated
37 static void m1(E src) throws CloneNotSupportedException {
38 src.clone();
39 }
40
41 // both object allocations and ArrayCopyNode should be eliminated
42 static void m2(Object dummy) throws CloneNotSupportedException {
43 E src = new E(false);
44 src.clone();
45 }
46
47 // object allocation and ArrayCopyNode should be eliminated. Fields should be loaded from src.
48 static int m3(E src) throws CloneNotSupportedException {
49 E dest = (E)src.clone();
50 return dest.i1 + dest.i2 + dest.i3 + dest.i4 + dest.i5 +
51 dest.i6 + dest.i7 + dest.i8 + dest.i9;
52 }
|
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 8076188
27 * @summary arraycopy to non escaping destination may be eliminated
28 * @library /
29 *
30 * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
31 * -XX:CompileCommand=dontinline,compiler.arraycopy.TestEliminateArrayCopy*::m*
32 * compiler.arraycopy.TestEliminateArrayCopy
33 *
34 */
35
36 package compiler.arraycopy;
37
38 public class TestEliminateArrayCopy {
39
40 static class CloneTests extends TestInstanceCloneUtils {
41 // object allocation and ArrayCopyNode should be eliminated
42 static void m1(E src) throws CloneNotSupportedException {
43 src.clone();
44 }
45
46 // both object allocations and ArrayCopyNode should be eliminated
47 static void m2(Object dummy) throws CloneNotSupportedException {
48 E src = new E(false);
49 src.clone();
50 }
51
52 // object allocation and ArrayCopyNode should be eliminated. Fields should be loaded from src.
53 static int m3(E src) throws CloneNotSupportedException {
54 E dest = (E)src.clone();
55 return dest.i1 + dest.i2 + dest.i3 + dest.i4 + dest.i5 +
56 dest.i6 + dest.i7 + dest.i8 + dest.i9;
57 }
|