# HG changeset patch # User Andreas Woess # Date 1375983332 -7200 # Node ID f00c85ee46a256a057837d56641a4df28b5713d7 # Parent ac59bdde11945b0010f55bc7c09a6957dbd55b60 Truffle: add CompilerDirectives.inInterpreter() diff -r ac59bdde1194 -r f00c85ee46a2 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 Thu Aug 08 19:28:42 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/CompilerDirectivesSubstitutions.java Thu Aug 08 19:35:32 2013 +0200 @@ -42,6 +42,11 @@ } @MethodSubstitution + public static boolean inInterpreter() { + return false; + } + + @MethodSubstitution public static void interpreterOnly(@SuppressWarnings("unused") Runnable runnable) { } diff -r ac59bdde1194 -r f00c85ee46a2 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 Thu Aug 08 19:28:42 2013 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java Thu Aug 08 19:35:32 2013 +0200 @@ -45,6 +45,15 @@ } /** + * Returns a boolean value indicating whether the method is executed in the interpreter. + * + * @return {@code true} when executed in the interpreter, {@code false} in compiled code. + */ + public static boolean inInterpreter() { + return true; + } + + /** * Directive for the compiler that the given runnable should only be executed in the interpreter * and ignored in the compiled code. *