# HG changeset patch # User Andreas Woess # Date 1443614710 -7200 # Node ID 863f7bb5f6452978c3e1345b9d46fbbe620ef119 # Parent 3a96086cf698ef5af424e7f52cd098d229a5a918 add CompilerDirectives.isPartialEvaluationConstant as the counterpart to CompilerAsserts.partialEvaluationConstant diff -r 3a96086cf698 -r 863f7bb5f645 truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java --- 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 true. + * + * @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. *