changeset 19340:60ec7b23b7af

Rename ClassSubstitutions to HotSpotClassSubstitutions
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 12 Feb 2015 15:00:00 -0800
parents ba7bd60a8744
children 5eb28dbbeb37
files graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassCastNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetClassLoader0Node.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetModifiersNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsArrayNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsAssignableFromNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInstanceNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInterfaceNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsPrimitiveNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassSubstitutions.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompilerToVMImplSubstitutions.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotClassSubstitutions.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java
diffstat 15 files changed, 179 insertions(+), 179 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java	Thu Feb 12 23:28:47 2015 +0100
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java	Thu Feb 12 15:00:00 2015 -0800
@@ -75,14 +75,14 @@
         test("getComponentType");
 
         for (Class<?> c : new Class[]{getClass(), Cloneable.class, int[].class, String[][].class}) {
-            assertDeepEquals(c.getModifiers(), ClassSubstitutions.getModifiers(c));
-            assertDeepEquals(c.isInterface(), ClassSubstitutions.isInterface(c));
-            assertDeepEquals(c.isArray(), ClassSubstitutions.isArray(c));
-            assertDeepEquals(c.isPrimitive(), ClassSubstitutions.isPrimitive(c));
-            assertDeepEquals(c.getSuperclass(), ClassSubstitutions.getSuperclass(c));
-            assertDeepEquals(c.getComponentType(), ClassSubstitutions.getComponentType(c));
+            assertDeepEquals(c.getModifiers(), HotSpotClassSubstitutions.getModifiers(c));
+            assertDeepEquals(c.isInterface(), HotSpotClassSubstitutions.isInterface(c));
+            assertDeepEquals(c.isArray(), HotSpotClassSubstitutions.isArray(c));
+            assertDeepEquals(c.isPrimitive(), HotSpotClassSubstitutions.isPrimitive(c));
+            assertDeepEquals(c.getSuperclass(), HotSpotClassSubstitutions.getSuperclass(c));
+            assertDeepEquals(c.getComponentType(), HotSpotClassSubstitutions.getComponentType(c));
             for (Object o : new Object[]{this, new int[5], new String[2][], new Object()}) {
-                assertDeepEquals(c.isInstance(o), ClassSubstitutions.isInstance(c, o));
+                assertDeepEquals(c.isInstance(o), HotSpotClassSubstitutions.isInstance(c, o));
             }
         }
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassCastNode.java	Thu Feb 12 23:28:47 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassCastNode.java	Thu Feb 12 15:00:00 2015 -0800
@@ -33,7 +33,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#cast(Object)}.
  *
- * @see ClassSubstitutions#cast(Class, Object)
+ * @see HotSpotClassSubstitutions#cast(Class, Object)
  */
 @NodeInfo
 public final class ClassCastNode extends MacroStateSplitNode implements Canonicalizable.Binary<ValueNode> {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetClassLoader0Node.java	Thu Feb 12 23:28:47 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetClassLoader0Node.java	Thu Feb 12 15:00:00 2015 -0800
@@ -34,7 +34,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#getClassLoader0()}.
  *
- * @see ClassSubstitutions#getClassLoader0(Class)
+ * @see HotSpotClassSubstitutions#getClassLoader0(Class)
  */
 @SuppressWarnings("javadoc")
 @NodeInfo
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java	Thu Feb 12 23:28:47 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java	Thu Feb 12 15:00:00 2015 -0800
@@ -34,7 +34,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#getComponentType()}.
  *
- * @see ClassSubstitutions#getComponentType(Class)
+ * @see HotSpotClassSubstitutions#getComponentType(Class)
  */
 @NodeInfo
 public final class ClassGetComponentTypeNode extends MacroNode implements Canonicalizable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetModifiersNode.java	Thu Feb 12 23:28:47 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetModifiersNode.java	Thu Feb 12 15:00:00 2015 -0800
@@ -33,7 +33,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#getModifiers()}.
  *
- * @see ClassSubstitutions#getModifiers(Class)
+ * @see HotSpotClassSubstitutions#getModifiers(Class)
  */
 @NodeInfo
 public final class ClassGetModifiersNode extends MacroNode implements Canonicalizable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java	Thu Feb 12 23:28:47 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java	Thu Feb 12 15:00:00 2015 -0800
@@ -34,7 +34,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#getSuperclass()}.
  *
- * @see ClassSubstitutions#getSuperclass(Class)
+ * @see HotSpotClassSubstitutions#getSuperclass(Class)
  */
 @NodeInfo
 public final class ClassGetSuperclassNode extends MacroNode implements Canonicalizable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsArrayNode.java	Thu Feb 12 23:28:47 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsArrayNode.java	Thu Feb 12 15:00:00 2015 -0800
@@ -33,7 +33,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#isArray()}.
  *
- * @see ClassSubstitutions#isArray(Class)
+ * @see HotSpotClassSubstitutions#isArray(Class)
  */
 @NodeInfo
 public final class ClassIsArrayNode extends MacroNode implements Canonicalizable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsAssignableFromNode.java	Thu Feb 12 23:28:47 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsAssignableFromNode.java	Thu Feb 12 15:00:00 2015 -0800
@@ -33,7 +33,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#isAssignableFrom(Class)}.
  *
- * @see ClassSubstitutions#isAssignableFrom(Class, Class)
+ * @see HotSpotClassSubstitutions#isAssignableFrom(Class, Class)
  */
 @NodeInfo
 public final class ClassIsAssignableFromNode extends MacroStateSplitNode implements Canonicalizable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInstanceNode.java	Thu Feb 12 23:28:47 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInstanceNode.java	Thu Feb 12 15:00:00 2015 -0800
@@ -35,7 +35,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#isInstance(Object)}.
  *
- * @see ClassSubstitutions#isInstance(Class, Object)
+ * @see HotSpotClassSubstitutions#isInstance(Class, Object)
  */
 @NodeInfo
 public final class ClassIsInstanceNode extends MacroNode implements Canonicalizable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInterfaceNode.java	Thu Feb 12 23:28:47 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInterfaceNode.java	Thu Feb 12 15:00:00 2015 -0800
@@ -33,7 +33,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#isInterface()}.
  *
- * @see ClassSubstitutions#isInterface(Class)
+ * @see HotSpotClassSubstitutions#isInterface(Class)
  */
 @NodeInfo
 public final class ClassIsInterfaceNode extends MacroNode implements Canonicalizable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsPrimitiveNode.java	Thu Feb 12 23:28:47 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsPrimitiveNode.java	Thu Feb 12 15:00:00 2015 -0800
@@ -33,7 +33,7 @@
 /**
  * {@link MacroNode Macro node} for {@link Class#isPrimitive()}.
  *
- * @see ClassSubstitutions#isPrimitive(Class)
+ * @see HotSpotClassSubstitutions#isPrimitive(Class)
  */
 @NodeInfo
 public final class ClassIsPrimitiveNode extends MacroNode implements Canonicalizable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassSubstitutions.java	Thu Feb 12 23:28:47 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.replacements;
-
-import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
-import static com.oracle.graal.nodes.PiNode.*;
-
-import java.lang.reflect.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.hotspot.nodes.*;
-import com.oracle.graal.hotspot.word.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.calc.*;
-import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.word.*;
-
-/**
- * Substitutions for {@link java.lang.Class} methods.
- */
-@ClassSubstitution(java.lang.Class.class)
-public class ClassSubstitutions {
-
-    @MacroSubstitution(macro = ClassGetModifiersNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static int getModifiers(final Class<?> thisObj) {
-        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
-        if (klass.isNull()) {
-            // Class for primitive type
-            return Modifier.ABSTRACT | Modifier.FINAL | Modifier.PUBLIC;
-        } else {
-            return klass.readInt(klassModifierFlagsOffset(), KLASS_MODIFIER_FLAGS_LOCATION);
-        }
-    }
-
-    // This MacroSubstitution should be removed once non-null klass pointers can be optimized
-    @MacroSubstitution(macro = ClassIsInterfaceNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static boolean isInterface(final Class<?> thisObj) {
-        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
-        if (klass.isNull()) {
-            return false;
-        } else {
-            int accessFlags = klass.readInt(klassAccessFlagsOffset(), KLASS_ACCESS_FLAGS_LOCATION);
-            return (accessFlags & Modifier.INTERFACE) != 0;
-        }
-    }
-
-    // This MacroSubstitution should be removed once non-null klass pointers can be optimized
-    @MacroSubstitution(macro = ClassIsArrayNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static boolean isArray(final Class<?> thisObj) {
-        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
-        if (klass.isNull()) {
-            return false;
-        } else {
-            return klassIsArray(klass);
-        }
-    }
-
-    // This MacroSubstitution should be removed once non-null klass pointers can be optimized
-    @MacroSubstitution(macro = ClassIsPrimitiveNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static boolean isPrimitive(final Class<?> thisObj) {
-        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
-        return klass.isNull();
-    }
-
-    @MacroSubstitution(macro = ClassGetClassLoader0Node.class, isStatic = false)
-    public static native ClassLoader getClassLoader0(Class<?> thisObj);
-
-    @MacroSubstitution(macro = ClassGetSuperclassNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false)
-    public static Class<?> getSuperclass(final Class<?> thisObj) {
-        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
-        if (!klass.isNull()) {
-            int accessFlags = klass.readInt(klassAccessFlagsOffset(), KLASS_ACCESS_FLAGS_LOCATION);
-            if ((accessFlags & Modifier.INTERFACE) == 0) {
-                if (klassIsArray(klass)) {
-                    return Object.class;
-                } else {
-                    Word superKlass = klass.readWord(klassSuperKlassOffset(), KLASS_SUPER_KLASS_LOCATION);
-                    if (superKlass.equal(0)) {
-                        return null;
-                    } else {
-                        return readJavaMirror(superKlass);
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    public static Class<?> readJavaMirror(Word klass) {
-        return piCastExactNonNull(klass.readObject(classMirrorOffset(), CLASS_MIRROR_LOCATION), Class.class);
-    }
-
-    @MacroSubstitution(macro = ClassGetComponentTypeNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false)
-    public static Class<?> getComponentType(final Class<?> thisObj) {
-        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
-        if (!klass.isNull()) {
-            if (klassIsArray(klass)) {
-                return piCastExactNonNull(klass.readObject(arrayKlassComponentMirrorOffset(), ARRAY_KLASS_COMPONENT_MIRROR), Class.class);
-            }
-        }
-        return null;
-    }
-
-    @MacroSubstitution(macro = ClassIsInstanceNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false)
-    public static boolean isInstance(Class<?> thisObj, Object obj) {
-        return ConditionalNode.materializeIsInstance(thisObj, obj);
-    }
-
-    @MacroSubstitution(macro = ClassIsAssignableFromNode.class, isStatic = false)
-    @MethodSubstitution(isStatic = false)
-    public static boolean isAssignableFrom(Class<?> thisClass, Class<?> otherClass) {
-        if (BranchProbabilityNode.probability(BranchProbabilityNode.NOT_LIKELY_PROBABILITY, otherClass == null)) {
-            DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.NullCheckException);
-            return false;
-        }
-        GuardingNode anchorNode = SnippetAnchorNode.anchor();
-        KlassPointer thisHub = ClassGetHubNode.readClass(thisClass, anchorNode);
-        KlassPointer otherHub = ClassGetHubNode.readClass(otherClass, anchorNode);
-        if (thisHub.isNull() || otherHub.isNull()) {
-            // primitive types, only true if equal.
-            return thisClass == otherClass;
-        }
-        if (!TypeCheckSnippetUtils.checkUnknownSubType(thisHub, otherHub)) {
-            return false;
-        }
-        return true;
-    }
-
-    @MacroSubstitution(macro = ClassCastNode.class, isStatic = false)
-    public static native Object cast(final Class<?> thisObj, Object obj);
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompilerToVMImplSubstitutions.java	Thu Feb 12 23:28:47 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompilerToVMImplSubstitutions.java	Thu Feb 12 15:00:00 2015 -0800
@@ -34,6 +34,6 @@
 
     @MethodSubstitution(isStatic = false)
     public static Class<?> getJavaMirror(@SuppressWarnings("unused") CompilerToVMImpl impl, long metaspaceklass) {
-        return ClassSubstitutions.readJavaMirror(Word.unsigned(metaspaceklass));
+        return HotSpotClassSubstitutions.readJavaMirror(Word.unsigned(metaspaceklass));
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotClassSubstitutions.java	Thu Feb 12 15:00:00 2015 -0800
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.hotspot.replacements;
+
+import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
+import static com.oracle.graal.nodes.PiNode.*;
+
+import java.lang.reflect.*;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.api.replacements.*;
+import com.oracle.graal.hotspot.nodes.*;
+import com.oracle.graal.hotspot.word.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.calc.*;
+import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.word.*;
+
+/**
+ * Substitutions for {@link java.lang.Class} methods.
+ */
+@ClassSubstitution(java.lang.Class.class)
+public class HotSpotClassSubstitutions {
+
+    @MacroSubstitution(macro = ClassGetModifiersNode.class, isStatic = false)
+    @MethodSubstitution(isStatic = false, forced = true)
+    public static int getModifiers(final Class<?> thisObj) {
+        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
+        if (klass.isNull()) {
+            // Class for primitive type
+            return Modifier.ABSTRACT | Modifier.FINAL | Modifier.PUBLIC;
+        } else {
+            return klass.readInt(klassModifierFlagsOffset(), KLASS_MODIFIER_FLAGS_LOCATION);
+        }
+    }
+
+    // This MacroSubstitution should be removed once non-null klass pointers can be optimized
+    @MacroSubstitution(macro = ClassIsInterfaceNode.class, isStatic = false)
+    @MethodSubstitution(isStatic = false, forced = true)
+    public static boolean isInterface(final Class<?> thisObj) {
+        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
+        if (klass.isNull()) {
+            return false;
+        } else {
+            int accessFlags = klass.readInt(klassAccessFlagsOffset(), KLASS_ACCESS_FLAGS_LOCATION);
+            return (accessFlags & Modifier.INTERFACE) != 0;
+        }
+    }
+
+    // This MacroSubstitution should be removed once non-null klass pointers can be optimized
+    @MacroSubstitution(macro = ClassIsArrayNode.class, isStatic = false)
+    @MethodSubstitution(isStatic = false, forced = true)
+    public static boolean isArray(final Class<?> thisObj) {
+        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
+        if (klass.isNull()) {
+            return false;
+        } else {
+            return klassIsArray(klass);
+        }
+    }
+
+    // This MacroSubstitution should be removed once non-null klass pointers can be optimized
+    @MacroSubstitution(macro = ClassIsPrimitiveNode.class, isStatic = false)
+    @MethodSubstitution(isStatic = false, forced = true)
+    public static boolean isPrimitive(final Class<?> thisObj) {
+        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
+        return klass.isNull();
+    }
+
+    @MacroSubstitution(macro = ClassGetClassLoader0Node.class, isStatic = false)
+    public static native ClassLoader getClassLoader0(Class<?> thisObj);
+
+    @MacroSubstitution(macro = ClassGetSuperclassNode.class, isStatic = false)
+    @MethodSubstitution(isStatic = false)
+    public static Class<?> getSuperclass(final Class<?> thisObj) {
+        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
+        if (!klass.isNull()) {
+            int accessFlags = klass.readInt(klassAccessFlagsOffset(), KLASS_ACCESS_FLAGS_LOCATION);
+            if ((accessFlags & Modifier.INTERFACE) == 0) {
+                if (klassIsArray(klass)) {
+                    return Object.class;
+                } else {
+                    Word superKlass = klass.readWord(klassSuperKlassOffset(), KLASS_SUPER_KLASS_LOCATION);
+                    if (superKlass.equal(0)) {
+                        return null;
+                    } else {
+                        return readJavaMirror(superKlass);
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    public static Class<?> readJavaMirror(Word klass) {
+        return piCastExactNonNull(klass.readObject(classMirrorOffset(), CLASS_MIRROR_LOCATION), Class.class);
+    }
+
+    @MacroSubstitution(macro = ClassGetComponentTypeNode.class, isStatic = false)
+    @MethodSubstitution(isStatic = false)
+    public static Class<?> getComponentType(final Class<?> thisObj) {
+        KlassPointer klass = ClassGetHubNode.readClass(thisObj);
+        if (!klass.isNull()) {
+            if (klassIsArray(klass)) {
+                return piCastExactNonNull(klass.readObject(arrayKlassComponentMirrorOffset(), ARRAY_KLASS_COMPONENT_MIRROR), Class.class);
+            }
+        }
+        return null;
+    }
+
+    @MacroSubstitution(macro = ClassIsInstanceNode.class, isStatic = false)
+    @MethodSubstitution(isStatic = false)
+    public static boolean isInstance(Class<?> thisObj, Object obj) {
+        return ConditionalNode.materializeIsInstance(thisObj, obj);
+    }
+
+    @MacroSubstitution(macro = ClassIsAssignableFromNode.class, isStatic = false)
+    @MethodSubstitution(isStatic = false)
+    public static boolean isAssignableFrom(Class<?> thisClass, Class<?> otherClass) {
+        if (BranchProbabilityNode.probability(BranchProbabilityNode.NOT_LIKELY_PROBABILITY, otherClass == null)) {
+            DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.NullCheckException);
+            return false;
+        }
+        GuardingNode anchorNode = SnippetAnchorNode.anchor();
+        KlassPointer thisHub = ClassGetHubNode.readClass(thisClass, anchorNode);
+        KlassPointer otherHub = ClassGetHubNode.readClass(otherClass, anchorNode);
+        if (thisHub.isNull() || otherHub.isNull()) {
+            // primitive types, only true if equal.
+            return thisClass == otherClass;
+        }
+        if (!TypeCheckSnippetUtils.checkUnknownSubType(thisHub, otherHub)) {
+            return false;
+        }
+        return true;
+    }
+
+    @MacroSubstitution(macro = ClassCastNode.class, isStatic = false)
+    public static native Object cast(final Class<?> thisObj, Object obj);
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java	Thu Feb 12 23:28:47 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java	Thu Feb 12 15:00:00 2015 -0800
@@ -60,7 +60,7 @@
         replacements.registerSubstitutions(System.class, SystemSubstitutions.class);
         replacements.registerSubstitutions(Thread.class, ThreadSubstitutions.class);
         replacements.registerSubstitutions(Unsafe.class, UnsafeSubstitutions.class);
-        replacements.registerSubstitutions(Class.class, ClassSubstitutions.class);
+        replacements.registerSubstitutions(Class.class, HotSpotClassSubstitutions.class);
         replacements.registerSubstitutions(CRC32.class, CRC32Substitutions.class);
         replacements.registerSubstitutions(Reflection.class, ReflectionSubstitutions.class);
         replacements.registerSubstitutions(NodeClass.class, HotSpotNodeClassSubstitutions.class);