changeset 7534:417bd4ca6e4a

handle InvokeWithExceptionNode when inlining macro nodes
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 23 Jan 2013 16:44:46 +0100
parents bbaa734b3627
children f057113c7a87
files graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/MacroNode.java
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Tue Jan 22 22:46:13 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Wed Jan 23 16:44:46 2013 +0100
@@ -207,12 +207,19 @@
                 assert invoke instanceof InvokeNode;
                 FixedWithNextNode macroNode;
                 try {
-                    macroNode = macroNodeClass.getConstructor(InvokeNode.class).newInstance(invoke);
+                    macroNode = macroNodeClass.getConstructor(Invoke.class).newInstance(invoke);
                 } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) {
                     throw new GraalInternalError(e).addContext(invoke.node()).addContext("macroSubstitution", macroNodeClass);
                 }
+                macroNode.setProbability(invoke.node().probability());
                 CallTargetNode callTarget = invoke.callTarget();
-                graph.replaceFixedWithFixed((InvokeNode) invoke, graph.add(macroNode));
+                if (invoke instanceof InvokeNode) {
+                    graph.replaceFixedWithFixed((InvokeNode) invoke, graph.add(macroNode));
+                } else {
+                    InvokeWithExceptionNode invokeWithException = (InvokeWithExceptionNode) invoke;
+                    invokeWithException.killExceptionEdge();
+                    graph.replaceSplitWithFixed(invokeWithException, graph.add(macroNode), invokeWithException.next());
+                }
                 GraphUtil.killWithUnusedFloatingInputs(callTarget);
             } else {
                 StructuredGraph calleeGraph = getIntrinsicGraph(concrete);
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/MacroNode.java	Tue Jan 22 22:46:13 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/MacroNode.java	Wed Jan 23 16:44:46 2013 +0100
@@ -33,14 +33,14 @@
 
 public class MacroNode extends AbstractStateSplit implements Lowerable {
 
-    @Input protected NodeInputList<ValueNode> arguments;
+    @Input protected final NodeInputList<ValueNode> arguments;
 
     private final int bci;
     private final ResolvedJavaMethod targetMethod;
     private final JavaType returnType;
 
-    protected MacroNode(InvokeNode invoke) {
-        super(invoke.stamp(), invoke.stateAfter());
+    protected MacroNode(Invoke invoke) {
+        super(invoke.node().stamp(), invoke.stateAfter());
         this.arguments = new NodeInputList<>(this, invoke.methodCallTarget().arguments());
         this.bci = invoke.bci();
         this.targetMethod = invoke.methodCallTarget().targetMethod();