# HG changeset patch # User Christian Wimmer # Date 1453916135 28800 # Node ID a821d7d0ab7ec009b3875639bf880a07a2a98b39 # Parent 2cbe808cdc37219c35ba81283f27b5602813bf16 GraphPE: Improve stamp for phi functions during parsing diff -r 2cbe808cdc37 -r a821d7d0ab7e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GraphDecoder.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GraphDecoder.java Wed Jan 27 14:46:12 2016 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GraphDecoder.java Wed Jan 27 09:35:35 2016 -0800 @@ -462,6 +462,9 @@ handleProxyNodes(methodScope, loopScope, (LoopExitNode) node); } + } else if (node instanceof MergeNode) { + handleMergeNode(((MergeNode) node)); + } else if (node instanceof AbstractEndNode) { LoopScope phiInputScope = loopScope; LoopScope phiNodeScope = loopScope; @@ -550,6 +553,14 @@ } } + /** + * Hook for subclasses to perform simplifications for a non-loop-header control flow merge. + * + * @param merge The control flow merge. + */ + protected void handleMergeNode(MergeNode merge) { + } + protected void handleLoopExplosionBegin(MethodScope methodScope, LoopScope loopScope, LoopBeginNode loopBegin) { checkLoopExplosionIteration(methodScope, loopScope); @@ -1286,7 +1297,7 @@ * loop iteration. This is mostly the state that we want, we only need to tweak it a * little bit: we need to insert the appropriate ProxyNodes for all values that are * created inside the loop and that flow out of the loop. - * + * * In some cases, we did not create a FrameState during graph decoding: when there * was no LoopExit in the original loop that we exploded. This happens for code * paths that lead immediately to a DeoptimizeNode. Since the BytecodeParser does diff -r 2cbe808cdc37 -r a821d7d0ab7e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimplifyingGraphDecoder.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimplifyingGraphDecoder.java Wed Jan 27 14:46:12 2016 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimplifyingGraphDecoder.java Wed Jan 27 09:35:35 2016 -0800 @@ -138,6 +138,17 @@ } @Override + protected void handleMergeNode(MergeNode merge) { + /* + * All inputs of non-loop phi nodes are known by now. We can infer the stamp for the phi, so + * that parsing continues with more precise type information. + */ + for (ValuePhiNode phi : merge.valuePhis()) { + phi.inferStamp(); + } + } + + @Override protected void handleFixedNode(MethodScope methodScope, LoopScope loopScope, int nodeOrderId, FixedNode node) { if (node instanceof IfNode) { IfNode ifNode = (IfNode) node; diff -r 2cbe808cdc37 -r a821d7d0ab7e graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PhiStampInferencePartialEvaluationTest.java --- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PhiStampInferencePartialEvaluationTest.java Wed Jan 27 14:46:12 2016 +0100 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PhiStampInferencePartialEvaluationTest.java Wed Jan 27 09:35:35 2016 -0800 @@ -24,7 +24,6 @@ import java.util.function.Supplier; -import org.junit.Ignore; import org.junit.Test; import com.oracle.graal.truffle.test.nodes.AbstractTestNode; @@ -38,7 +37,6 @@ public class PhiStampInferencePartialEvaluationTest extends PartialEvaluationTest { - @Ignore("currently failing") @Test public void ifPhiStamp() { /*