Mercurial > hg > graal-compiler
changeset 15881:a6eeb3750238
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 21 May 2014 11:45:50 +0200 |
parents | a43ff5d18350 (diff) b5a993ed67ea (current diff) |
children | e751da27fd48 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConstant.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMField.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMFlag.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMType.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/ComputeInliningRelevance.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningIterator.java graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/AbstractExecutionContext.java graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultSourceSection.java graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/SourceCallback.java |
diffstat | 1 files changed, 49 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Tue May 20 15:46:02 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Wed May 21 11:45:50 2014 +0200 @@ -27,6 +27,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType; import com.oracle.graal.api.meta.ProfilingInfo.TriState; +import com.oracle.graal.compiler.common.*; import com.oracle.graal.compiler.common.calc.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.debug.*; @@ -703,6 +704,18 @@ connectEnds(falseEnds, phiValues, oldFalseSuccessor, merge, tool); connectEnds(trueEnds, phiValues, oldTrueSuccessor, merge, tool); + if (this.trueSuccessorProbability == 0.0) { + for (AbstractEndNode endNode : trueEnds) { + propagateZeroProbability(endNode); + } + } + + if (this.trueSuccessorProbability == 1.0) { + for (AbstractEndNode endNode : falseEnds) { + propagateZeroProbability(endNode); + } + } + /* * Remove obsolete ends only after processing all ends, otherwise oldTrueSuccessor or * oldFalseSuccessor might have been removed if it is a LoopExitNode. @@ -724,6 +737,42 @@ return true; } + private void propagateZeroProbability(FixedNode startNode) { + Node prev = null; + for (FixedNode node : GraphUtil.predecessorIterable(startNode)) { + if (node instanceof IfNode) { + IfNode ifNode = (IfNode) node; + if (ifNode.trueSuccessor() == prev) { + if (ifNode.trueSuccessorProbability == 0.0) { + return; + } else if (ifNode.trueSuccessorProbability == 1.0) { + continue; + } else { + ifNode.setTrueSuccessorProbability(0.0); + return; + } + } else if (ifNode.falseSuccessor() == prev) { + if (ifNode.trueSuccessorProbability == 1.0) { + return; + } else if (ifNode.trueSuccessorProbability == 0.0) { + continue; + } else { + ifNode.setTrueSuccessorProbability(1.0); + return; + } + } else { + throw new GraalInternalError("Illegal state"); + } + } else if (node instanceof MergeNode && !(node instanceof LoopBeginNode)) { + for (AbstractEndNode endNode : ((MergeNode) node).cfgPredecessors()) { + propagateZeroProbability(endNode); + } + return; + } + prev = node; + } + } + private static boolean checkFrameState(FixedNode start) { FixedNode node = start; while (true) {