# HG changeset patch # User Thomas Wuerthinger # Date 1426278847 -3600 # Node ID 5342c99cba8120ce60cb07abc2f0bebbba20e805 # Parent a312673d5f8f47fe53f96bd7535b573631cf3ec3 Small fixes in GraphOrder and SchedulePhase. diff -r a312673d5f8f -r 5342c99cba81 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java --- 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()) { diff -r a312673d5f8f -r 5342c99cba81 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/GraphOrder.java --- 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() { - @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() { + @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() { + @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() { - @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() {