# HG changeset patch # User Thomas Wuerthinger # Date 1426423228 -3600 # Node ID ba265a5410e04bb490ef0dbbbd5f9823692694c4 # Parent 1cbbdc29ab45842071491eb574e3956c5ccbbe5b Add utility Node#pushInputs(NodeStack). diff -r 1cbbdc29ab45 -r ba265a5410e0 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Edges.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Edges.java Sat Mar 14 22:45:52 2015 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Edges.java Sun Mar 15 13:40:28 2015 +0100 @@ -528,22 +528,56 @@ } index++; } - int count = getCount(); + int count = curOffsets.length; while (index < count) { NodeList list = getNodeList(node, curOffsets, index); - if (list != null) { - for (int i = 0; i < list.size(); ++i) { - Node curNode = list.get(i); - if (curNode != null) { - consumer.accept(node, curNode); - } + acceptHelper(node, consumer, list); + index++; + } + } + + private static void acceptHelper(Node node, BiConsumer consumer, NodeList list) { + if (list != null) { + for (int i = 0; i < list.size(); ++i) { + Node curNode = list.get(i); + if (curNode != null) { + consumer.accept(node, curNode); } } - index++; } } public long[] getOffsets() { return this.offsets; } + + public void pushAll(Node node, NodeStack stack) { + int index = 0; + int curDirectCount = this.directCount; + final long[] curOffsets = this.offsets; + while (index < curDirectCount) { + Node curNode = getNode(node, curOffsets, index); + if (curNode != null) { + stack.push(curNode); + } + index++; + } + int count = curOffsets.length; + while (index < count) { + NodeList list = getNodeList(node, curOffsets, index); + pushAllHelper(stack, list); + index++; + } + } + + private static void pushAllHelper(NodeStack stack, NodeList list) { + if (list != null) { + for (int i = 0; i < list.size(); ++i) { + Node curNode = list.get(i); + if (curNode != null) { + stack.push(curNode); + } + } + } + } } diff -r 1cbbdc29ab45 -r ba265a5410e0 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Sat Mar 14 22:45:52 2015 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Sun Mar 15 13:40:28 2015 +0100 @@ -1074,4 +1074,8 @@ public boolean valueEquals(Node other) { return getNodeClass().dataEquals(this, other); } + + public final void pushInputs(NodeStack stack) { + getNodeClass().getInputEdges().pushAll(this, stack); + } } diff -r 1cbbdc29ab45 -r ba265a5410e0 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 Sat Mar 14 22:45:52 2015 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Sun Mar 15 13:40:28 2015 +0100 @@ -588,7 +588,7 @@ newList.add(n); } else { // This node was pulled up. - assert !(n instanceof FixedNode); + assert !(n instanceof FixedNode) : n; } } @@ -627,12 +627,16 @@ } } } else { - for (Node input : current.inputs()) { - if (current instanceof FrameState && input instanceof StateSplit && ((StateSplit) input).stateAfter() == current) { - // Ignore the cycle. - } else { - stack.push(input); + if (current instanceof FrameState) { + for (Node input : current.inputs()) { + if (input instanceof StateSplit && ((StateSplit) input).stateAfter() == current) { + // Ignore the cycle. + } else { + stack.push(input); + } } + } else { + current.pushInputs(stack); } } } else { diff -r 1cbbdc29ab45 -r ba265a5410e0 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java Sat Mar 14 22:45:52 2015 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java Sun Mar 15 13:40:28 2015 +0100 @@ -469,7 +469,7 @@ } private void writeBlocks(List blocks, BlockMap> blockToNodes) throws IOException { - if (blocks != null) { + if (blocks != null && blockToNodes != null) { for (Block block : blocks) { List nodes = blockToNodes.get(block); if (nodes == null) {