changeset 19833:5342c99cba81

Small fixes in GraphOrder and SchedulePhase.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 13 Mar 2015 21:34:07 +0100
parents a312673d5f8f
children 71f8edb4fc7d
files graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/GraphOrder.java
diffstat 2 files changed, 66 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Fri Mar 13 17:32:13 2015 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Fri Mar 13 21:34:07 2015 +0100
@@ -676,12 +676,7 @@
         }
     }
 
-    @Override
-    public String toString() {
-        return printScheduleHelper("Schedule");
-    }
-
-    private String printScheduleHelper(String desc) {
+    public String printScheduleHelper(String desc) {
         Formatter buf = new Formatter();
         buf.format("=== %s / %s / %s ===%n", getCFG().getStartBlock().getBeginNode().graph(), selectedStrategy, desc);
         for (Block b : getCFG().getBlocks()) {
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/GraphOrder.java	Fri Mar 13 17:32:13 2015 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/GraphOrder.java	Fri Mar 13 21:34:07 2015 +0100
@@ -156,77 +156,80 @@
                      */
                     FrameState pendingStateAfter = null;
                     for (final Node node : list) {
-                        FrameState stateAfter = node instanceof StateSplit ? ((StateSplit) node).stateAfter() : null;
-                        if (node instanceof FullInfopointNode) {
-                            stateAfter = ((FullInfopointNode) node).getState();
-                        }
+                        if (node instanceof ValueNode) {
+                            FrameState stateAfter = node instanceof StateSplit ? ((StateSplit) node).stateAfter() : null;
+                            if (node instanceof FullInfopointNode) {
+                                stateAfter = ((FullInfopointNode) node).getState();
+                            }
 
-                        if (pendingStateAfter != null && node instanceof FixedNode) {
-                            pendingStateAfter.applyToNonVirtual(new NodeClosure<Node>() {
-                                @Override
-                                public void apply(Node usage, Node nonVirtualNode) {
-                                    assert currentState.isMarked(nonVirtualNode) || nonVirtualNode instanceof VirtualObjectNode || nonVirtualNode instanceof ConstantNode : nonVirtualNode +
-                                                    " not available at virtualstate " + usage + " before " + node + " in block " + block + " \n" + list;
-                                }
-                            });
-                            pendingStateAfter = null;
-                        }
+                            if (pendingStateAfter != null && node instanceof FixedNode) {
+                                pendingStateAfter.applyToNonVirtual(new NodeClosure<Node>() {
+                                    @Override
+                                    public void apply(Node usage, Node nonVirtualNode) {
+                                        assert currentState.isMarked(nonVirtualNode) || nonVirtualNode instanceof VirtualObjectNode || nonVirtualNode instanceof ConstantNode : nonVirtualNode +
+                                                        " not available at virtualstate " + usage + " before " + node + " in block " + block + " \n" + list;
+                                    }
+                                });
+                                pendingStateAfter = null;
+                            }
 
-                        if (node instanceof AbstractMergeNode) {
-                            // phis aren't scheduled, so they need to be added explicitly
-                            currentState.markAll(((AbstractMergeNode) node).phis());
-                            if (node instanceof LoopBeginNode) {
-                                // remember the state at the loop entry, it's restored at exits
-                                loopEntryStates.put((LoopBeginNode) node, currentState.copy());
-                            }
-                        } else if (node instanceof ProxyNode) {
-                            assert false : "proxy nodes should not be in the schedule";
-                        } else if (node instanceof LoopExitNode) {
-                            if (graph.hasValueProxies()) {
-                                for (ProxyNode proxy : ((LoopExitNode) node).proxies()) {
-                                    for (Node input : proxy.inputs()) {
-                                        if (input != proxy.proxyPoint()) {
-                                            assert currentState.isMarked(input) : input + " not available at " + proxy + " in block " + block + "\n" + list;
+                            if (node instanceof AbstractMergeNode) {
+                                // phis aren't scheduled, so they need to be added explicitly
+                                currentState.markAll(((AbstractMergeNode) node).phis());
+                                if (node instanceof LoopBeginNode) {
+                                    // remember the state at the loop entry, it's restored at exits
+                                    loopEntryStates.put((LoopBeginNode) node, currentState.copy());
+                                }
+                            } else if (node instanceof ProxyNode) {
+                                assert false : "proxy nodes should not be in the schedule";
+                            } else if (node instanceof LoopExitNode) {
+                                if (graph.hasValueProxies()) {
+                                    for (ProxyNode proxy : ((LoopExitNode) node).proxies()) {
+                                        for (Node input : proxy.inputs()) {
+                                            if (input != proxy.proxyPoint()) {
+                                                assert currentState.isMarked(input) : input + " not available at " + proxy + " in block " + block + "\n" + list;
+                                            }
+                                        }
+                                    }
+
+                                    // loop contents are only accessible via proxies at the exit
+                                    currentState.clearAll();
+                                    currentState.markAll(loopEntryStates.get(((LoopExitNode) node).loopBegin()));
+                                }
+                                // Loop proxies aren't scheduled, so they need to be added
+// explicitly
+                                currentState.markAll(((LoopExitNode) node).proxies());
+                            } else {
+                                for (Node input : node.inputs()) {
+                                    if (input != stateAfter) {
+                                        if (input instanceof FrameState) {
+                                            ((FrameState) input).applyToNonVirtual(new VirtualState.NodeClosure<Node>() {
+                                                @Override
+                                                public void apply(Node usage, Node nonVirtual) {
+                                                    assert currentState.isMarked(nonVirtual) : nonVirtual + " not available at " + node + " in block " + block + "\n" + list;
+                                                }
+                                            });
+                                        } else {
+                                            assert currentState.isMarked(input) || input instanceof VirtualObjectNode || input instanceof ConstantNode : input + " not available at " + node +
+                                                            " in block " + block + "\n" + list;
                                         }
                                     }
                                 }
-
-                                // loop contents are only accessible via proxies at the exit
-                                currentState.clearAll();
-                                currentState.markAll(loopEntryStates.get(((LoopExitNode) node).loopBegin()));
                             }
-                            // Loop proxies aren't scheduled, so they need to be added explicitly
-                            currentState.markAll(((LoopExitNode) node).proxies());
-                        } else {
-                            for (Node input : node.inputs()) {
-                                if (input != stateAfter) {
-                                    if (input instanceof FrameState) {
-                                        ((FrameState) input).applyToNonVirtual(new VirtualState.NodeClosure<Node>() {
-                                            @Override
-                                            public void apply(Node usage, Node nonVirtual) {
-                                                assert currentState.isMarked(nonVirtual) : nonVirtual + " not available at " + node + " in block " + block + "\n" + list;
-                                            }
-                                        });
-                                    } else {
-                                        assert currentState.isMarked(input) || input instanceof VirtualObjectNode || input instanceof ConstantNode : input + " not available at " + node +
-                                                        " in block " + block + "\n" + list;
-                                    }
+                            if (node instanceof AbstractEndNode) {
+                                AbstractMergeNode merge = ((AbstractEndNode) node).merge();
+                                for (PhiNode phi : merge.phis()) {
+                                    ValueNode phiValue = phi.valueAt((AbstractEndNode) node);
+                                    assert phiValue == null || currentState.isMarked(phiValue) || phiValue instanceof ConstantNode : phiValue + " not available at phi " + phi + " / end " + node +
+                                                    " in block " + block;
                                 }
                             }
+                            if (stateAfter != null) {
+                                assert pendingStateAfter == null;
+                                pendingStateAfter = stateAfter;
+                            }
+                            currentState.mark(node);
                         }
-                        if (node instanceof AbstractEndNode) {
-                            AbstractMergeNode merge = ((AbstractEndNode) node).merge();
-                            for (PhiNode phi : merge.phis()) {
-                                ValueNode phiValue = phi.valueAt((AbstractEndNode) node);
-                                assert phiValue == null || currentState.isMarked(phiValue) || phiValue instanceof ConstantNode : phiValue + " not available at phi " + phi + " / end " + node +
-                                                " in block " + block;
-                            }
-                        }
-                        if (stateAfter != null) {
-                            assert pendingStateAfter == null;
-                            pendingStateAfter = stateAfter;
-                        }
-                        currentState.mark(node);
                     }
                     if (pendingStateAfter != null) {
                         pendingStateAfter.applyToNonVirtual(new NodeClosure<Node>() {