Mercurial > hg > graal-compiler
changeset 8357:5fbb2df2b47f
Allow lowering of UnwindNode and ExceptionObjectNode. The HotSpot code still uses the old LIR lowering.
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Mon, 18 Mar 2013 19:38:46 -0700 |
parents | 29d44e82b8f7 |
children | a69eb5f539d9 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java |
diffstat | 4 files changed, 21 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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();
--- 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); + } }
--- 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();
--- 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<Node, Node> instantiate(MetaAccessProvider runtime, FixedWithNextNode replacee, UsageReplacer replacer, SnippetTemplate.Arguments args) { + public Map<Node, Node> 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) {