changeset 22570:425950fdcccb

Use arrayIndexScale instead of element size to calculate memory consumption of arrays.
author Roland Schatz <roland.schatz@oracle.com>
date Thu, 17 Sep 2015 10:27:23 +0200
parents ec96f33a101d
children 8dddd3b5ff37
files jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaAccessProvider.java
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaAccessProvider.java	Wed Sep 16 13:40:05 2015 +0200
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaAccessProvider.java	Thu Sep 17 10:27:23 2015 +0200
@@ -23,6 +23,7 @@
 package jdk.internal.jvmci.hotspot;
 
 import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
+import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale;
 import static jdk.internal.jvmci.hotspot.HotSpotResolvedObjectTypeImpl.fromObjectClass;
 import static jdk.internal.jvmci.hotspot.UnsafeAccess.UNSAFE;
 
@@ -310,7 +311,7 @@
                     JavaKind elementKind = elementType.getJavaKind();
                     final int headerSize = getArrayBaseOffset(elementKind);
                     TargetDescription target = runtime.getHostJVMCIBackend().getTarget();
-                    int sizeOfElement = target.getSizeInBytes(elementKind);
+                    int sizeOfElement = getArrayIndexScale(elementKind);
                     int alignment = target.wordSize;
                     int log2ElementSize = CodeUtil.log2(sizeOfElement);
                     return computeArrayAllocationSize(length, alignment, headerSize, log2ElementSize);