# HG changeset patch # User Christos Kotselidis # Date 1370358891 -7200 # Node ID cecd40916b0670e801938f6e6b5a2e2225f36a7b # Parent 477fb9a9a06d50d0a33cfb717dbb19de5725f353 Add scaling factor for arrays diff -r 477fb9a9a06d -r cecd40916b06 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Tue Jun 04 13:54:44 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Tue Jun 04 17:14:51 2013 +0200 @@ -836,9 +836,17 @@ protected static ConstantLocationNode createFieldLocation(StructuredGraph graph, HotSpotResolvedJavaField field) { return ConstantLocationNode.create(field, field.getKind(), field.offset(), graph); } + + public int getScalingFactor(Kind kind) { + if(config.useCompressedOops && kind==Kind.Object) { + return this.graalRuntime.getTarget().arch.getSizeInBytes(Kind.Int); + } else { + return this.graalRuntime.getTarget().arch.getSizeInBytes(kind); + } + } protected IndexedLocationNode createArrayLocation(Graph graph, Kind elementKind, ValueNode index) { - int scale = this.graalRuntime.getTarget().arch.getSizeInBytes(elementKind); + int scale = getScalingFactor(elementKind); return IndexedLocationNode.create(NamedLocationIdentity.getArrayLocation(elementKind), elementKind, getArrayBaseOffset(elementKind), index, graph, scale); } diff -r 477fb9a9a06d -r cecd40916b06 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java Tue Jun 04 13:54:44 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java Tue Jun 04 17:14:51 2013 +0200 @@ -238,7 +238,7 @@ Kind elementKind = elementType.getKind(); ConstantNode hub = ConstantNode.forConstant(arrayType.klass(), runtime, graph); final int headerSize = HotSpotRuntime.getArrayBaseOffset(elementKind); - int log2ElementSize = CodeUtil.log2(target.arch.getSizeInBytes(elementKind)); + int log2ElementSize = CodeUtil.log2(((HotSpotRuntime)runtime).getScalingFactor(elementKind)); Arguments args = new Arguments(allocateArray); args.add("hub", hub); diff -r 477fb9a9a06d -r cecd40916b06 make/build-graal.xml --- a/make/build-graal.xml Tue Jun 04 13:54:44 2013 +0200 +++ b/make/build-graal.xml Tue Jun 04 17:14:51 2013 +0200 @@ -93,6 +93,15 @@ + + + + + + + + +