Mercurial > hg > truffle
changeset 11269:f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Thu, 08 Aug 2013 19:35:32 +0200 |
parents | ac59bdde1194 |
children | 0c908dba44fb 494b818b527c |
files | graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/CompilerDirectivesSubstitutions.java graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java |
diffstat | 2 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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) { }
--- 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. *