changeset 23357:a821d7d0ab7e graal-0.13

GraphPE: Improve stamp for phi functions during parsing
author Christian Wimmer <christian.wimmer@oracle.com>
date Wed, 27 Jan 2016 09:35:35 -0800
parents 2cbe808cdc37
children daece94b35c2
files graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GraphDecoder.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimplifyingGraphDecoder.java graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PhiStampInferencePartialEvaluationTest.java
diffstat 3 files changed, 23 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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;
--- 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() {
         /*