changeset 22555:2fe06375f2d3

made HotSpotJVMCIRuntimeProvider.getArrayBaseOffset and HotSpotJVMCIRuntimeProvider.getArrayIndexScale static
author Doug Simon <doug.simon@oracle.com>
date Mon, 14 Sep 2015 16:25:07 +0200
parents f9f6d683c1d5
children 6821ef65ef4c
files jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotConstantReflectionProvider.java jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntimeProvider.java jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaAccessProvider.java
diffstat 3 files changed, 24 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotConstantReflectionProvider.java	Mon Sep 14 08:47:57 2015 +0200
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotConstantReflectionProvider.java	Mon Sep 14 16:25:07 2015 +0200
@@ -22,12 +22,25 @@
  */
 package jdk.internal.jvmci.hotspot;
 
-import static jdk.internal.jvmci.hotspot.HotSpotConstantReflectionProvider.Options.*;
+import static jdk.internal.jvmci.hotspot.HotSpotConstantReflectionProvider.Options.TrustFinalDefaultFields;
+import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
+import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale;
+
+import java.lang.reflect.Array;
 
-import java.lang.reflect.*;
-
-import jdk.internal.jvmci.meta.*;
-import jdk.internal.jvmci.options.*;
+import jdk.internal.jvmci.meta.Constant;
+import jdk.internal.jvmci.meta.ConstantReflectionProvider;
+import jdk.internal.jvmci.meta.JavaConstant;
+import jdk.internal.jvmci.meta.JavaField;
+import jdk.internal.jvmci.meta.JavaKind;
+import jdk.internal.jvmci.meta.JavaType;
+import jdk.internal.jvmci.meta.MemoryAccessProvider;
+import jdk.internal.jvmci.meta.MethodHandleAccessProvider;
+import jdk.internal.jvmci.meta.ResolvedJavaType;
+import jdk.internal.jvmci.options.Option;
+import jdk.internal.jvmci.options.OptionType;
+import jdk.internal.jvmci.options.OptionValue;
+import jdk.internal.jvmci.options.StableOptionValue;
 
 /**
  * HotSpot implementation of {@link ConstantReflectionProvider}.
@@ -105,8 +118,8 @@
         }
         Class<?> componentType = ((HotSpotObjectConstantImpl) array).object().getClass().getComponentType();
         JavaKind kind = runtime.getHostJVMCIBackend().getMetaAccess().lookupJavaType(componentType).getJavaKind();
-        int arraybase = runtime.getArrayBaseOffset(kind);
-        int scale = runtime.getArrayIndexScale(kind);
+        int arraybase = getArrayBaseOffset(kind);
+        int scale = getArrayIndexScale(kind);
         if (offset < arraybase) {
             return -1;
         }
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntimeProvider.java	Mon Sep 14 08:47:57 2015 +0200
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntimeProvider.java	Mon Sep 14 16:25:07 2015 +0200
@@ -70,7 +70,7 @@
      *
      * @return the offset in bytes
      */
-    default int getArrayBaseOffset(JavaKind kind) {
+    static int getArrayBaseOffset(JavaKind kind) {
         switch (kind) {
             case Boolean:
                 return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET;
@@ -100,7 +100,7 @@
      *
      * @return the scale in order to convert the index into a byte offset
      */
-    default int getArrayIndexScale(JavaKind kind) {
+    static int getArrayIndexScale(JavaKind kind) {
         switch (kind) {
             case Boolean:
                 return Unsafe.ARRAY_BOOLEAN_INDEX_SCALE;
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaAccessProvider.java	Mon Sep 14 08:47:57 2015 +0200
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaAccessProvider.java	Mon Sep 14 16:25:07 2015 +0200
@@ -22,6 +22,7 @@
  */
 package jdk.internal.jvmci.hotspot;
 
+import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
 import static jdk.internal.jvmci.hotspot.HotSpotResolvedObjectTypeImpl.*;
 import static jdk.internal.jvmci.hotspot.UnsafeAccess.UNSAFE;
 
@@ -292,7 +293,7 @@
                     int length = Array.getLength(((HotSpotObjectConstantImpl) constant).object());
                     ResolvedJavaType elementType = lookupJavaType.getComponentType();
                     JavaKind elementKind = elementType.getJavaKind();
-                    final int headerSize = runtime.getArrayBaseOffset(elementKind);
+                    final int headerSize = getArrayBaseOffset(elementKind);
                     TargetDescription target = runtime.getHostJVMCIBackend().getTarget();
                     int sizeOfElement = target.getSizeInBytes(elementKind);
                     int alignment = target.wordSize;