changeset 18831:c142633a6304

Fix regression in graph builder related to removal of placeholder nodes. Do not create successor blocks for invokes without exception handler successor.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 11 Jan 2015 23:46:00 +0100
parents c50e5292d366
children 5d36d7eeb13d
files graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java
diffstat 2 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java	Sun Jan 11 21:38:26 2015 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java	Sun Jan 11 23:46:00 2015 +0100
@@ -524,10 +524,10 @@
                 case INVOKESTATIC:
                 case INVOKEVIRTUAL:
                 case INVOKEDYNAMIC: {
-                    current = null;
-                    addSuccessor(bci, makeBlock(stream.nextBCI()));
                     ExceptionDispatchBlock handler = handleExceptions(bci);
                     if (handler != null) {
+                        current = null;
+                        addSuccessor(bci, makeBlock(stream.nextBCI()));
                         addSuccessor(bci, handler);
                     }
                     break;
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Sun Jan 11 21:38:26 2015 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Sun Jan 11 23:46:00 2015 +0100
@@ -793,9 +793,9 @@
                     frameState.clearNonLiveLocals(currentBlock, liveness, false);
 
                     InvokeWithExceptionNode invoke = createInvokeWithException(callTarget, resultType);
-
-                    BciBlock nextBlock = currentBlock.getSuccessor(0);
-                    invoke.setNext(createTarget(nextBlock, frameState));
+                    BeginNode beginNode = currentGraph.add(KillingBeginNode.create(LocationIdentity.ANY_LOCATION));
+                    invoke.setNext(beginNode);
+                    lastInstr = beginNode;
                 }
             }
 
@@ -813,8 +813,7 @@
                 DispatchBeginNode exceptionEdge = handleException(null, bci());
                 InvokeWithExceptionNode invoke = append(InvokeWithExceptionNode.create(callTarget, exceptionEdge, bci()));
                 frameState.pushReturn(resultType, invoke);
-                BciBlock nextBlock = currentBlock.getSuccessor(0);
-                invoke.setStateAfter(frameState.create(nextBlock.startBci));
+                invoke.setStateAfter(frameState.create(stream.nextBCI()));
                 return invoke;
             }
 
@@ -1065,7 +1064,7 @@
                 assert currentBlock == null || currentBlock.getId() < block.getId() : "must not be backward branch";
                 assert block.firstInstruction.next() == null : "bytecodes already parsed for block";
 
-                if (block.firstInstruction instanceof BeginNode) {
+                if (block.firstInstruction instanceof BeginNode && !(block.firstInstruction instanceof MergeNode)) {
                     /*
                      * This is the second time we see this block. Create the actual MergeNode and
                      * the End Node for the already existing edge. For simplicity, we leave the
@@ -1079,7 +1078,13 @@
                     MergeNode mergeNode = currentGraph.add(MergeNode.create());
                     FixedNode next = placeholder.next();
 
-                    placeholder.setNext(end);
+                    if (placeholder.predecessor() instanceof ControlSplitNode) {
+                        placeholder.setNext(end);
+                    } else {
+                        placeholder.replaceAtPredecessor(end);
+                        placeholder.safeDelete();
+                    }
+
                     mergeNode.addForwardEnd(end);
                     mergeNode.setNext(next);