Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java @ 10649:ac8b195fd3aa
New unsafe cast CompilerDirectives method in Truffle API.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 07 Jul 2013 23:51:52 +0200 |
parents | 0fccad3ce40d |
children | b6e46324233f |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java Sun Jul 07 23:32:05 2013 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java Sun Jul 07 23:51:52 2013 +0200 @@ -126,4 +126,16 @@ @Target({ElementType.METHOD}) public @interface Unsafe { } + + /** + * Treats the given value as a value of the given class. The class must evaluate to a constant. + * + * @param value the value that is known to have the specified type + * @param clazz the specified type of the value + * @return the value + */ + @Unsafe + public static Object unsafeCast(Object value, Class clazz) { + return value; + } }