diff graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ObjectSnippets.java @ 7273:7f6bf286629c

replace checked casts with unsafe casts in snippets where the exact type of a value loaded from metadata is known
author Doug Simon <doug.simon@oracle.com>
date Tue, 18 Dec 2012 17:59:03 +0100
parents 855b2c53543f
children 4f220c85044d
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ObjectSnippets.java	Tue Dec 18 17:58:08 2012 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ObjectSnippets.java	Tue Dec 18 17:59:03 2012 +0100
@@ -23,6 +23,7 @@
 package com.oracle.graal.hotspot.snippets;
 
 import static com.oracle.graal.hotspot.snippets.HotSpotSnippetUtils.*;
+import static com.oracle.graal.nodes.extended.UnsafeCastNode.*;
 
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.snippets.*;
@@ -36,7 +37,7 @@
     @MethodSubstitution(isStatic = false)
     public static Class<?> getClass(final Object thisObj) {
         Word hub = loadHub(thisObj);
-        return (Class<?>) readFinalObject(hub, classMirrorOffset());
+        return unsafeCast(readFinalObject(hub, classMirrorOffset()), Class.class, true, true);
     }
 
     @MethodSubstitution(isStatic = false)