changeset 18599:68cab2726edb

arraycopytests: test for disjoint
author Bernhard Urban <bernhard.urban@jku.at>
date Wed, 03 Dec 2014 14:31:15 +0100
parents d806707624bb
children f6ca61099649
files graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ArrayCopyIntrinsificationTest.java
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ArrayCopyIntrinsificationTest.java	Wed Dec 03 14:29:04 2014 +0100
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ArrayCopyIntrinsificationTest.java	Wed Dec 03 14:31:15 2014 +0100
@@ -156,6 +156,19 @@
     }
 
     @Test
+    public void testDisjointObject() {
+        mustIntrinsify = false; // a generic call to arraycopy will not be intrinsified
+
+        Integer[] src1 = {1, 2, 3, 4};
+        test("objectArraycopy", src1, 0, src1, 1, src1.length - 1);
+
+        Integer[] src2 = {1, 2, 3, 4};
+        test("objectArraycopy", src2, 1, src2, 0, src2.length - 1);
+
+        mustIntrinsify = true;
+    }
+
+    @Test
     public void testObjectExact() {
         Integer[] src = {1, 2, 3, 4};
         testHelper("objectArraycopyExact", src);
@@ -179,6 +192,10 @@
             test(name, src, srcLength - length, newArray(src, length), 0, length);
             test(name, src, 0, newArray(src, srcLength), 0, length);
         }
+
+        if (srcLength > 1) {
+            test(name, src, 0, src, 1, srcLength - 1);
+        }
     }
 
     public static Object genericArraycopy(Object src, int srcPos, Object dst, int dstPos, int length) {