# HG changeset patch # User Lukas Stadler # Date 1404209698 -7200 # Node ID 67f3267a8846fa598196f690d41edb3bd380246b # Parent c88a9e432faf1723521b73847e6d07d131031b78 code and javadoc cleanups in Canonicalizable and NodeClassIterable diff -r c88a9e432faf -r 67f3267a8846 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Tue Jul 01 11:37:17 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Tue Jul 01 12:14:58 2014 +0200 @@ -624,6 +624,32 @@ } } + private class NodeClassAllSuccessorsIterator extends NodeClassSuccessorsIterator { + NodeClassAllSuccessorsIterator(Node node) { + super(node, true); + } + + @Override + void forward() { + if (index < getDirectCount()) { + index++; + if (index < getDirectCount()) { + return; + } + } else { + subIndex++; + } + while (index < getOffsets().length) { + NodeList list = getNodeList(node, getOffsets()[index]); + if (subIndex < list.size()) { + return; + } + subIndex = 0; + index++; + } + } + } + private final class NodeClassInputsWithModCountIterator extends NodeClassInputsIterator { private final int modCount; @@ -1172,6 +1198,10 @@ } } + public NodeClassIterator withNullIterator() { + return new NodeClassAllSuccessorsIterator(node); + } + @Override public boolean contains(Node other) { return successorContains(node, other); diff -r c88a9e432faf -r 67f3267a8846 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClassIterable.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClassIterable.java Tue Jul 01 11:37:17 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClassIterable.java Tue Jul 01 12:14:58 2014 +0200 @@ -32,10 +32,14 @@ */ public interface NodeClassIterable extends NodeIterable { + /** + * Returns an iterator that produces all non-null values. + */ @Override NodeClassIterator iterator(); - default NodeClassIterator withNullIterator() { - return iterator(); - } + /** + * Returns an iterator that produces all values, including null values. + */ + NodeClassIterator withNullIterator(); } diff -r c88a9e432faf -r 67f3267a8846 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/spi/Canonicalizable.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/spi/Canonicalizable.java Tue Jul 01 11:37:17 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/spi/Canonicalizable.java Tue Jul 01 12:14:58 2014 +0200 @@ -68,7 +68,7 @@ * This sub-interface of {@link Canonicalizable} is intended for nodes that have exactly one * input. It has an additional {@link #canonical(CanonicalizerTool, Node)} method that looks at * the given input instead of the current input of the node - which can be used to ask - * "what if this input is change to this node" - questions. + * "what if this input is changed to this node" - questions. * * @param the common supertype of all inputs of this node */ @@ -97,7 +97,7 @@ * This sub-interface of {@link Canonicalizable} is intended for nodes that have exactly two * inputs. It has an additional {@link #canonical(CanonicalizerTool, Node, Node)} method that * looks at the given inputs instead of the current inputs of the node - which can be used to - * ask "what if this input is change to this node" - questions. + * ask "what if this input is changed to this node" - questions. * * @param the common supertype of all inputs of this node */ diff -r c88a9e432faf -r 67f3267a8846 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java Tue Jul 01 11:37:17 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java Tue Jul 01 12:14:58 2014 +0200 @@ -239,11 +239,7 @@ node.graph().getNewNodes(mark).snapshot(); }; } else { - return new AutoCloseable() { - public void close() throws Exception { - // nothing to do - } - }; + return null; } }