# HG changeset patch # User Christian Wimmer # Date 1363660726 25200 # Node ID 5fbb2df2b47fddc158ecbc0e6f8f53464482d30b # Parent 29d44e82b8f797c7df157290926618ee5cee1e87 Allow lowering of UnwindNode and ExceptionObjectNode. The HotSpot code still uses the old LIR lowering. diff -r 29d44e82b8f7 -r 5fbb2df2b47f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Mon Mar 18 19:34:04 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Mon Mar 18 19:38:46 2013 -0700 @@ -739,6 +739,8 @@ } else if (n instanceof IntegerDivNode || n instanceof IntegerRemNode || n instanceof UnsignedDivNode || n instanceof UnsignedRemNode) { // Nothing to do for division nodes. The HotSpot signal handler catches divisions by // zero and the MIN_VALUE / -1 cases. + } else if (n instanceof UnwindNode || n instanceof ExceptionObjectNode) { + // Nothing to do, using direct LIR lowering for these nodes. } else { assert false : "Node implementing Lowerable not handled: " + n; throw GraalInternalError.shouldNotReachHere(); diff -r 29d44e82b8f7 -r 5fbb2df2b47f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Mon Mar 18 19:34:04 2013 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Mon Mar 18 19:38:46 2013 -0700 @@ -31,7 +31,7 @@ * Unwind takes an exception object, destroys the current stack frame and passes the exception * object to the system's exception dispatch code. */ -public final class UnwindNode extends FixedNode implements LIRLowerable, Node.IterableNodeType { +public final class UnwindNode extends FixedNode implements Lowerable, LIRLowerable, Node.IterableNodeType { @Input private ValueNode exception; @@ -49,4 +49,9 @@ public void generate(LIRGeneratorTool gen) { gen.emitUnwind(gen.operand(exception())); } + + @Override + public void lower(LoweringTool tool) { + tool.getRuntime().lower(this, tool); + } } diff -r 29d44e82b8f7 -r 5fbb2df2b47f graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Mon Mar 18 19:34:04 2013 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Mon Mar 18 19:38:46 2013 -0700 @@ -32,7 +32,7 @@ * The {@code ExceptionObject} instruction represents the incoming exception object to an exception * handler. */ -public class ExceptionObjectNode extends AbstractStateSplit implements StateSplit, LIRLowerable, MemoryCheckpoint { +public class ExceptionObjectNode extends AbstractStateSplit implements StateSplit, Lowerable, LIRLowerable, MemoryCheckpoint { /** * Constructs a new ExceptionObject instruction. @@ -52,6 +52,11 @@ } @Override + public void lower(LoweringTool tool) { + tool.getRuntime().lower(this, tool); + } + + @Override public boolean verify() { assertTrue(stateAfter() != null, "an exception handler needs a frame state"); return super.verify(); diff -r 29d44e82b8f7 -r 5fbb2df2b47f graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java Mon Mar 18 19:34:04 2013 -0700 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java Mon Mar 18 19:38:46 2013 -0700 @@ -560,7 +560,7 @@ * @param args the arguments to be bound to the flattened positional parameters of the snippet * @return the map of duplicated nodes (original -> duplicate) */ - public Map instantiate(MetaAccessProvider runtime, FixedWithNextNode replacee, UsageReplacer replacer, SnippetTemplate.Arguments args) { + public Map instantiate(MetaAccessProvider runtime, FixedNode replacee, UsageReplacer replacer, SnippetTemplate.Arguments args) { // Inline the snippet nodes, replacing parameters with the given args in the process String name = snippet.name == null ? "{copy}" : snippet.name + "{copy}"; @@ -575,8 +575,12 @@ // Re-wire the control flow graph around the replacee FixedNode firstCFGNodeDuplicate = (FixedNode) duplicates.get(firstCFGNode); replacee.replaceAtPredecessor(firstCFGNodeDuplicate); - FixedNode next = replacee.next(); - replacee.setNext(null); + FixedNode next = null; + if (replacee instanceof FixedWithNextNode) { + FixedWithNextNode fwn = (FixedWithNextNode) replacee; + next = fwn.next(); + fwn.setNext(null); + } if (replacee instanceof StateSplit) { for (StateSplit sideEffectNode : sideEffectNodes) {