changeset 22052:1489392b6469

Truffle: Stop bytecode parsing on a call to CompilerAsserts.neverPartOfCompilation()
author Christian Wimmer <christian.wimmer@oracle.com>
date Mon, 22 Jun 2015 10:33:29 -0700
parents 3c5fab38bef0
children be8ed2908c59
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverPartOfCompilationNode.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java
diffstat 3 files changed, 23 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Mon Jun 22 12:11:55 2015 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Mon Jun 22 10:33:29 2015 -0700
@@ -179,6 +179,7 @@
             } else if (t instanceof Error) {
                 throw (Error) t;
             } else {
+                CompilerDirectives.transferToInterpreter();
                 throw new RuntimeException(t);
             }
         }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverPartOfCompilationNode.java	Mon Jun 22 12:11:55 2015 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverPartOfCompilationNode.java	Mon Jun 22 10:33:29 2015 -0700
@@ -29,10 +29,11 @@
 import com.oracle.graal.nodes.util.*;
 
 @NodeInfo
-public final class NeverPartOfCompilationNode extends AbstractStateSplit implements IterableNodeType {
+public final class NeverPartOfCompilationNode extends ControlSinkNode implements StateSplit, IterableNodeType {
 
     public static final NodeClass<NeverPartOfCompilationNode> TYPE = NodeClass.create(NeverPartOfCompilationNode.class);
     protected final String message;
+    @OptionalInput(InputType.State) protected FrameState stateAfter;
 
     public NeverPartOfCompilationNode(String message) {
         super(TYPE, StampFactory.forVoid());
@@ -43,6 +44,20 @@
         return message;
     }
 
+    public FrameState stateAfter() {
+        return stateAfter;
+    }
+
+    public void setStateAfter(FrameState x) {
+        assert x == null || x.isAlive() : "frame state must be in a graph";
+        updateUsages(stateAfter, x);
+        stateAfter = x;
+    }
+
+    public boolean hasSideEffect() {
+        return true;
+    }
+
     public static void verifyNotFoundIn(final StructuredGraph graph) {
         for (NeverPartOfCompilationNode neverPartOfCompilationNode : graph.getNodes(NeverPartOfCompilationNode.TYPE)) {
             Throwable exception = new VerificationError(neverPartOfCompilationNode.getMessage());
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java	Mon Jun 22 12:11:55 2015 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java	Mon Jun 22 10:33:29 2015 -0700
@@ -242,14 +242,18 @@
                 }
             }
         });
+        r.register0("neverPartOfCompilation", new InvocationPlugin() {
+            public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
+                b.add(new NeverPartOfCompilationNode("CompilerAsserts.neverPartOfCompilation()"));
+                return true;
+            }
+        });
         r.register1("neverPartOfCompilation", String.class, new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode message) {
                 if (message.isConstant()) {
                     String messageString = message.asConstant().toValueString();
                     b.add(new NeverPartOfCompilationNode(messageString));
                     return true;
-                } else if (canDelayIntrinsification) {
-                    return false;
                 } else {
                     throw b.bailout("message for never part of compilation is non-constant");
                 }