# HG changeset patch # User Doug Simon # Date 1417039089 -3600 # Node ID 7484f5fcd41d94c3a094ec506af4a6eee761f9dc # Parent 80a6b4a234187b98bfa1b96b368da27ab0a87839 removed a usages of HotSpotGraalRuntime.unsafeReadWord(); tidied up some comments diff -r 80a6b4a23418 -r 7484f5fcd41d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Wed Nov 26 22:39:03 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Wed Nov 26 22:58:09 2014 +0100 @@ -390,7 +390,7 @@ // If the name represents a primitive type we can short-circuit the lookup. if (name.length() == 1) { Kind kind = Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0)); - return HotSpotResolvedPrimitiveType.fromKind(kind); + return fromClass(kind.toJavaClass()); } // Resolve non-primitive types in the VM. diff -r 80a6b4a23418 -r 7484f5fcd41d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectTypeImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectTypeImpl.java Wed Nov 26 22:39:03 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectTypeImpl.java Wed Nov 26 22:58:09 2014 +0100 @@ -52,7 +52,7 @@ private HotSpotResolvedJavaField[] instanceFields; private HotSpotResolvedObjectTypeImpl[] interfaces; private ConstantPool constantPool; - private HotSpotResolvedObjectTypeImpl arrayOfType; + private HotSpotResolvedObjectType arrayOfType; /** * Gets the Graal mirror for a {@link Class} object. @@ -66,17 +66,6 @@ /** * Gets the Graal mirror from a HotSpot metaspace Klass native object. * - * @param metaspaceKlass a metaspace Klass object boxed in a {@link JavaConstant} - * @return the {@link HotSpotResolvedObjectTypeImpl} corresponding to {@code klassConstant} - */ - public static ResolvedJavaType fromMetaspaceKlass(Constant metaspaceKlass) { - HotSpotMetaspaceConstant klass = (HotSpotMetaspaceConstant) metaspaceKlass; - return klass.asResolvedJavaType(); - } - - /** - * Gets the Graal mirror from a HotSpot metaspace Klass native object. - * * @param metaspaceKlass a metaspace Klass object * @return the {@link ResolvedJavaType} corresponding to {@code metaspaceKlass} */ @@ -92,8 +81,8 @@ * *

* NOTE: Creating an instance of this class does not install the mirror for the - * {@link Class} type. Use {@link #fromObjectClass(Class)}, - * {@link #fromMetaspaceKlass(Constant)} or {@link #fromMetaspaceKlass(long)} instead. + * {@link Class} type. Use {@link #fromObjectClass(Class)} or {@link #fromMetaspaceKlass(long)} + * instead. *

* * @param javaClass the Class to create the mirror for @@ -118,7 +107,10 @@ * Gets the metaspace Klass for this type. */ public long getMetaspaceKlass() { - return HotSpotGraalRuntime.unsafeReadWord(javaClass, runtime().getConfig().klassOffset); + if (HotSpotGraalRuntime.getHostWordKind() == Kind.Long) { + return unsafe.getLong(javaClass, (long) runtime().getConfig().klassOffset); + } + return unsafe.getInt(javaClass, (long) runtime().getConfig().klassOffset) & 0xFFFFFFFFL; } @Override @@ -169,7 +161,7 @@ HotSpotResolvedObjectTypeImpl type = this; while (type.isAbstract()) { long subklass = type.getSubklass(); - if (subklass == 0 || unsafeReadWord(subklass + config.nextSiblingOffset) != 0) { + if (subklass == 0 || unsafe.getAddress(subklass + config.nextSiblingOffset) != 0) { return null; } type = fromMetaspaceKlass(subklass); @@ -198,7 +190,7 @@ * @return value of the subklass field as metaspace klass pointer */ private long getSubklass() { - return unsafeReadWord(getMetaspaceKlass() + runtime().getConfig().subklassOffset); + return unsafe.getAddress(getMetaspaceKlass() + runtime().getConfig().subklassOffset); } @Override @@ -791,7 +783,7 @@ if (isArray()) { return config.arrayPrototypeMarkWord(); } else { - return unsafeReadWord(getMetaspaceKlass() + config.prototypeMarkWordOffset); + return unsafe.getAddress(getMetaspaceKlass() + config.prototypeMarkWordOffset); } } diff -r 80a6b4a23418 -r 7484f5fcd41d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java Wed Nov 26 22:39:03 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java Wed Nov 26 22:58:09 2014 +0100 @@ -40,21 +40,11 @@ private final Kind kind; /** - * Gets the Graal mirror for a {@link Kind}. - * - * @return the {@link HotSpotResolvedObjectTypeImpl} corresponding to {@code kind} - */ - public static ResolvedJavaType fromKind(Kind kind) { - Class javaClass = kind.toJavaClass(); - return fromClass(javaClass); - } - - /** * Creates the Graal mirror for a primitive {@link Kind}. * *

* NOTE: Creating an instance of this class does not install the mirror for the - * {@link Class} type. Use {@link #fromKind(Kind)} or {@link #fromClass(Class)} instead. + * {@link Class} type. Use {@link #fromClass(Class)} instead. *

* * @param kind the Kind to create the mirror for