Mercurial > hg > truffle
changeset 22211:863f7bb5f645
add CompilerDirectives.isPartialEvaluationConstant as the counterpart to CompilerAsserts.partialEvaluationConstant
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Wed, 30 Sep 2015 14:05:10 +0200 |
parents | 3a96086cf698 |
children | 71ec6de11cea |
files | truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java Wed Sep 30 14:25:09 2015 +0200 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java Wed Sep 30 14:05:10 2015 +0200 @@ -101,6 +101,19 @@ } /** + * Returns a boolean indicating whether or not a given value is seen as constant during the + * initial partial evaluation phase. If this method is called in the interpreter this method + * will always return <code>true</code>. + * + * @param value + * @return {@code true} when given value is seen as compilation constant, {@code false} if not + * compilation constant. + */ + public static boolean isPartialEvaluationConstant(Object value) { + return CompilerDirectives.inInterpreter(); + } + + /** * Directive for the compiler that the given runnable should only be executed in the interpreter * and ignored in the compiled code. *