# HG changeset patch # User Christian Wimmer # Date 1434994409 25200 # Node ID 1489392b6469405e7d3a73aea13e8614d16290ab # Parent 3c5fab38bef0ad8040d89918f8c47b241de22f40 Truffle: Stop bytecode parsing on a call to CompilerAsserts.neverPartOfCompilation() diff -r 3c5fab38bef0 -r 1489392b6469 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java --- 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); } } diff -r 3c5fab38bef0 -r 1489392b6469 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverPartOfCompilationNode.java --- 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 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()); diff -r 3c5fab38bef0 -r 1489392b6469 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java --- 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"); }