changeset 21275:40ca261ba43a

fixed bug in ArrayCopySnippets.checkcastArraycopy: the destination element class must be passed to the runtime routine, not the destination class
author Doug Simon <doug.simon@oracle.com>
date Fri, 08 May 2015 17:52:59 +0200
parents d2f314708067
children 9f6733155647
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopySnippets.java
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java	Fri May 08 17:51:04 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java	Fri May 08 17:52:59 2015 +0200
@@ -825,6 +825,11 @@
 
     public static final LocationIdentity OBJ_ARRAY_KLASS_ELEMENT_KLASS_LOCATION = NamedLocationIdentity.immutable("ObjArrayKlass::_element_klass");
 
+    @Fold
+    public static int arrayClassElementOffset() {
+        return config().arrayClassElementOffset;
+    }
+
     public static final LocationIdentity PRIMARY_SUPERS_LOCATION = NamedLocationIdentity.immutable("PrimarySupers");
 
     public static final LocationIdentity METASPACE_ARRAY_LENGTH_LOCATION = NamedLocationIdentity.immutable("MetaspaceArrayLength");
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopySnippets.java	Fri May 08 17:51:04 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopySnippets.java	Fri May 08 17:52:59 2015 +0200
@@ -194,7 +194,8 @@
             // no storecheck required.
             ArrayCopyCallNode.arraycopy(nonNullSrc, srcPos, nonNullDest, destPos, length, Kind.Object, false, false);
         } else {
-            KlassPointer destElemKlass = loadHub(nonNullDest);
+            KlassPointer destKlass = loadHub(nonNullDest);
+            KlassPointer destElemKlass = destKlass.readKlassPointer(arrayClassElementOffset(), OBJ_ARRAY_KLASS_ELEMENT_KLASS_LOCATION);
             checkcastArraycopyHelper(srcPos, destPos, length, nonNullSrc, nonNullDest, destElemKlass);
         }
     }