changeset 22736:57f6a07be900

Truffle: intrinsify CompilerDirectives.isPartialEvaluationConstant
author Andreas Woess <andreas.woess@oracle.com>
date Wed, 30 Sep 2015 16:18:18 +0200
parents b21e7985edae
children 5e8c004f5358
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java	Wed Sep 30 17:46:24 2015 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java	Wed Sep 30 16:18:18 2015 +0200
@@ -256,6 +256,18 @@
                 return true;
             }
         });
+        r.register1("isPartialEvaluationConstant", Object.class, new InvocationPlugin() {
+            public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) {
+                if ((value instanceof BoxNode ? ((BoxNode) value).getValue() : value).isConstant()) {
+                    b.addPush(JavaKind.Boolean, ConstantNode.forBoolean(true));
+                } else if (canDelayIntrinsification) {
+                    return false;
+                } else {
+                    b.addPush(JavaKind.Boolean, ConstantNode.forBoolean(false));
+                }
+                return true;
+            }
+        });
         r.register1("materialize", Object.class, new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) {
                 b.add(new ForceMaterializeNode(value));