# HG changeset patch # User Thomas Wuerthinger # Date 1339799970 -7200 # Node ID b60a368c81048152307bc757d4f26d8eb0b6d03d # Parent 26a060cc58caf40d17435d44fb85816bb64cf110 Add correct checkcast node to entry of catch block after exception dispatch. diff -r 26a060cc58ca -r b60a368c8104 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 Sat Jun 16 00:06:48 2012 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Sat Jun 16 00:39:30 2012 +0200 @@ -1396,10 +1396,16 @@ ConstantNode typeInstruction = genTypeOrDeopt(JavaType.Representation.ObjectHub, catchType, initialized); if (typeInstruction != null) { Block nextBlock = block.successors.size() == 1 ? unwindBlock(block.deoptBci) : block.successors.get(1); + ValueNode exception = frameState.stackAt(0); + CheckCastNode checkCast = currentGraph.add(new CheckCastNode(typeInstruction, (ResolvedJavaType) catchType, exception)); + frameState.apop(); + frameState.push(Kind.Object, checkCast); FixedNode catchSuccessor = createTarget(block.successors.get(0), frameState); + frameState.apop(); + frameState.push(Kind.Object, exception); FixedNode nextDispatch = createTarget(nextBlock, frameState); - ValueNode exception = frameState.stackAt(0); - IfNode ifNode = currentGraph.add(new IfNode(currentGraph.unique(new InstanceOfNode(typeInstruction, (ResolvedJavaType) catchType, exception)), catchSuccessor, nextDispatch, 0.5)); + checkCast.setNext(catchSuccessor); + IfNode ifNode = currentGraph.add(new IfNode(currentGraph.unique(new InstanceOfNode(typeInstruction, (ResolvedJavaType) catchType, exception)), checkCast, nextDispatch, 0.5)); append(ifNode); } }