diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java @ 11312:f0c8303cf88e

Restructure Truffle API node intrinsics and introduce new intrinsics for type system modelling.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 16 Aug 2013 01:09:03 +0200
parents da412706d0fd
children 760e838b3560
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java	Fri Aug 16 00:29:30 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java	Fri Aug 16 01:09:03 2013 +0200
@@ -145,10 +145,9 @@
      * @param clazz the specified type of the value
      * @return the value
      */
-    @SuppressWarnings("unchecked")
     @Unsafe
     public static <T> T unsafeCast(Object value, Class<T> clazz) {
-        return (T) value;
+        return unsafeCast(value, clazz, null);
     }
 
     /**
@@ -172,28 +171,30 @@
      * @param customType the custom type that if present on a value makes this unsafe cast safe
      * @return the value
      */
+    @SuppressWarnings("unchecked")
     @Unsafe
     public static <T> T unsafeCast(Object value, Class<T> clazz, Object customType) {
-        return unsafeCast(value, clazz);
+        return (T) value;
     }
 
     /**
-     * Proxies a sun.misc.Unsafe instance into an instance that adds a custom location identity on
-     * its accesses. This means that the accesses on these kind of location identities can only
-     * alias among themselves. It also allows to specify a custom type for the receiver values of
-     * follow-up unsafe accesses. Both the custom type and the location identity must evaluate to a
-     * constant. Furthermore, you should use the new sun.misc.Unsafe instance immediately for one
-     * read or write access via a sun.misc.Unsafe method and not store it anywhere.
+     * Proxies an object instance into an instance that adds a custom location identity on its
+     * accesses via sun.misc.Unsafe. This means that the accesses on these kind of location
+     * identities can only alias among themselves. It also allows to specify a custom type for the
+     * receiver values of follow-up unsafe accesses. Both the custom type and the location identity
+     * must evaluate to a constant. Furthermore, you should use the proxied receiver object
+     * immediately for one read or write access via a sun.misc.Unsafe method and not store it
+     * anywhere.
      * 
-     * @param unsafe the instance of sun.misc.Unsafe
+     * @param receiver the object that is accessed via sun.misc.Unsafe
      * @param customType the expected type of the receiver object of follow-up unsafe accesses
      * @param locationIdentity the location identity token that can be used for improved global
      *            value numbering or null
      * @return the accessed value
      */
     @Unsafe
-    public static sun.misc.Unsafe unsafeCustomization(sun.misc.Unsafe unsafe, Object customType, Object locationIdentity) {
-        return unsafe;
+    public static Object unsafeCustomization(Object receiver, Object customType, Object locationIdentity) {
+        return receiver;
     }
 
     /**