Mercurial > hg > graal-compiler
changeset 9884:cecd40916b06
Add scaling factor for arrays
author | Christos Kotselidis <christos.kotselidis@oracle.com> |
---|---|
date | Tue, 04 Jun 2013 17:14:51 +0200 |
parents | 477fb9a9a06d |
children | ed86945795d5 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java make/build-graal.xml |
diffstat | 3 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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); }
--- 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);
--- 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 @@ <provider classname="com.oracle.graal.compiler.GraalDebugConfig_SummarizeDebugValues"/> <provider classname="com.oracle.graal.compiler.GraalDebugConfig_SummarizePerPhase"/> <provider classname="com.oracle.graal.compiler.GraalDebugConfig_Time"/> + <provider classname="com.oracle.graal.hotspot.CompilationTask_SlowQueueCutoff"/> + <provider classname="com.oracle.graal.hotspot.bridge.VMToCompilerImpl_BenchmarkDynamicCounters"/> + <provider classname="com.oracle.graal.hotspot.bridge.VMToCompilerImpl_GenericDynamicCounters"/> + <provider classname="com.oracle.graal.hotspot.bridge.VMToCompilerImpl_LogFile"/> + <provider classname="com.oracle.graal.hotspot.bridge.VMToCompilerImpl_PrintQueue"/> + <provider classname="com.oracle.graal.hotspot.bridge.VMToCompilerImpl_PriorityCompileQueue"/> + <provider classname="com.oracle.graal.hotspot.bridge.VMToCompilerImpl_SlowCompileThreads"/> + <provider classname="com.oracle.graal.hotspot.bridge.VMToCompilerImpl_Threads"/> + <provider classname="com.oracle.graal.hotspot.bridge.VMToCompilerImpl_TimedBootstrap"/> </service> <service type="com.oracle.graal.phases.tiers.CompilerConfiguration"> <provider classname="com.oracle.graal.compiler.phases.BasicCompilerConfiguration"/>