# HG changeset patch # User Roland Schatz # Date 1442478443 -7200 # Node ID 425950fdcccb518839baab54becbe3e77139ec28 # Parent ec96f33a101dbd76da419ce1d2f0ed70b983966c Use arrayIndexScale instead of element size to calculate memory consumption of arrays. diff -r ec96f33a101d -r 425950fdcccb jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaAccessProvider.java --- 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);