# HG changeset patch # User Thomas Wuerthinger # Date 1423866938 -3600 # Node ID f9ccdf258dd40b35bcd8ccfbaa57d6bbf2ef7d26 # Parent 4acfeb8a0010307cb62142530adc103b846b9367 Further reduction of begin node creation when inlining during parsing. diff -r 4acfeb8a0010 -r f9ccdf258dd4 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 Fri Feb 13 22:50:55 2015 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Fri Feb 13 23:35:38 2015 +0100 @@ -205,6 +205,7 @@ private Stack explodeLoopsContext; private int nextPeelIteration = 1; private int returnCount; + private boolean controlFlowSplit; public BytecodeParser(MetaAccessProvider metaAccess, ResolvedJavaMethod method, GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts, int entryBCI) { super(metaAccess, method, graphBuilderConfig, optimisticOpts); @@ -502,6 +503,7 @@ dispatchBegin.setStateAfter(dispatchState.create(bci)); dispatchState.setRethrowException(true); } + this.controlFlowSplit = true; FixedNode target = createTarget(dispatchBlock, dispatchState); FixedWithNextNode finishedDispatch = finishInstruction(dispatchBegin, dispatchState); finishedDispatch.setNext(target); @@ -1005,7 +1007,7 @@ beforeReturn(x); append(new ReturnNode(x)); } else { - if (returnCount == 1) { + if (returnCount == 1 || !controlFlowSplit) { // There is only a single return. this.returnValue = x; this.beforeReturnNode = this.lastInstr; @@ -1092,6 +1094,7 @@ @Override protected void genIntegerSwitch(ValueNode value, ArrayList actualSuccessors, int[] keys, double[] keyProbabilities, int[] keySuccessors) { + this.controlFlowSplit = true; double[] successorProbabilities = successorProbabilites(actualSuccessors.size(), keySuccessors, keyProbabilities); IntegerSwitchNode switchNode = append(new IntegerSwitchNode(value, actualSuccessors.size(), keys, keyProbabilities, keySuccessors)); for (int i = 0; i < actualSuccessors.size(); i++) { @@ -1271,7 +1274,8 @@ * this block again. */ FixedNode targetNode; - if (isGoto && block.getPredecessorCount() == 1 && !block.isLoopHeader && (currentBlock.loops & ~block.loops) == 0 && !(lastInstr instanceof AbstractMergeNode)) { + if (isGoto && (block.getPredecessorCount() == 1 || !controlFlowSplit) && !block.isLoopHeader && (currentBlock.loops & ~block.loops) == 0 && + !(lastInstr instanceof AbstractMergeNode)) { block.setFirstInstruction(operatingDimension, lastInstr); lastInstr = null; } else { @@ -1519,6 +1523,7 @@ if (block.isLoopHeader && !explodeLoops) { // Create the loop header block, which later will merge the backward branches of // the loop. + controlFlowSplit = true; AbstractEndNode preLoopEnd = currentGraph.add(new EndNode()); LoopBeginNode loopBegin = currentGraph.add(new LoopBeginNode()); lastInstr.setNext(preLoopEnd); @@ -1695,6 +1700,8 @@ } appendGoto(nextBlock); } else { + + this.controlFlowSplit = true; ValueNode trueSuccessor = createBlockTarget(probability, trueBlock, frameState); ValueNode falseSuccessor = createBlockTarget(1 - probability, falseBlock, frameState);