# HG changeset patch # User Thomas Wuerthinger # Date 1421016360 -3600 # Node ID c142633a63044fc53c3cc9a77f9d81d459a955bf # Parent c50e5292d366bf31c756e2920e33bd3afa2a3481 Fix regression in graph builder related to removal of placeholder nodes. Do not create successor blocks for invokes without exception handler successor. diff -r c50e5292d366 -r c142633a6304 graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java --- 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; diff -r c50e5292d366 -r c142633a6304 graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- 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);