# HG changeset patch # User Thomas Wuerthinger # Date 1397822519 -7200 # Node ID df724f63f77634e8c25df08fd8b7321b146483ab # Parent 735147ef017692e13250838d442bd498bc6295a3 Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter(). diff -r 735147ef0176 -r df724f63f776 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/CompilerDirectivesSubstitutions.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/CompilerDirectivesSubstitutions.java Fri Apr 18 02:13:14 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/CompilerDirectivesSubstitutions.java Fri Apr 18 14:01:59 2014 +0200 @@ -55,6 +55,11 @@ } @MethodSubstitution + public static boolean inCompiledCode() { + return true; + } + + @MethodSubstitution public static void interpreterOnly(@SuppressWarnings("unused") Runnable runnable) { } diff -r 735147ef0176 -r df724f63f776 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java Fri Apr 18 02:13:14 2014 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java Fri Apr 18 14:01:59 2014 +0200 @@ -84,6 +84,15 @@ } /** + * Returns a boolean value indicating whether the method is executed in the compiled code. + * + * @return {@code false} when executed in the interpreter, {@code true} in compiled code. + */ + public static boolean inCompiledCode() { + return false; + } + + /** * Directive for the compiler that the given runnable should only be executed in the interpreter * and ignored in the compiled code. *