# HG changeset patch # User Christian Wimmer # Date 1388778395 28800 # Node ID ab4c3a33a8b1010c05f5fafeb55a66a2709f2188 # Parent 03bb0ee05409d52e77ed4426f8b0a7981a950523 Bugfix: node successors are unordered, so emitting a jump to the first successor hits a random target diff -r 03bb0ee05409 -r ab4c3a33a8b1 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Thu Jan 02 18:02:01 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Fri Jan 03 11:46:35 2014 -0800 @@ -486,9 +486,17 @@ } } } - if (block.getSuccessorCount() >= 1 && !hasBlockEnd(block)) { + + if (!hasBlockEnd(block)) { NodeClassIterable successors = block.getEndNode().successors(); - assert successors.isNotEmpty() : "should have at least one successor : " + block.getEndNode(); + assert successors.count() == block.getSuccessorCount(); + if (block.getSuccessorCount() != 1) { + /* + * If we have more than one successor, we cannot just use the first one. Since + * successors are unordered, this would be a random choice. + */ + throw new GraalInternalError("Block without BlockEndOp: " + block.getEndNode()); + } emitJump(getLIRBlock((FixedNode) successors.first())); } @@ -731,6 +739,10 @@ if (isLegal(result)) { setResult(x.asNode(), emitMove(result)); } + + if (x instanceof InvokeWithExceptionNode) { + emitJump(getLIRBlock(((InvokeWithExceptionNode) x).next())); + } } protected abstract void emitDirectCall(DirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState);