Mercurial > hg > truffle
diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java @ 19521:9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 20 Feb 2015 13:58:56 +0100 |
parents | c386ace07981 |
children |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java Fri Feb 20 01:15:31 2015 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java Fri Feb 20 13:58:56 2015 +0100 @@ -80,33 +80,20 @@ /** * Returns a boolean indicating whether or not a given value is seen as constant in optimized * code. If this method is called in the interpreter this method will always return - * <code>false</code>. This API may be used in combination with {@link #inCompiledCode()} to - * implement compilation constant assertions in the following way: - * - * <pre> - * <code> - * void assertCompilationConstant(Object value) { - * if (inCompiledCode()) { - * if (!isCompilationConstant(value)) { - * throw new AssertionError("Given value is not constant"); - * } - * } - * } - * </code> - * </pre> + * <code>true</code>. * * Note that optimizations that a compiler will apply to code that is conditional on * <code>isCompilationConstant</code> may be limited. For this reason * <code>isCompilationConstant</code> is not recommended for use to select between alternate * implementations of functionality depending on whether a value is constant. Instead, it is - * intended for use as a diagnostic mechanism, such as illustrated above. + * intended for use as a diagnostic mechanism. * * @param value * @return {@code true} when given value is seen as compilation constant, {@code false} if not * compilation constant. */ public static boolean isCompilationConstant(Object value) { - return false; + return CompilerDirectives.inInterpreter(); } /**