changeset 12464:59ce8d220e11

replaced HotSpotGraalRuntime.wordKind with an access via the host backend (GRAAL-363)
author Doug Simon <doug.simon@oracle.com>
date Thu, 17 Oct 2013 10:09:02 +0200
parents 3661954321aa
children 9c35e2cef4a2
files graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkage.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java
diffstat 4 files changed, 9 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java	Thu Oct 17 09:58:17 2013 +0200
+++ b/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java	Thu Oct 17 10:09:02 2013 +0200
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.asm.sparc;
 
+import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.sparc.*;
 
 /**
@@ -1269,7 +1269,7 @@
 
         Icc(0b00, "icc"),
         Xcc(0b10, "xcc"),
-        Ptrcc(HotSpotGraalRuntime.wordKind() == Kind.Long ? Xcc.getValue() : Icc.getValue(), "ptrcc"),
+        Ptrcc(getHostWordKind() == Kind.Long ? Xcc.getValue() : Icc.getValue(), "ptrcc"),
         Fcc0(0b00, "fcc0"),
         Fcc1(0b01, "fcc1"),
         Fcc2(0b10, "fcc2"),
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkage.java	Thu Oct 17 09:58:17 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkage.java	Thu Oct 17 10:09:02 2013 +0200
@@ -149,7 +149,7 @@
 
     private static JavaType asJavaType(Class type, MetaAccessProvider metaAccess) {
         if (WordBase.class.isAssignableFrom(type)) {
-            return metaAccess.lookupJavaType(wordKind().toJavaClass());
+            return metaAccess.lookupJavaType(getHostWordKind().toJavaClass());
         } else {
             return metaAccess.lookupJavaType(type);
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Thu Oct 17 09:58:17 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Thu Oct 17 10:09:02 2013 +0200
@@ -135,21 +135,18 @@
         }
     }
 
-    private static Kind wordKind;
-
     /**
-     * Gets the kind of a word value.
+     * Gets the kind of a word value on the {@linkplain #getHostBackend() host} backend.
      */
-    public static Kind wordKind() {
-        assert wordKind != null;
-        return wordKind;
+    public static Kind getHostWordKind() {
+        return instance.getHostBackend().getTarget().wordKind;
     }
 
     /**
      * Reads a word value from a given address.
      */
     public static long unsafeReadWord(long address) {
-        if (wordKind == Kind.Long) {
+        if (getHostWordKind() == Kind.Long) {
             return unsafe.getLong(address);
         }
         return unsafe.getInt(address);
@@ -166,7 +163,7 @@
      * Reads a word value from a given object.
      */
     public static long unsafeReadWord(Object object, long offset) {
-        if (wordKind == Kind.Long) {
+        if (getHostWordKind() == Kind.Long) {
             return unsafe.getLong(object, offset);
         }
         return unsafe.getInt(object, offset);
@@ -227,9 +224,6 @@
             backends.put(factory.getArchitecture(), factory.createBackend(this, hostBackend));
         }
 
-        assert wordKind == null || wordKind.equals(hostBackend.getTarget().wordKind);
-        wordKind = hostBackend.getTarget().wordKind;
-
         GraalOptions.StackShadowPages.setValue(config.stackShadowPages);
         if (GraalOptions.CacheGraphs.getValue()) {
             cache = new HotSpotGraphCache();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Thu Oct 17 09:58:17 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Thu Oct 17 10:09:02 2013 +0200
@@ -113,7 +113,7 @@
      * Gets the address of the C++ Method object for this method.
      */
     public Constant getMetaspaceMethodConstant() {
-        return Constant.forIntegerKind(wordKind(), metaspaceMethod, this);
+        return Constant.forIntegerKind(getHostWordKind(), metaspaceMethod, this);
     }
 
     @Override