Mercurial > hg > truffle
changeset 16897:f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
changed Node fields to be protected or package-private (they can no longer be private)
generate isLeafNode() and isOptionalInput()
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchPattern.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchPattern.java Fri Aug 22 15:56:51 2014 +0200 @@ -137,7 +137,7 @@ /** * The inputs to match the patterns against. */ - private final NodeClass.Position[] inputs; + private final Position[] inputs; /** * Can there only be one user of the node. Constant nodes can be matched even if there are other @@ -159,7 +159,7 @@ this.inputs = null; } - private MatchPattern(Class<? extends ValueNode> nodeClass, String name, boolean singleUser, MatchPattern[] patterns, NodeClass.Position[] inputs) { + private MatchPattern(Class<? extends ValueNode> nodeClass, String name, boolean singleUser, MatchPattern[] patterns, Position[] inputs) { assert inputs == null || inputs.length == patterns.length; this.nodeClass = nodeClass; this.name = name; @@ -168,15 +168,15 @@ this.inputs = inputs; } - public MatchPattern(Class<? extends ValueNode> nodeClass, String name, MatchPattern first, NodeClass.Position[] inputs, boolean singleUser) { + public MatchPattern(Class<? extends ValueNode> nodeClass, String name, MatchPattern first, Position[] inputs, boolean singleUser) { this(nodeClass, name, singleUser, new MatchPattern[]{first}, inputs); } - public MatchPattern(Class<? extends ValueNode> nodeClass, String name, MatchPattern first, MatchPattern second, NodeClass.Position[] inputs, boolean singleUser) { + public MatchPattern(Class<? extends ValueNode> nodeClass, String name, MatchPattern first, MatchPattern second, Position[] inputs, boolean singleUser) { this(nodeClass, name, singleUser, new MatchPattern[]{first, second}, inputs); } - public MatchPattern(Class<? extends ValueNode> nodeClass, String name, MatchPattern first, MatchPattern second, MatchPattern third, NodeClass.Position[] inputs, boolean singleUser) { + public MatchPattern(Class<? extends ValueNode> nodeClass, String name, MatchPattern first, MatchPattern second, MatchPattern third, Position[] inputs, boolean singleUser) { this(nodeClass, name, singleUser, new MatchPattern[]{first, second, third}, inputs); }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchProcessor.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchProcessor.java Fri Aug 22 15:56:51 2014 +0200 @@ -193,7 +193,7 @@ } /** - * Recursively accumulate any required NodeClass.Position declarations. + * Recursively accumulate any required Position declarations. */ void generatePositionDeclarations(Set<String> declarations) { matchDescriptor.generatePositionDeclarations(declarations); @@ -460,7 +460,7 @@ } String generatePositionDeclaration() { - return String.format("NodeClass.Position[] %s_positions = MatchRuleRegistry.findPositions(lookup, %s.class, new String[]{\"%s\"});", nodeType.nodeClass, nodeType.nodeClass, + return String.format("Position[] %s_positions = MatchRuleRegistry.findPositions(lookup, %s.class, new String[]{\"%s\"});", nodeType.nodeClass, nodeType.nodeClass, String.join("\", \"", nodeType.inputs)); } } @@ -493,7 +493,7 @@ out.println("import java.util.*;"); out.println("import " + MatchStatementSet.class.getPackage().getName() + ".*;"); out.println("import " + NodeLIRBuilder.class.getName() + ";"); - out.println("import " + NodeClass.class.getName() + ";"); + out.println("import " + Position.class.getName() + ";"); for (String p : requiredPackages) { out.println("import " + p + ".*;"); }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java Fri Aug 22 15:56:51 2014 +0200 @@ -54,7 +54,7 @@ } /** - * Convert a list of field names into {@link com.oracle.graal.graph.NodeClass.Position} objects + * Convert a list of field names into {@link com.oracle.graal.graph.Position} objects * that can be used to read them during a match. The names should already have been confirmed to * exist in the type. * @@ -62,11 +62,11 @@ * @param names * @return an array of Position objects corresponding to the named fields. */ - public static NodeClass.Position[] findPositions(NodeClassLookup lookup, Class<? extends ValueNode> theClass, String[] names) { - NodeClass.Position[] result = new NodeClass.Position[names.length]; + public static Position[] findPositions(NodeClassLookup lookup, Class<? extends ValueNode> theClass, String[] names) { + Position[] result = new Position[names.length]; NodeClass nodeClass = lookup.get(theClass); for (int i = 0; i < names.length; i++) { - for (NodeClass.Position position : nodeClass.getFirstLevelInputPositions()) { + for (Position position : nodeClass.getFirstLevelInputPositions()) { String name = nodeClass.getName(position); if (name.equals(names[i])) { result[i] = position;
--- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/NodeUsagesTests.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/NodeUsagesTests.java Fri Aug 22 15:56:51 2014 +0200 @@ -42,9 +42,9 @@ @NodeInfo static class Use extends Node { - private @Input Def in0; - private @Input Def in1; - private @Input Def in2; + @Input Def in0; + @Input Def in1; + @Input Def in2; public static Use create(Def in0, Def in1, Def in2) { return new NodeUsagesTests_UseGen(in0, in1, in2);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/FirstLevelPositionCollection.java Fri Aug 22 15:56:51 2014 +0200 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.graph; + +import static com.oracle.graal.graph.Node.*; + +import java.util.*; + +import com.oracle.graal.graph.Node.Input; +import com.oracle.graal.graph.Node.Successor; + +/** + * A collection of the positions of the {@link Node} and {@link NodeList} fields in a node. + */ +public final class FirstLevelPositionCollection extends AbstractCollection<Position> implements Collection<Position> { + + public static final FirstLevelPositionCollection Empty = new FirstLevelPositionCollection(0, 0, false); + + /** + * The total number of {@link Node} and {@link NodeList} fields. + */ + protected final int allNodeRefFields; + + /** + * The number of {@link Node} fields. + */ + protected final int nodeFields; + + /** + * Specifies if this iterator iterates over {@linkplain Input inputs} or {@linkplain Successor + * successors}. + */ + private final boolean isInputs; + + /** + * Creates a collection of the positions of the {@link Node} and {@link NodeList} fields in a + * node. + */ + public FirstLevelPositionCollection(int nodeFields, int nodeListFields, boolean isInputs) { + this.allNodeRefFields = nodeListFields + nodeFields; + this.nodeFields = nodeFields; + this.isInputs = isInputs; + } + + @Override + public int size() { + return allNodeRefFields; + } + + @Override + public Iterator<Position> iterator() { + return new FirstLevelPositionIterator(nodeFields, allNodeRefFields - nodeFields, isInputs); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/FirstLevelPositionIterator.java Fri Aug 22 15:56:51 2014 +0200 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.graph; + +import static com.oracle.graal.graph.Node.*; + +import java.util.*; + +import com.oracle.graal.graph.Node.Input; +import com.oracle.graal.graph.Node.Successor; + +/** + * An iterator over the {@link Node} and {@link NodeList} fields in a node. + */ +public class FirstLevelPositionIterator implements Iterator<Position> { + + public static final FirstLevelPositionIterator Empty = new FirstLevelPositionIterator(0, 0, false); + + /** + * The total number of {@link Node} and {@link NodeList} fields. + */ + protected final int allNodeRefFields; + + /** + * The number of {@link Node} fields. + */ + protected final int nodeFields; + + /** + * Specifies if this iterator iterates over {@linkplain Input inputs} or {@linkplain Successor + * successors}. + */ + private final boolean isInputs; + + /** + * Current field iteration index. + */ + protected int index; + + /** + * Creates an iterator over the {@link Node} and {@link NodeList} fields in a node. + * + * @param nodeFields the number of {@link Node} fields in the class hierarchy of the node being + * iterated + * @param nodeListFields the number of {@link NodeList} fields in the class hierarchy of the + * node being iterated + */ + protected FirstLevelPositionIterator(int nodeFields, int nodeListFields, boolean isInputs) { + this.allNodeRefFields = nodeListFields + nodeFields; + this.nodeFields = nodeFields; + this.isInputs = isInputs; + index = Node.NOT_ITERABLE; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + public Position next() { + Position pos = new Position(isInputs, index, index >= nodeFields ? NODE_LIST : NOT_ITERABLE); + index++; + return pos; + } + + public boolean hasNext() { + return index < allNodeRefFields; + } + + public int size() { + return allNodeRefFields; + } +}
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java Fri Aug 22 15:56:51 2014 +0200 @@ -28,7 +28,6 @@ import com.oracle.graal.debug.*; import com.oracle.graal.graph.Node.ValueNumberable; import com.oracle.graal.graph.NodeClass.NodeClassIterator; -import com.oracle.graal.graph.NodeClass.Position; import com.oracle.graal.graph.iterators.*; /** @@ -85,7 +84,7 @@ public CacheEntry(Node node) { assert node.getNodeClass().valueNumberable(); - assert node.getNodeClass().isLeafNode(); + assert node.isLeafNode(); this.node = node; } @@ -117,7 +116,7 @@ this(null); } - static final boolean MODIFICATION_COUNTS_ENABLED = assertionsEnabled(); + public static final boolean MODIFICATION_COUNTS_ENABLED = assertionsEnabled(); /** * Determines if assertions are enabled for the {@link Graph} class. @@ -440,7 +439,7 @@ return (T) other; } else { Node result = addIfMissing ? addHelper(node) : node; - if (node.getNodeClass().isLeafNode()) { + if (node.isLeafNode()) { putNodeIntoCache(result); } return (T) result; @@ -450,7 +449,7 @@ void putNodeIntoCache(Node node) { assert node.graph() == this || node.graph() == null; assert node.getNodeClass().valueNumberable(); - assert node.getNodeClass().isLeafNode() : node.getClass(); + assert node.isLeafNode() : node.getClass(); cachedNodes.put(new CacheEntry(node), node); } @@ -467,7 +466,7 @@ public Node findDuplicate(Node node) { NodeClass nodeClass = node.getNodeClass(); assert nodeClass.valueNumberable(); - if (nodeClass.isLeafNode()) { + if (node.isLeafNode()) { Node cachedNode = findNodeInCache(node); if (cachedNode != null) { return cachedNode; @@ -654,7 +653,6 @@ } PlaceHolderNode() { - // TODO Auto-generated constructor stub } } @@ -872,7 +870,7 @@ nodesSize++; int nodeClassId = node.getNodeClass().iterableId(); - if (nodeClassId != NodeClass.NOT_ITERABLE) { + if (nodeClassId != Node.NOT_ITERABLE) { while (nodeCacheFirst.size() <= nodeClassId) { nodeCacheFirst.add(null); nodeCacheLast.add(null);
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Fri Aug 22 15:56:51 2014 +0200 @@ -27,8 +27,8 @@ import java.lang.annotation.*; import java.util.*; +import com.oracle.graal.graph.Graph.NodeEventListener; import com.oracle.graal.graph.NodeClass.NodeClassIterator; -import com.oracle.graal.graph.NodeClass.Position; import com.oracle.graal.graph.iterators.*; import com.oracle.graal.graph.spi.*; import com.oracle.graal.nodeinfo.*; @@ -160,6 +160,9 @@ private Node predecessor; + public static final int NODE_LIST = -2; + public static final int NOT_ITERABLE = -1; + public Node() { assert getClass().getAnnotation(GeneratedNode.class) != null : getClass() + " is not a generated Node class - forgot @" + NodeInfo.class.getSimpleName() + " on class declaration?"; init(); @@ -527,7 +530,7 @@ return predecessor; } - final int modCount() { + public final int modCount() { if (MODIFICATION_COUNTS_ENABLED && graph != null) { return graph.modCount(this); } @@ -843,7 +846,7 @@ final Node clone(Graph into, boolean clearInputsAndSuccessors) { NodeClass nodeClass = getNodeClass(); - if (into != null && nodeClass.valueNumberable() && nodeClass.isLeafNode()) { + if (into != null && nodeClass.valueNumberable() && isLeafNode()) { Node otherNode = into.findNodeInCache(this); if (otherNode != null) { return otherNode; @@ -871,13 +874,20 @@ newNode.extraUsages = NO_NODES; newNode.predecessor = null; - if (into != null && nodeClass.valueNumberable() && nodeClass.isLeafNode()) { + if (into != null && nodeClass.valueNumberable() && isLeafNode()) { into.putNodeIntoCache(newNode); } newNode.afterClone(this); return newNode; } + /** + * @returns true if this node has no inputs and no successors + */ + public boolean isLeafNode() { + return true; + } + protected void afterClone(@SuppressWarnings("unused") Node other) { } @@ -1095,4 +1105,39 @@ } } } + + // NEW API IMPLEMENTED BY GENERATED METHODS - NOT YET USED + + public NodeRefIterable inputsV2() { + return NodeRefIterable.Empty; + } + + public Collection<Position> getFirstLevelInputs() { + return Collections.emptyList(); + } + + public Collection<Position> getFirstLevelSuccessors() { + return Collections.emptyList(); + } + + /** + * @param pos + */ + public InputType getInputTypeAt(Position pos) { + throw new NoSuchElementException(); + } + + /** + * @param pos + */ + public String getNameOf(Position pos) { + throw new NoSuchElementException(); + } + + /** + * @param pos + */ + public boolean isOptionalInputAt(Position pos) { + throw new NoSuchElementException(); + } }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Fri Aug 22 15:56:51 2014 +0200 @@ -23,6 +23,7 @@ package com.oracle.graal.graph; import static com.oracle.graal.graph.Graph.*; +import static com.oracle.graal.graph.Node.*; import static com.oracle.graal.graph.util.CollectionsAccess.*; import java.lang.reflect.*; @@ -72,9 +73,6 @@ return value; } - public static final int NOT_ITERABLE = -1; - public static final int NODE_LIST = -2; - private static final Class<?> NODE_CLASS = Node.class; private static final Class<?> INPUT_LIST_CLASS = NodeInputList.class; private static final Class<?> SUCCESSOR_LIST_CLASS = NodeSuccessorList.class; @@ -89,7 +87,6 @@ private final long[] successorOffsets; private final Class<?>[] dataTypes; private final boolean canGVN; - private final boolean isLeafNode; private final int startGVNNumber; private final String shortName; private final String nameTemplate; @@ -205,11 +202,10 @@ } this.iterableIds = ids; } else { - this.iterableId = NOT_ITERABLE; + this.iterableId = Node.NOT_ITERABLE; this.iterableIds = null; } - isLeafNode = (this.inputOffsets.length == 0 && this.successorOffsets.length == 0); nodeIterableCount = Debug.metric("NodeIterable_%s", shortName); } @@ -250,10 +246,6 @@ return canGVN; } - public boolean isLeafNode() { - return isLeafNode; - } - /** * Determines if this node type implements {@link Canonicalizable}. */ @@ -296,13 +288,14 @@ assert !field.isAnnotationPresent(Node.Successor.class) : "field cannot be both input and successor"; assert field.isAnnotationPresent(Node.Input.class) ^ field.isAnnotationPresent(Node.OptionalInput.class) : "inputs can either be optional or non-optional"; if (INPUT_LIST_CLASS.isAssignableFrom(type)) { - GraalInternalError.guarantee(Modifier.isFinal(field.getModifiers()), "NodeInputList input field %s should be final", field); + // NodeInputList fields should not be final since they are + // written (via Unsafe) in clearInputs() + GraalInternalError.guarantee(!Modifier.isFinal(field.getModifiers()), "NodeInputList input field %s should not be final", field); GraalInternalError.guarantee(!Modifier.isPublic(field.getModifiers()), "NodeInputList input field %s should not be public", field); inputListOffsets.add(offset); } else { GraalInternalError.guarantee(NODE_CLASS.isAssignableFrom(type) || type.isInterface(), "invalid input type: %s", type); GraalInternalError.guarantee(!Modifier.isFinal(field.getModifiers()), "Node input field %s should not be final", field); - GraalInternalError.guarantee(Modifier.isPrivate(field.getModifiers()), "Node input field %s should be private", field); inputOffsets.add(offset); } if (field.isAnnotationPresent(Node.Input.class)) { @@ -316,13 +309,14 @@ } } else if (field.isAnnotationPresent(Node.Successor.class)) { if (SUCCESSOR_LIST_CLASS.isAssignableFrom(type)) { - GraalInternalError.guarantee(Modifier.isFinal(field.getModifiers()), "NodeSuccessorList successor field % should be final", field); + // NodeSuccessorList fields should not be final since they are + // written (via Unsafe) in clearSuccessors() + GraalInternalError.guarantee(!Modifier.isFinal(field.getModifiers()), "NodeSuccessorList successor field % should not be final", field); GraalInternalError.guarantee(!Modifier.isPublic(field.getModifiers()), "NodeSuccessorList successor field %s should not be public", field); successorListOffsets.add(offset); } else { GraalInternalError.guarantee(NODE_CLASS.isAssignableFrom(type), "invalid successor type: %s", type); GraalInternalError.guarantee(!Modifier.isFinal(field.getModifiers()), "Node successor field %s should not be final", field); - GraalInternalError.guarantee(Modifier.isPrivate(field.getModifiers()), "Node successor field %s should be private", field); successorOffsets.add(offset); } names.put(offset, field.getName()); @@ -354,104 +348,6 @@ return str.toString(); } - /** - * Describes an edge slot for a {@link NodeClass}. - * - * @see NodeClass#get(Node, Position) - * @see NodeClass#getName(Position) - */ - public static final class Position { - - private final boolean input; - private final int index; - private final int subIndex; - - public Position(boolean input, int index, int subIndex) { - this.input = input; - this.index = index; - this.subIndex = subIndex; - } - - @Override - public String toString() { - return (input ? "input " : "successor ") + index + "/" + subIndex; - } - - public Node get(Node node) { - return node.getNodeClass().get(node, this); - } - - public InputType getInputType(Node node) { - return node.getNodeClass().getInputType(this); - } - - public String getInputName(Node node) { - return node.getNodeClass().getName(this); - } - - public boolean isInputOptional(Node node) { - return node.getNodeClass().isInputOptional(this); - } - - public void set(Node node, Node value) { - node.getNodeClass().set(node, this, value); - } - - public void initialize(Node node, Node value) { - node.getNodeClass().initializePosition(node, this, value); - } - - public boolean isValidFor(Node node, Node from) { - return node.getNodeClass().isValid(this, from.getNodeClass()); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + index; - result = prime * result + (input ? 1231 : 1237); - result = prime * result + subIndex; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - Position other = (Position) obj; - if (index != other.index) { - return false; - } - if (input != other.input) { - return false; - } - if (subIndex != other.subIndex) { - return false; - } - return true; - } - - public int getSubIndex() { - return subIndex; - } - - public int getIndex() { - return index; - } - - public boolean isInput() { - return input; - } - } - private static Node getNode(Node node, long offset) { return (Node) unsafe.getObject(node, offset); } @@ -966,7 +862,7 @@ public NodeList<?> getNodeList(Node node, Position pos) { long offset = pos.isInput() ? inputOffsets[pos.getIndex()] : successorOffsets[pos.getIndex()]; - assert pos.getSubIndex() == NODE_LIST; + assert pos.getSubIndex() == Node.NODE_LIST; return getNodeList(node, offset); } @@ -1425,7 +1321,7 @@ return new AbstractCollection<Position>() { @Override public Iterator<Position> iterator() { - return new Iterator<NodeClass.Position>() { + return new Iterator<Position>() { int i = 0; @Override @@ -1434,7 +1330,7 @@ } public Position next() { - Position pos = new Position(true, i, i >= directInputCount ? NODE_LIST : NOT_ITERABLE); + Position pos = new Position(true, i, i >= directInputCount ? Node.NODE_LIST : Node.NOT_ITERABLE); i++; return pos; } @@ -1456,7 +1352,7 @@ return new AbstractCollection<Position>() { @Override public Iterator<Position> iterator() { - return new Iterator<NodeClass.Position>() { + return new Iterator<Position>() { int i = 0; @Override @@ -1465,7 +1361,7 @@ } public Position next() { - Position pos = new Position(false, i, i >= directSuccessorCount ? NODE_LIST : NOT_ITERABLE); + Position pos = new Position(false, i, i >= directSuccessorCount ? Node.NODE_LIST : Node.NOT_ITERABLE); i++; return pos; }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClassIterable.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClassIterable.java Fri Aug 22 15:56:51 2014 +0200 @@ -23,7 +23,6 @@ package com.oracle.graal.graph; import com.oracle.graal.graph.NodeClass.NodeClassIterator; -import com.oracle.graal.graph.NodeClass.Position; import com.oracle.graal.graph.iterators.*; /**
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeInputList.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeInputList.java Fri Aug 22 15:56:51 2014 +0200 @@ -61,7 +61,7 @@ } @Override - public boolean add(T node) { + public boolean add(Node node) { assert node == null || !node.isDeleted(); self.incModCount(); return super.add(node); @@ -86,7 +86,7 @@ } @Override - void copy(NodeList<T> other) { + void copy(NodeList<? extends Node> other) { self.incModCount(); super.copy(other); }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeList.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeList.java Fri Aug 22 15:56:51 2014 +0200 @@ -121,14 +121,15 @@ modCount++; } + @SuppressWarnings("unchecked") @Override - public boolean add(T node) { + public boolean add(Node node) { incModCount(); if (size == nodes.length) { nodes = Arrays.copyOf(nodes, nodes.length * 2 + 1); } nodes[size++] = node; - update(null, node); + update(null, (T) node); return true; } @@ -145,22 +146,22 @@ @Override @SuppressWarnings("unchecked") - public T set(int index, T node) { + public T set(int index, Node node) { incModCount(); T oldValue = (T) nodes[index]; assert index < size(); - update((T) nodes[index], node); + update((T) nodes[index], (T) node); nodes[index] = node; return oldValue; } - void initialize(int index, T node) { + public void initialize(int index, Node node) { incModCount(); assert index < size(); nodes[index] = node; } - void copy(NodeList<T> other) { + void copy(NodeList<? extends Node> other) { incModCount(); nodes = Arrays.copyOf(other.nodes, other.size); size = other.size;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeRefIterable.java Fri Aug 22 15:56:51 2014 +0200 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.graph; + +import com.oracle.graal.graph.iterators.*; + +/** + * The iterator returned by this iterable can be used to access {@link Position Positions} during + * iteration using {@link NodeRefIterator#nextPosition()}. + */ +public interface NodeRefIterable extends NodeIterable<Node> { + /** + * Returns an iterator that produces all non-null values. + */ + @Override + NodeRefIterator iterator(); + + /** + * Returns an iterator that produces all values, including null values. + */ + NodeRefIterator withNullIterator(); + + NodeRefIterable Empty = new NodeRefIterable() { + + public NodeRefIterator withNullIterator() { + return NodeRefIterator.Empty; + } + + public NodeRefIterator iterator() { + return NodeRefIterator.Empty; + } + }; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeRefIterator.java Fri Aug 22 15:56:51 2014 +0200 @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.graph; + +import java.util.*; + +import com.oracle.graal.graph.Node.Input; +import com.oracle.graal.graph.Node.Successor; + +/** + * An iterator over the references to a {@link Node}'s {@linkplain Input inputs} and + * {@linkplain Successor successors}. + * + * An iterator of this type will not return null values, unless the field values are modified + * concurrently. Concurrent modifications are detected by an assertion on a best-effort basis. + */ +public class NodeRefIterator implements Iterator<Node> { + + public static final NodeRefIterator Empty = new NodeRefIterator(0, 0, false); + + /** + * The total number of {@link Node} and {@link NodeList} fields. + */ + protected final int allNodeRefFields; + + /** + * The number of {@link Node} fields. + */ + protected final int nodeFields; + + /** + * Specifies if this iterator iterates over {@linkplain Input inputs} or {@linkplain Successor + * successors}. + */ + private final boolean isInputs; + + /** + * Current field iteration index. + */ + protected int index; + + /** + * Current iteration index within a {@link NodeList} if {@link #index} denotes a + * {@link NodeList} field. + */ + protected int subIndex; + + /** + * Creates an iterator over a node's references (i.e., {@linkplain Input inputs} or + * {@linkplain Successor successors}) to other nodes. The {@link Node} fields are iterated + * before the {@link NodeList} fields. All elements of these NodeLists will be visited by the + * iterator as well. + * + * @param nodeFields the number of {@link Node} fields in the class hierarchy of the node being + * iterated + * @param nodeListFields the number of {@link NodeList} fields in the class hierarchy of the + * node being iterated + */ + protected NodeRefIterator(int nodeFields, int nodeListFields, boolean isInputs) { + this.allNodeRefFields = nodeListFields + nodeFields; + this.nodeFields = nodeFields; + this.isInputs = isInputs; + index = Node.NOT_ITERABLE; + subIndex = 0; + } + + /** + * Gets the value of a {@link Node} field in the node. + * + * @param at the index of the Node field whose value is being requested. This is guaranteed to + * be between 0 and the {@code nodeFields} value this iterator was constructed with + */ + protected Node getNode(int at) { + throw new NoSuchElementException(); + } + + /** + * Gets the value of a {@link NodeList} field in the node. + * + * @param at the index of the {@link NodeList} field whose value is being requested. This is + * guaranteed to be between 0 and the {@code nodeListFields} value this iterator was + * constructed with + */ + protected NodeList<? extends Node> getNodeList(int at) { + throw new NoSuchElementException(); + } + + protected void forward() { + if (index < nodeFields) { + index++; + while (index < nodeFields) { + Node element = getNode(index); + if (element != null) { + return; + } + index++; + } + } else { + subIndex++; + } + while (index < allNodeRefFields) { + NodeList<? extends Node> list = getNodeList(index - nodeFields); + while (subIndex < list.size()) { + if (list.get(subIndex) != null) { + return; + } + subIndex++; + } + subIndex = 0; + index++; + } + return; + } + + private Node nextElement() { + if (index < nodeFields) { + return getNode(index); + } else if (index < allNodeRefFields) { + NodeList<? extends Node> list = getNodeList(index - nodeFields); + return list.get(subIndex); + } + throw new NoSuchElementException(); + } + + @Override + public boolean hasNext() { + return index >= 0 && index < allNodeRefFields; + } + + @Override + public Node next() { + try { + return nextElement(); + } finally { + forward(); + } + } + + public Position nextPosition() { + try { + if (index < nodeFields) { + return new Position(isInputs, index, Node.NOT_ITERABLE); + } else { + return new Position(isInputs, index, subIndex); + } + } finally { + forward(); + } + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } +}
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeSuccessorList.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeSuccessorList.java Fri Aug 22 15:56:51 2014 +0200 @@ -47,7 +47,7 @@ } @Override - public boolean add(T node) { + public boolean add(Node node) { self.incModCount(); return super.add(node); } @@ -71,7 +71,7 @@ } @Override - void copy(NodeList<T> other) { + void copy(NodeList<? extends Node> other) { self.incModCount(); super.copy(other); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Position.java Fri Aug 22 15:56:51 2014 +0200 @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.graph; + +import com.oracle.graal.graph.Node.Input; +import com.oracle.graal.graph.Node.OptionalInput; +import com.oracle.graal.nodeinfo.*; + +/** + * Describes an edge slot for a {@link NodeClass}. + * + * @see NodeClass#getName(Position) + */ +public final class Position { + + /** + * Specifies if this position denotes an {@link Input} or {@link OptionalInput} field. + */ + private final boolean input; + + /** + * Index of the {@link Node} or {@link NodeList} field denoted by this position. + */ + private final int index; + + /** + * Index within a {@link NodeList} if {@link #index} denotes a {@link NodeList} field otherwise + * {@link Node#NOT_ITERABLE}. + */ + private final int subIndex; + + public Position(boolean input, int index, int subIndex) { + this.input = input; + this.index = index; + this.subIndex = subIndex; + } + + public Node get(Node node) { + return node.getNodeClass().get(node, this); + } + + public InputType getInputType(Node node) { + return node.getNodeClass().getInputType(this); + } + + public String getInputName(Node node) { + return node.getNodeClass().getName(this); + } + + public boolean isInputOptional(Node node) { + return node.getNodeClass().isInputOptional(this); + } + + public void set(Node node, Node value) { + node.getNodeClass().set(node, this, value); + } + + public void initialize(Node node, Node value) { + node.getNodeClass().initializePosition(node, this, value); + } + + @Override + public String toString() { + return (input ? "input " : "successor ") + index + "/" + subIndex; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + index; + result = prime * result + (input ? 1231 : 1237); + result = prime * result + subIndex; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + Position other = (Position) obj; + if (index != other.index) { + return false; + } + if (input != other.input) { + return false; + } + if (subIndex != other.subIndex) { + return false; + } + return true; + } + + /** + * Gets the index within a {@link NodeList} if {@link #getIndex()} denotes a {@link NodeList} + * field otherwise {@link Node#NOT_ITERABLE}. + */ + public int getSubIndex() { + return subIndex; + } + + /** + * Gets the index of the {@link Node} or {@link NodeList} field denoted by this position. + */ + public int getIndex() { + return index; + } + + /** + * Returns true if this position denotes an {@link Input} or {@link OptionalInput} field, false + * otherwise. + */ + public boolean isInput() { + return input; + } +}
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64RawNativeCallNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64RawNativeCallNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -36,9 +36,12 @@ public class AMD64RawNativeCallNode extends FixedWithNextNode implements LIRLowerable { private final Constant functionPointer; - @Input private final NodeInputList<ValueNode> args; + @Input NodeInputList<ValueNode> args; -public static AMD64RawNativeCallNode create(Kind returnType, Constant functionPointer, ValueNode[] args) { return new AMD64RawNativeCallNodeGen(returnType, functionPointer, args); } + public static AMD64RawNativeCallNode create(Kind returnType, Constant functionPointer, ValueNode[] args) { + return new AMD64RawNativeCallNodeGen(returnType, functionPointer, args); + } + protected AMD64RawNativeCallNode(Kind returnType, Constant functionPointer, ValueNode[] args) { super(StampFactory.forKind(returnType)); this.functionPointer = functionPointer;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ArrayRangeWriteBarrier.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ArrayRangeWriteBarrier.java Fri Aug 22 15:56:51 2014 +0200 @@ -28,8 +28,8 @@ @NodeInfo public abstract class ArrayRangeWriteBarrier extends WriteBarrier { - @Input private ValueNode startIndex; - @Input private ValueNode length; + @Input ValueNode startIndex; + @Input ValueNode length; public ArrayRangeWriteBarrier(ValueNode object, ValueNode startIndex, ValueNode length) { super(object, null, null, true);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizationFetchUnrollInfoCallNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizationFetchUnrollInfoCallNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -41,7 +41,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public class DeoptimizationFetchUnrollInfoCallNode extends FixedWithNextNode implements LIRLowerable, MemoryCheckpoint.Multi { - @Input private SaveAllRegistersNode registerSaver; + @Input SaveAllRegistersNode registerSaver; private final ForeignCallsProvider foreignCalls; public static DeoptimizationFetchUnrollInfoCallNode create(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ValueNode registerSaver) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -40,10 +40,10 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public class DirectCompareAndSwapNode extends FixedWithNextNode implements LIRLowerable, MemoryCheckpoint.Single { - @Input private ValueNode object; - @Input private ValueNode offset; - @Input private ValueNode expectedValue; - @Input private ValueNode newValue; + @Input ValueNode object; + @Input ValueNode offset; + @Input ValueNode expectedValue; + @Input ValueNode newValue; private final LocationIdentity locationIdentity;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EnterUnpackFramesStackFrameNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EnterUnpackFramesStackFrameNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -38,10 +38,10 @@ @NodeInfo public class EnterUnpackFramesStackFrameNode extends FixedWithNextNode implements LIRLowerable { - @Input private ValueNode framePc; - @Input private ValueNode senderSp; - @Input private ValueNode senderFp; - @Input private SaveAllRegistersNode registerSaver; + @Input ValueNode framePc; + @Input ValueNode senderSp; + @Input ValueNode senderFp; + @Input SaveAllRegistersNode registerSaver; public static EnterUnpackFramesStackFrameNode create(ValueNode framePc, ValueNode senderSp, ValueNode senderFp, ValueNode registerSaver) { return new EnterUnpackFramesStackFrameNodeGen(framePc, senderSp, senderFp, registerSaver);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PreWriteBarrier.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PreWriteBarrier.java Fri Aug 22 15:56:51 2014 +0200 @@ -29,7 +29,7 @@ @NodeInfo public class G1PreWriteBarrier extends WriteBarrier implements DeoptimizingNode.DeoptBefore { - @OptionalInput(InputType.State) private FrameState stateBefore; + @OptionalInput(InputType.State) FrameState stateBefore; private final boolean nullCheck; private final boolean doLoad;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -36,7 +36,7 @@ @NodeInfo public class GetObjectAddressNode extends FixedWithNextNode implements LIRLowerable { - @Input private ValueNode object; + @Input ValueNode object; public static GetObjectAddressNode create(ValueNode obj) { return new GetObjectAddressNodeGen(obj);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotIndirectCallTargetNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotIndirectCallTargetNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -33,7 +33,7 @@ @NodeInfo public class HotSpotIndirectCallTargetNode extends IndirectCallTargetNode { - @Input private ValueNode metaspaceMethod; + @Input ValueNode metaspaceMethod; public static HotSpotIndirectCallTargetNode create(ValueNode metaspaceMethod, ValueNode computedAddress, List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, Type callType, InvokeKind invokeKind) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/JumpToExceptionHandlerInCallerNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/JumpToExceptionHandlerInCallerNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -36,9 +36,9 @@ @NodeInfo public class JumpToExceptionHandlerInCallerNode extends ControlSinkNode implements LIRLowerable { - @Input private ValueNode handlerInCallerPc; - @Input private ValueNode exception; - @Input private ValueNode exceptionPc; + @Input ValueNode handlerInCallerPc; + @Input ValueNode exception; + @Input ValueNode exceptionPc; public static JumpToExceptionHandlerInCallerNode create(ValueNode handlerInCallerPc, ValueNode exception, ValueNode exceptionPc) { return new JumpToExceptionHandlerInCallerNodeGen(handlerInCallerPc, exception, exceptionPc);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveCurrentStackFrameNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveCurrentStackFrameNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -36,7 +36,7 @@ @NodeInfo public class LeaveCurrentStackFrameNode extends FixedWithNextNode implements LIRLowerable { - @Input private SaveAllRegistersNode registerSaver; + @Input SaveAllRegistersNode registerSaver; public static LeaveCurrentStackFrameNode create(ValueNode registerSaver) { return new LeaveCurrentStackFrameNodeGen(registerSaver);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveDeoptimizedStackFrameNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveDeoptimizedStackFrameNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -38,8 +38,8 @@ @NodeInfo public class LeaveDeoptimizedStackFrameNode extends FixedWithNextNode implements LIRLowerable { - @Input private ValueNode frameSize; - @Input private ValueNode initialInfo; + @Input ValueNode frameSize; + @Input ValueNode initialInfo; public static LeaveDeoptimizedStackFrameNode create(ValueNode frameSize, ValueNode initialInfo) { return new LeaveDeoptimizedStackFrameNodeGen(frameSize, initialInfo);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveUnpackFramesStackFrameNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveUnpackFramesStackFrameNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -36,7 +36,7 @@ @NodeInfo public class LeaveUnpackFramesStackFrameNode extends FixedWithNextNode implements LIRLowerable { - @Input private SaveAllRegistersNode registerSaver; + @Input SaveAllRegistersNode registerSaver; public static LeaveUnpackFramesStackFrameNode create(ValueNode registerSaver) { return new LeaveUnpackFramesStackFrameNodeGen(registerSaver);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java Fri Aug 22 15:56:51 2014 +0200 @@ -42,8 +42,8 @@ private static final Stamp defaultStamp = StampFactory.objectNonNull(); - @Input private ValueNode hub; - @Input private ValueNode length; + @Input ValueNode hub; + @Input ValueNode length; public static NewArrayStubCall create(ValueNode hub, ValueNode length) { return new NewArrayStubCallGen(hub, length);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java Fri Aug 22 15:56:51 2014 +0200 @@ -42,7 +42,7 @@ private static final Stamp defaultStamp = StampFactory.objectNonNull(); - @Input private ValueNode hub; + @Input ValueNode hub; public static NewInstanceStubCall create(ValueNode hub) { return new NewInstanceStubCallGen(hub);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Fri Aug 22 15:56:51 2014 +0200 @@ -42,8 +42,8 @@ private static final Stamp defaultStamp = StampFactory.objectNonNull(); - @Input private ValueNode hub; - @Input private ValueNode dims; + @Input ValueNode hub; + @Input ValueNode dims; private final int rank; public static NewMultiArrayStubCall create(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ValueNode hub, int rank, ValueNode dims) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PatchReturnAddressNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PatchReturnAddressNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -35,7 +35,7 @@ @NodeInfo public class PatchReturnAddressNode extends FixedWithNextNode implements LIRLowerable { - @Input private ValueNode address; + @Input ValueNode address; public static PatchReturnAddressNode create(ValueNode address) { return new PatchReturnAddressNodeGen(address);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PrefetchAllocateNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PrefetchAllocateNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -33,8 +33,8 @@ @NodeInfo public class PrefetchAllocateNode extends FixedWithNextNode implements LIRLowerable { - @Input private ValueNode distance; - @Input private ValueNode address; + @Input ValueNode distance; + @Input ValueNode address; public static PrefetchAllocateNode create(ValueNode address, ValueNode distance) { return new PrefetchAllocateNodeGen(address, distance);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PushInterpreterFrameNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PushInterpreterFrameNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -36,10 +36,10 @@ @NodeInfo public class PushInterpreterFrameNode extends FixedWithNextNode implements LIRLowerable { - @Input private ValueNode framePc; - @Input private ValueNode frameSize; - @Input private ValueNode senderSp; - @Input private ValueNode initialInfo; + @Input ValueNode framePc; + @Input ValueNode frameSize; + @Input ValueNode senderSp; + @Input ValueNode initialInfo; public static PushInterpreterFrameNode create(ValueNode frameSize, ValueNode framePc, ValueNode senderSp, ValueNode initialInfo) { return new PushInterpreterFrameNodeGen(frameSize, framePc, senderSp, initialInfo);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SnippetLocationProxyNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SnippetLocationProxyNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -33,7 +33,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Association, InputType.Value}) public class SnippetLocationProxyNode extends FloatingNode implements Canonicalizable { - @Input(InputType.Unchecked) private ValueNode location; + @Input(InputType.Unchecked) ValueNode location; public static SnippetLocationProxyNode create(ValueNode location) { return new SnippetLocationProxyNodeGen(location);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -40,7 +40,7 @@ @NodeInfo(nameTemplate = "StubForeignCall#{p#descriptor/s}", allowedUsageTypes = {InputType.Memory}) public class StubForeignCallNode extends FixedWithNextNode implements LIRLowerable, MemoryCheckpoint.Multi { - @Input private final NodeInputList<ValueNode> arguments; + @Input NodeInputList<ValueNode> arguments; private final ForeignCallsProvider foreignCalls; private final ForeignCallDescriptor descriptor;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -43,8 +43,8 @@ @NodeInfo public class TailcallNode extends FixedWithNextNode implements LIRLowerable { - @Input(InputType.State) private FrameState frameState; - @Input private ValueNode target; + @Input(InputType.State) FrameState frameState; + @Input ValueNode target; /** * Creates a TailcallNode.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/UncommonTrapCallNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/UncommonTrapCallNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -41,8 +41,8 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public class UncommonTrapCallNode extends FixedWithNextNode implements LIRLowerable, MemoryCheckpoint.Multi { - @Input private ValueNode trapRequest; - @Input private SaveAllRegistersNode registerSaver; + @Input ValueNode trapRequest; + @Input SaveAllRegistersNode registerSaver; private final ForeignCallsProvider foreignCalls; public static UncommonTrapCallNode create(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ValueNode registerSaver, ValueNode trapRequest) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -41,7 +41,7 @@ public class VMErrorNode extends DeoptimizingStubCall implements LIRLowerable { private final String format; - @Input private ValueNode value; + @Input ValueNode value; public static VMErrorNode create(String format, ValueNode value) { return new VMErrorNodeGen(format, value);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java Fri Aug 22 15:56:51 2014 +0200 @@ -31,9 +31,9 @@ @NodeInfo public abstract class WriteBarrier extends FixedWithNextNode implements Lowerable { - @Input private ValueNode object; - @OptionalInput private ValueNode value; - @OptionalInput(InputType.Association) private LocationNode location; + @Input ValueNode object; + @OptionalInput ValueNode value; + @OptionalInput(InputType.Association) LocationNode location; private final boolean precise; public WriteBarrier(ValueNode object, ValueNode value, LocationNode location, boolean precise) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyCallNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyCallNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -43,11 +43,11 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public class ArrayCopyCallNode extends AbstractMemoryCheckpoint implements Lowerable, MemoryCheckpoint.Single { - @Input private ValueNode src; - @Input private ValueNode srcPos; - @Input private ValueNode dest; - @Input private ValueNode destPos; - @Input private ValueNode length; + @Input ValueNode src; + @Input ValueNode srcPos; + @Input ValueNode dest; + @Input ValueNode destPos; + @Input ValueNode length; private Kind elementKind;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MethodHandleNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MethodHandleNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -54,7 +54,7 @@ // Replacement method data private ResolvedJavaMethod replacementTargetMethod; private JavaType replacementReturnType; - @Input private final NodeInputList<ValueNode> replacementArguments; + @Input NodeInputList<ValueNode> replacementArguments; public static MethodHandleNode create(Invoke invoke) { return new MethodHandleNodeGen(invoke); @@ -104,10 +104,10 @@ throw GraalInternalError.shouldNotReachHere(); } if (invoke != null) { - FixedNode next = next(); + FixedNode currentNext = next(); replaceAtUsages(invoke); GraphUtil.removeFixedWithUnusedInputs(this); - graph().addBeforeFixed(next, invoke); + graph().addBeforeFixed(currentNext, invoke); } }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopyNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopyNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -35,12 +35,12 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public class UnsafeArrayCopyNode extends ArrayRangeWriteNode implements Lowerable, MemoryCheckpoint.Single { - @Input private ValueNode src; - @Input private ValueNode srcPos; - @Input private ValueNode dest; - @Input private ValueNode destPos; - @Input private ValueNode length; - @OptionalInput private ValueNode layoutHelper; + @Input ValueNode src; + @Input ValueNode srcPos; + @Input ValueNode dest; + @Input ValueNode destPos; + @Input ValueNode length; + @OptionalInput ValueNode layoutHelper; private Kind elementKind;
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java Fri Aug 22 15:56:51 2014 +0200 @@ -30,7 +30,6 @@ import com.oracle.graal.graph.Graph.Mark; import com.oracle.graal.graph.*; import com.oracle.graal.graph.NodeClass.NodeClassIterator; -import com.oracle.graal.graph.NodeClass.Position; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*;
--- a/graal/com.oracle.graal.nodeinfo.processor/src/com/oracle/graal/nodeinfo/processor/GraphNodeGenerator.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodeinfo.processor/src/com/oracle/graal/nodeinfo/processor/GraphNodeGenerator.java Fri Aug 22 15:56:51 2014 +0200 @@ -22,16 +22,19 @@ */ package com.oracle.graal.nodeinfo.processor; +import static com.oracle.graal.nodeinfo.processor.GraphNodeGenerator.NodeRefsType.*; import static com.oracle.truffle.dsl.processor.java.ElementUtils.*; import static java.util.Arrays.*; import static javax.lang.model.element.Modifier.*; import java.util.*; +import java.util.stream.*; import javax.annotation.processing.*; import javax.lang.model.element.*; import javax.lang.model.type.*; import javax.lang.model.util.*; +import javax.tools.Diagnostic.Kind; import com.oracle.graal.nodeinfo.*; import com.oracle.truffle.dsl.processor.java.*; @@ -42,23 +45,65 @@ */ public class GraphNodeGenerator { - final GraphNodeProcessor env; - final TypeElement Input; - final TypeElement OptionalInput; - final TypeElement Successor; + private final GraphNodeProcessor env; + private final Types types; + private final Elements elements; + + private final TypeElement Input; + private final TypeElement OptionalInput; + private final TypeElement Successor; final TypeElement Node; - final TypeElement NodeInputList; - final TypeElement NodeSuccessorList; + private final TypeElement NodeList; + private final TypeElement NodeInputList; + private final TypeElement NodeSuccessorList; + private final TypeElement Position; + + private final List<VariableElement> inputFields = new ArrayList<>(); + private final List<VariableElement> inputListFields = new ArrayList<>(); + private final List<VariableElement> successorFields = new ArrayList<>(); + private final List<VariableElement> successorListFields = new ArrayList<>(); + private final List<VariableElement> dataFields = new ArrayList<>(); + private final Set<VariableElement> optionalInputs = new HashSet<>(); + private final Map<VariableElement, VariableElement> inputTypes = new HashMap<>(); + + private CodeTypeElement genClass; + private String genClassName; public GraphNodeGenerator(GraphNodeProcessor processor) { this.env = processor; - this.Input = getType("com.oracle.graal.graph.Node.Input"); - this.OptionalInput = getType("com.oracle.graal.graph.Node.OptionalInput"); - this.Successor = getType("com.oracle.graal.graph.Node.Successor"); - this.Node = getType("com.oracle.graal.graph.Node"); - this.NodeInputList = getType("com.oracle.graal.graph.NodeInputList"); - this.NodeSuccessorList = getType("com.oracle.graal.graph.NodeSuccessorList"); + + this.types = processor.getProcessingEnv().getTypeUtils(); + this.elements = processor.getProcessingEnv().getElementUtils(); + + this.Input = getTypeElement("com.oracle.graal.graph.Node.Input"); + this.OptionalInput = getTypeElement("com.oracle.graal.graph.Node.OptionalInput"); + this.Successor = getTypeElement("com.oracle.graal.graph.Node.Successor"); + this.Node = getTypeElement("com.oracle.graal.graph.Node"); + this.NodeList = getTypeElement("com.oracle.graal.graph.NodeList"); + this.NodeInputList = getTypeElement("com.oracle.graal.graph.NodeInputList"); + this.NodeSuccessorList = getTypeElement("com.oracle.graal.graph.NodeSuccessorList"); + this.Position = getTypeElement("com.oracle.graal.graph.Position"); + } + + @SafeVarargs + private static Collection<VariableElement> concat(List<VariableElement> fields1, List<VariableElement> fields2, List<VariableElement>... tail) { + return new AbstractCollection<VariableElement>() { + + @Override + public Iterator<VariableElement> iterator() { + Stream<VariableElement> joined = Stream.concat(fields1.stream(), fields2.stream()); + for (List<VariableElement> t : tail) { + joined = Stream.concat(joined, t.stream()); + } + return joined.iterator(); + } + + @Override + public int size() { + return fields1.size() + fields2.size(); + } + }; } /** @@ -66,14 +111,22 @@ * * @throw {@link NoClassDefFoundError} if a type element does not exist for {@code name} */ - public TypeElement getType(String name) { - TypeElement typeElement = env.getProcessingEnv().getElementUtils().getTypeElement(name); + public TypeElement getTypeElement(String name) { + TypeElement typeElement = elements.getTypeElement(name); if (typeElement == null) { throw new NoClassDefFoundError(name); } return typeElement; } + public TypeMirror getType(String name) { + return getTypeElement(name).asType(); + } + + public TypeMirror getType(Class<?> primitiveClass) { + return ElementUtils.getType(getProcessingEnv(), primitiveClass); + } + public ProcessingEnvironment getProcessingEnv() { return env.getProcessingEnv(); } @@ -82,59 +135,29 @@ TypeElement typeElement = node; - String newClassName = typeElement.getSimpleName().toString() + "Gen"; + String genClassName = typeElement.getSimpleName().toString() + "Gen"; Element enclosing = typeElement.getEnclosingElement(); while (enclosing != null) { if (enclosing.getKind() == ElementKind.CLASS || enclosing.getKind() == ElementKind.INTERFACE) { if (enclosing.getModifiers().contains(Modifier.PRIVATE)) { throw new ElementException(enclosing, "%s %s cannot be private", enclosing.getKind().name().toLowerCase(), enclosing); } - newClassName = enclosing.getSimpleName() + "_" + newClassName; + genClassName = enclosing.getSimpleName() + "_" + genClassName; } else { assert enclosing.getKind() == ElementKind.PACKAGE; } enclosing = enclosing.getEnclosingElement(); } - return newClassName; - } - - public class FieldScanner { - /** - * @param field - * @param isOptional - * @param isList - * @return true if field scanning should continue - */ - public boolean scanInputField(VariableElement field, boolean isOptional, boolean isList) { - return true; - } - - /** - * @param field - * @param isList - * @return true if field scanning should continue - */ - public boolean scanSuccessorField(VariableElement field, boolean isList) { - return true; - } - - /** - * @param field - * @return true if field scanning should continue - */ - public boolean scanDataField(VariableElement field) { - return true; - } + return genClassName; } public boolean isAssignableWithErasure(Element from, Element to) { - Types types = env.getProcessingEnv().getTypeUtils(); TypeMirror fromType = types.erasure(from.asType()); TypeMirror toType = types.erasure(to.asType()); return types.isAssignable(fromType, toType); } - public void scanFields(TypeElement node, FieldScanner scanner) { + private void scanFields(TypeElement node) { TypeElement currentClazz = node; do { for (VariableElement field : ElementFilter.fieldsIn(currentClazz.getEnclosedElements())) { @@ -155,15 +178,13 @@ } else if (isNonOptionalInput && isOptionalInput) { throw new ElementException(field, "Inputs must be either optional or non-optional"); } else if (isAssignableWithErasure(field, NodeInputList)) { - if (!modifiers.contains(FINAL)) { - throw new ElementException(field, "Input list field must be final"); + if (modifiers.contains(FINAL)) { + throw new ElementException(field, "Input list field must not be final"); } - if (modifiers.contains(PUBLIC)) { - throw new ElementException(field, "Input list field must not be public"); + if (modifiers.contains(PUBLIC) || modifiers.contains(PRIVATE)) { + throw new ElementException(field, "Input list field must be protected or package-private"); } - if (!scanner.scanInputField(field, isOptionalInput, true)) { - return; - } + inputListFields.add(field); } else { if (!isAssignableWithErasure(field, Node) && field.getKind() == ElementKind.INTERFACE) { throw new ElementException(field, "Input field type must be an interface or assignable to Node"); @@ -171,27 +192,26 @@ if (modifiers.contains(FINAL)) { throw new ElementException(field, "Input field must not be final"); } -// if (modifiers.contains(PRIVATE) || modifiers.contains(PUBLIC) || modifiers.contains(PROTECTED)) { -// throw new ElementException(field, "Input field must be package-private"); -// } - if (!modifiers.contains(PRIVATE)) { - throw new ElementException(field, "Input field must be private"); + if (modifiers.contains(PUBLIC) || modifiers.contains(PRIVATE)) { + throw new ElementException(field, "Input field must be protected or package-private"); } - if (!scanner.scanInputField(field, isOptionalInput, false)) { - return; - } + inputFields.add(field); + } + if (isOptionalInput) { + inputTypes.put(field, getAnnotationValue(VariableElement.class, findAnnotationMirror(annotations, OptionalInput), "value")); + optionalInputs.add(field); + } else { + inputTypes.put(field, getAnnotationValue(VariableElement.class, findAnnotationMirror(annotations, Input), "value")); } } else if (isSuccessor) { if (isAssignableWithErasure(field, NodeSuccessorList)) { - if (!modifiers.contains(FINAL)) { - throw new ElementException(field, "Successor list field must be final"); + if (modifiers.contains(FINAL)) { + throw new ElementException(field, "Successor list field must not be final"); } if (modifiers.contains(PUBLIC)) { throw new ElementException(field, "Successor list field must not be public"); } - if (!scanner.scanSuccessorField(field, true)) { - return; - } + successorListFields.add(field); } else { if (!isAssignableWithErasure(field, Node)) { throw new ElementException(field, "Successor field must be a Node type"); @@ -199,30 +219,23 @@ if (modifiers.contains(FINAL)) { throw new ElementException(field, "Successor field must not be final"); } -// if (modifiers.contains(PRIVATE) || modifiers.contains(PUBLIC) || modifiers.contains(PROTECTED)) { -// throw new ElementException(field, "Successor field must be package-private"); -// } - if (!modifiers.contains(PRIVATE)) { - throw new ElementException(field, "Successor field must be private"); + if (modifiers.contains(PUBLIC) || modifiers.contains(PRIVATE)) { + throw new ElementException(field, "Successor field must be protected or package-private"); } - if (!scanner.scanSuccessorField(field, false)) { - return; - } + successorFields.add(field); } } else { if (isAssignableWithErasure(field, Node) && !field.getSimpleName().contentEquals("Null")) { - throw new ElementException(field, "Suspicious Node field: " + field); + throw new ElementException(field, "Node field must be annotated with @" + Input.getSimpleName() + ", @" + OptionalInput.getSimpleName() + " or @" + Successor.getSimpleName()); } if (isAssignableWithErasure(field, NodeInputList)) { - throw new ElementException(field, "Suspicious NodeInputList field"); + throw new ElementException(field, "NodeInputList field must be annotated with @" + Input.getSimpleName() + " or @" + OptionalInput.getSimpleName()); } if (isAssignableWithErasure(field, NodeSuccessorList)) { - throw new ElementException(field, "Suspicious NodeSuccessorList field"); + throw new ElementException(field, "NodeSuccessorList field must be annotated with @" + Successor.getSimpleName()); } - if (!scanner.scanDataField(field)) { - return; - } + dataFields.add(field); } } currentClazz = getSuperType(currentClazz); @@ -236,7 +249,7 @@ private boolean parametersMatch(List<? extends VariableElement> p1, List<? extends VariableElement> p2) { if (p1.size() == p2.size()) { for (int i = 0; i < p1.size(); i++) { - if (!env.getProcessingEnv().getTypeUtils().isSameType(p1.get(i).asType(), p2.get(i).asType())) { + if (!types.isSameType(p1.get(i).asType(), p2.get(i).asType())) { return false; } } @@ -248,7 +261,7 @@ /** * Searches a type for a method based on a given name and parameter types. */ - public ExecutableElement findMethod(TypeElement type, String name, List<? extends VariableElement> parameters) { + private ExecutableElement findMethod(TypeElement type, String name, List<? extends VariableElement> parameters) { List<? extends ExecutableElement> methods = ElementFilter.methodsIn(type.getEnclosedElements()); for (ExecutableElement method : methods) { if (method.getSimpleName().toString().equals(name)) { @@ -260,38 +273,91 @@ return null; } - public CodeCompilationUnit process(TypeElement node) { + enum NodeRefsType { + Inputs, + Successors; + } + + CodeCompilationUnit process(TypeElement node) { + try { + return process0(node); + } finally { + reset(); + } + } + + private CodeCompilationUnit process0(TypeElement node) { CodeCompilationUnit compilationUnit = new CodeCompilationUnit(); PackageElement packageElement = ElementUtils.findPackageElement(node); - String newClassName = getGeneratedClassName(node); - - CodeTypeElement nodeGenElement = new CodeTypeElement(modifiers(), ElementKind.CLASS, packageElement, newClassName); - - nodeGenElement.setSuperClass(node.asType()); + genClassName = getGeneratedClassName(node); + genClass = new CodeTypeElement(modifiers(FINAL), ElementKind.CLASS, packageElement, genClassName); + genClass.setSuperClass(node.asType()); for (ExecutableElement constructor : ElementFilter.constructorsIn(node.getEnclosedElements())) { if (constructor.getModifiers().contains(PUBLIC)) { throw new ElementException(constructor, "Node class constructor must not be public"); } - checkFactoryMethodExists(node, newClassName, constructor); + checkFactoryMethodExists(node, constructor); - CodeExecutableElement subConstructor = createConstructor(nodeGenElement, constructor); + CodeExecutableElement subConstructor = createConstructor(genClass, constructor); subConstructor.getModifiers().removeAll(Arrays.asList(PUBLIC, PRIVATE, PROTECTED)); - nodeGenElement.add(subConstructor); + genClass.add(subConstructor); } - DeclaredType generatedNode = (DeclaredType) ElementUtils.getType(getProcessingEnv(), GeneratedNode.class); - CodeAnnotationMirror generatedByMirror = new CodeAnnotationMirror(generatedNode); - generatedByMirror.setElementValue(generatedByMirror.findExecutableElement("value"), new CodeAnnotationValue(node.asType())); - nodeGenElement.getAnnotationMirrors().add(generatedByMirror); + DeclaredType generatedNode = (DeclaredType) getType(GeneratedNode.class); + CodeAnnotationMirror generatedNodeMirror = new CodeAnnotationMirror(generatedNode); + generatedNodeMirror.setElementValue(generatedNodeMirror.findExecutableElement("value"), new CodeAnnotationValue(node.asType())); + genClass.getAnnotationMirrors().add(generatedNodeMirror); + + scanFields(node); + + boolean hasInputs = !inputFields.isEmpty() || !inputListFields.isEmpty(); + boolean hasSuccessors = !successorFields.isEmpty() || !successorListFields.isEmpty(); + + if (hasInputs || hasSuccessors) { + createGetNodeAtMethod(); + createGetInputTypeAtMethod(); + createGetNameOfMethod(); + createUpdateOrInitializeNodeAtMethod(false); + createUpdateOrInitializeNodeAtMethod(true); + createIsLeafNodeMethod(genClass); + + if (!inputListFields.isEmpty() || !successorListFields.isEmpty()) { + createGetNodeListAtMethod(); + createSetNodeListAtMethod(); + } + } - nodeGenElement.add(createIsLeafNodeMethod(node)); + if (hasInputs) { + createIsOptionalInputAtMethod(); + createGetFirstLevelPositionsMethod(Inputs, inputFields, inputListFields); + + createContainsMethod(Inputs, inputFields, inputListFields); + createIterableMethod(Inputs); + + CodeTypeElement inputsIteratorClass = createIteratorClass(Inputs, packageElement, inputFields, inputListFields); + createAllIteratorClass(Inputs, inputsIteratorClass.asType(), packageElement, inputFields, inputListFields); + createWithModCountIteratorClass(Inputs, inputsIteratorClass.asType(), packageElement); + createIterableClass(Inputs, packageElement); + } - compilationUnit.add(nodeGenElement); + if (hasSuccessors) { + createGetFirstLevelPositionsMethod(Successors, successorFields, successorListFields); + + createContainsMethod(Successors, successorFields, successorListFields); + createIterableMethod(Successors); + + CodeTypeElement successorsIteratorClass = createIteratorClass(Successors, packageElement, successorFields, successorListFields); + createAllIteratorClass(Successors, successorsIteratorClass.asType(), packageElement, successorFields, successorListFields); + createWithModCountIteratorClass(Successors, successorsIteratorClass.asType(), packageElement); + createIterableClass(Successors, packageElement); + } + + compilationUnit.add(genClass); return compilationUnit; } @@ -301,7 +367,7 @@ * * @throws ElementException if the check fails */ - private void checkFactoryMethodExists(TypeElement node, String newClassName, ExecutableElement constructor) { + private void checkFactoryMethodExists(TypeElement node, ExecutableElement constructor) { ExecutableElement create = findMethod(node, "create", constructor.getParameters()); if (create == null) { Formatter f = new Formatter(); @@ -313,7 +379,7 @@ callArgs.format("%s%s", sep, v.getSimpleName()); sep = ", "; } - f.format(") { return new %s(%s); }", newClassName, callArgs); + f.format(") { return new %s(%s); }", genClassName, callArgs); throw new ElementException(constructor, "Missing Node class factory method '%s'", f); } if (!create.getModifiers().containsAll(asList(PUBLIC, STATIC))) { @@ -339,27 +405,579 @@ return executable; } - public ExecutableElement createIsLeafNodeMethod(TypeElement node) { - CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), ElementUtils.getType(getProcessingEnv(), boolean.class), "isLeafNode"); - boolean[] isLeafNode = {true}; - scanFields(node, new FieldScanner() { + private void reset() { + inputFields.clear(); + inputListFields.clear(); + successorFields.clear(); + successorListFields.clear(); + dataFields.clear(); + optionalInputs.clear(); + inputTypes.clear(); + genClass = null; + genClassName = null; + } + + /** + * Checks that a generated method overrides exactly one method in a super type and that the + * super type is Node. + */ + private void checkOnlyInGenNode(CodeExecutableElement method) { + List<ExecutableElement> overriddenMethods = getDeclaredMethodsInSuperTypes(method.getEnclosingClass(), method.getSimpleName().toString(), method.getParameterTypes()); + for (ExecutableElement overriddenMethod : overriddenMethods) { + if (!overriddenMethod.getEnclosingElement().equals(Node)) { + env.message(Kind.WARNING, overriddenMethod, "This method is overridden in a generated subclass will never be called"); + } + } + } + + private void createIsLeafNodeMethod(CodeTypeElement cls) { + CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), getType(boolean.class), "isLeafNode"); + method.createBuilder().startReturn().string("false").end(); + cls.add(method); + checkOnlyInGenNode(method); + } + + private ExecutableElement createIsOptionalInputAtMethod() { + CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), getType(boolean.class), "isOptionalInputAt"); + method.addParameter(new CodeVariableElement(Position.asType(), "pos")); + CodeTreeBuilder b = method.createBuilder(); + b.startAssert().string("pos.isInput()").end(); + if (!optionalInputs.isEmpty()) { + b.startSwitch().string("pos.getIndex()").end().startBlock(); + int index = 0; + for (VariableElement f : concat(inputFields, inputListFields)) { + if (optionalInputs.contains(f)) { + b.startCase().string(String.valueOf(index)).end(); + } + index++; + } + b.startStatement().string("return true").end(); + b.end(); + } + b.startReturn().string("false").end(); + genClass.add(method); + checkOnlyInGenNode(method); + return method; + } + + private ExecutableElement createGetFirstLevelPositionsMethod(NodeRefsType nodeRefsType, List<VariableElement> nodeFields, List<VariableElement> nodeListFields) { + DeclaredType collectionOfPosition = types.getDeclaredType((TypeElement) types.asElement(getType(Collection.class)), Position.asType()); + CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), collectionOfPosition, "getFirstLevel" + nodeRefsType); + CodeTreeBuilder b = method.createBuilder(); + b.startReturn().startNew(getTypeElement("com.oracle.graal.graph.FirstLevelPositionCollection").asType()); + b.string(String.valueOf(nodeFields.size())); + b.string(String.valueOf(nodeListFields.size())); + b.string(String.valueOf(nodeRefsType == NodeRefsType.Inputs)); + b.end().end(); + genClass.add(method); + checkOnlyInGenNode(method); + return method; + } + + private CodeTypeElement createIteratorClass(NodeRefsType nodeRefsType, PackageElement packageElement, List<VariableElement> nodeFields, List<VariableElement> nodeListFields) { + String name = nodeRefsType + "Iterator"; + CodeTypeElement cls = new CodeTypeElement(modifiers(PRIVATE), ElementKind.CLASS, packageElement, name); + cls.setSuperClass(getType("com.oracle.graal.graph.NodeRefIterator")); + + // Constructor + CodeExecutableElement ctor = new CodeExecutableElement(Collections.emptySet(), null, name); + ctor.addParameter(new CodeVariableElement(getType(boolean.class), "callForward")); + CodeTreeBuilder b = ctor.createBuilder(); + b.startStatement().startSuperCall(); + b.string(String.valueOf(nodeFields.size())); + b.string(String.valueOf(nodeListFields.size())); + b.string(String.valueOf(nodeRefsType == NodeRefsType.Inputs)); + b.end().end(); + b.startIf().string("callForward").end().startBlock(); + b.startStatement().string("forward()").end(); + b.end(); + cls.add(ctor); + + // Methods overriding those in NodeRefIterator + createGetFieldMethod(cls, nodeFields, Node.asType(), "getNode"); + createGetFieldMethod(cls, nodeListFields, types.getDeclaredType(NodeList, types.getWildcardType(Node.asType(), null)), "getNodeList"); + genClass.add(cls); + return cls; + } + + private void createGetFieldMethod(CodeTypeElement cls, List<VariableElement> fields, TypeMirror returnType, String name) { + if (!fields.isEmpty()) { + CodeExecutableElement method = new CodeExecutableElement(modifiers(PROTECTED, FINAL), returnType, name); + method.addParameter(new CodeVariableElement(getType(int.class), "at")); + CodeTreeBuilder b = method.createBuilder(); + createGetFieldCases(b, fields, returnType, null); + cls.add(method); + } + } + + private void createGetFieldCases(CodeTreeBuilder b, List<VariableElement> fields, TypeMirror returnType, String returnExpressionSuffix) { + for (int i = 0; i < fields.size(); i++) { + VariableElement field = fields.get(i); + b.startIf().string("at == " + i).end().startBlock(); + b.startReturn(); + if (returnExpressionSuffix == null && !isAssignableWithErasure(field, types.asElement(returnType))) { + b.cast(((DeclaredType) returnType).asElement().getSimpleName().toString()); + } + b.string(genClassName + ".this." + field.getSimpleName()); + if (returnExpressionSuffix != null) { + b.string(returnExpressionSuffix); + } + b.end(); + b.end(); + } + b.startThrow().startNew(getType(NoSuchElementException.class)).end().end(); + } + + private void createSetNodeListAtCases(CodeTreeBuilder b, List<VariableElement> fields, TypeMirror returnType, String returnExpressionSuffix) { + for (int i = 0; i < fields.size(); i++) { + VariableElement field = fields.get(i); + b.startIf().string("at == " + i).end().startBlock(); + if (returnExpressionSuffix == null && !isAssignableWithErasure(field, types.asElement(returnType))) { + b.cast(((DeclaredType) returnType).asElement().getSimpleName().toString()); + } + b.startStatement(); + b.string(genClassName + ".this." + field.getSimpleName(), " = "); + b.cast(field.asType(), CodeTreeBuilder.singleString("list")); + b.end(); + b.end(); + } + } + + private void createUpdateOrInitializeFieldCases(CodeTreeBuilder b, List<VariableElement> fields, boolean isInitialization, boolean isList) { + boolean elseIf = false; + for (int i = 0; i < fields.size(); i++) { + VariableElement field = fields.get(i); + String fieldRef = genClassName + ".this." + field.getSimpleName(); + if (!isList) { + elseIf = b.startIf(elseIf); + b.string("at == " + i).end().startBlock(); + if (!isInitialization) { + b.startStatement().string("Node old = "); + if (!isAssignableWithErasure(field, Node)) { + b.cast(Node.asType(), CodeTreeBuilder.singleString(fieldRef)); + } else { + b.string(fieldRef); + } + b.end(); + } + b.startStatement().string(fieldRef, " = "); + if (!isAssignableWithErasure(Node, field)) { + b.cast(field.asType(), CodeTreeBuilder.singleString("newValue")); + } else { + b.string("newValue"); + } + b.end(); + if (!isInitialization) { + b.startIf().string("pos.isInput()").end().startBlock(); + b.startStatement().string("updateUsages(old, newValue)").end(); + b.end(); + b.startElseBlock(); + b.startStatement().string("updatePredecessor(old, newValue)").end(); + b.end(); + } + b.end(); + } else { + elseIf = b.startIf(elseIf); + b.string("at == " + i).end().startBlock(); + DeclaredType nodeListOfNode = types.getDeclaredType(NodeList, types.getWildcardType(Node.asType(), null)); + b.declaration(nodeListOfNode, "list", fieldRef); + if (!isInitialization) { + // if (pos.getSubIndex() < list.size()) { + b.startIf().string("pos.getSubIndex() < list.size()").end().startBlock(); + b.startStatement().string("list.set(pos.getSubIndex(), newValue)").end(); + b.end(); + b.startElseBlock(); + } + + b.startWhile().string("list.size() <= pos.getSubIndex()").end().startBlock(); + b.startStatement().string("list.add(null)").end(); + b.end(); + + if (isInitialization) { + b.startStatement().string("list.initialize(pos.getSubIndex(), newValue)").end(); + } else { + b.startStatement().string("list.add(newValue)").end(); + b.end(); + } + + b.end(); + } + } + b.startElseBlock(); + b.startThrow().startNew(getType(NoSuchElementException.class)).end().end(); + b.end(); + } + + private void createAllIteratorClass(NodeRefsType nodeRefsType, TypeMirror inputsIteratorType, PackageElement packageElement, List<VariableElement> nodeFields, List<VariableElement> nodeListFields) { + + String name = "All" + nodeRefsType + "Iterator"; + CodeTypeElement cls = new CodeTypeElement(modifiers(PRIVATE, FINAL), ElementKind.CLASS, packageElement, name); + cls.setSuperClass(inputsIteratorType); + + // Constructor + CodeExecutableElement ctor = new CodeExecutableElement(Collections.emptySet(), null, name); + CodeTreeBuilder b = ctor.createBuilder(); + b.startStatement().startSuperCall(); + b.string("true"); + b.end().end(); + cls.add(ctor); - @Override - public boolean scanInputField(VariableElement field, boolean isOptional, boolean isList) { - isLeafNode[0] = false; - return false; + // forward() method + CodeExecutableElement method = new CodeExecutableElement(modifiers(PROTECTED), getType(void.class), "forward"); + b = method.createBuilder(); + int nodeFieldsSize = nodeFields.size(); + int nodeListFieldsSize = nodeListFields.size(); + String cond = "index < " + nodeFieldsSize; + b.startIf().string(cond).end().startBlock(); + b.startStatement().string("index++").end(); + b.startIf().string(cond).end().startBlock(); + b.startStatement().string("return").end(); + b.end(); + b.end(); + b.startElseBlock(); + b.startStatement().string("subIndex++").end(); + b.end(); + DeclaredType nodeListOfNode = types.getDeclaredType(NodeList, types.getWildcardType(Node.asType(), null)); + int count = nodeFieldsSize + nodeListFieldsSize; + b.startWhile().string("index < " + count).end().startBlock(); + b.declaration(nodeListOfNode, "list", "getNodeList(index - " + nodeFieldsSize + ")"); + b.startIf().string("subIndex < list.size()").end().startBlock(); + b.startStatement().string("return").end(); + b.end(); + b.startStatement().string("subIndex = 0").end(); + b.startStatement().string("index++").end(); + b.end(); + + cls.add(method); + + genClass.add(cls); + } + + private void createWithModCountIteratorClass(NodeRefsType nodeRefsType, TypeMirror superType, PackageElement packageElement) { + + String name = nodeRefsType + "WithModCountIterator"; + CodeTypeElement cls = new CodeTypeElement(modifiers(PRIVATE, FINAL), ElementKind.CLASS, packageElement, name); + cls.setSuperClass(superType); + + // modCount field + cls.add(new CodeVariableElement(modifiers(PRIVATE, FINAL), getType(int.class), "modCount")); + + // Constructor + CodeExecutableElement ctor = new CodeExecutableElement(Collections.emptySet(), null, name); + CodeTreeBuilder b = ctor.createBuilder(); + b.startStatement().startSuperCall(); + b.string("false"); + b.end().end(); + b.startAssert().staticReference(getType("com.oracle.graal.graph.Graph"), "MODIFICATION_COUNTS_ENABLED").end(); + b.startStatement().string("this.modCount = modCount()").end(); + b.startStatement().string("forward()").end(); + cls.add(ctor); + + // hasNext, next and nextPosition methods + overrideModWithCounterMethod(cls, "hasNext", getType(boolean.class)); + overrideModWithCounterMethod(cls, "next", Node.asType()); + overrideModWithCounterMethod(cls, "nextPosition", Position.asType()); + + genClass.add(cls); + } + + private static void overrideModWithCounterMethod(CodeTypeElement cls, String name, TypeMirror returnType) { + CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), returnType, name); + CodeTreeBuilder b = method.createBuilder(); + b.startTryBlock(); + b.startStatement().string("return super." + name + "()").end(); + b.end().startFinallyBlock(); + b.startAssert().string("modCount == modCount() : \"must not be modified\"").end(); + b.end(); + cls.add(method); + } + + private void createIterableClass(NodeRefsType nodeRefsType, PackageElement packageElement) { + + String name = nodeRefsType + "Iterable"; + CodeTypeElement cls = new CodeTypeElement(modifiers(PRIVATE), ElementKind.CLASS, packageElement, name); + cls.getImplements().add(getType("com.oracle.graal.graph.NodeRefIterable")); + + // iterator() method + CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC, FINAL), getType("com.oracle.graal.graph.NodeRefIterator"), "iterator"); + CodeTreeBuilder b = method.createBuilder(); + b.startIf().staticReference(getType("com.oracle.graal.graph.Graph"), "MODIFICATION_COUNTS_ENABLED").end().startBlock(); + b.startStatement().string("return new " + nodeRefsType + "WithModCountIterator()").end(); + b.end(); + b.startElseBlock(); + b.startStatement().string("return new " + nodeRefsType + "Iterator(true)").end(); + b.end(); + cls.add(method); + + // withNullIterator() method + method = new CodeExecutableElement(modifiers(PUBLIC, FINAL), getType("com.oracle.graal.graph.NodeRefIterator"), "withNullIterator"); + b = method.createBuilder(); + b.startStatement().string("return new All" + nodeRefsType + "Iterator()").end(); + cls.add(method); + + // contains(Node) method + method = new CodeExecutableElement(modifiers(PUBLIC, FINAL), getType(boolean.class), "contains"); + method.addParameter(new CodeVariableElement(Node.asType(), "n")); + b = method.createBuilder(); + b.startStatement().string("return " + nodeRefsType.name().toLowerCase() + "Contain(n)").end(); + cls.add(method); + genClass.add(cls); + } + + private void createContainsMethod(NodeRefsType nodeRefsType, List<VariableElement> nodeFields, List<VariableElement> nodeListFields) { + CodeExecutableElement method = new CodeExecutableElement(modifiers(PRIVATE, FINAL), getType(boolean.class), nodeRefsType.name().toLowerCase() + "Contain"); + method.addParameter(new CodeVariableElement(Node.asType(), "n")); + CodeTreeBuilder b = method.createBuilder(); + for (VariableElement f : nodeFields) { + b.startIf().string("n == " + f).end().startBlock(); + b.startStatement().string("return true").end(); + b.end(); + } + for (VariableElement f : nodeListFields) { + b.startIf().string(f + ".contains(n)").end().startBlock(); + b.startStatement().string("return true").end(); + b.end(); + } + b.startStatement().string("return false").end(); + genClass.add(method); + checkOnlyInGenNode(method); + } + + private static final String API_TAG = "V2"; + + private void createIterableMethod(NodeRefsType nodeRefsType) { + CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC, FINAL), getType("com.oracle.graal.graph.NodeRefIterable"), (nodeRefsType == Inputs ? "inputs" : "successors") + + API_TAG); + CodeTreeBuilder b = method.createBuilder(); + b.startStatement().string("return new " + nodeRefsType + "Iterable()").end(); + genClass.add(method); + checkOnlyInGenNode(method); + } + + private void createGetNodeAtMethod() { + CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC, FINAL), Node.asType(), "getNodeAt"); + method.addParameter(new CodeVariableElement(Position.asType(), "pos")); + CodeTreeBuilder b = method.createBuilder(); + b.startIf().string("pos.isInput()").end().startBlock(); + createGetNodeAt(b, inputFields, inputListFields); + b.end(); + b.startElseBlock(); + createGetNodeAt(b, successorFields, successorListFields); + b.end(); + genClass.add(method); + checkOnlyInGenNode(method); + } + + private void createGetNodeListAtMethod() { + CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC, FINAL), types.getDeclaredType(NodeList, types.getWildcardType(Node.asType(), null)), "getNodeListAt"); + method.addParameter(new CodeVariableElement(Position.asType(), "pos")); + CodeTreeBuilder b = method.createBuilder(); + b.startIf().string("pos.isInput()").end().startBlock(); + createGetNodeListAt(b, inputFields, inputListFields); + b.end(); + b.startElseBlock(); + createGetNodeListAt(b, successorFields, successorListFields); + b.end(); + genClass.add(method); + checkOnlyInGenNode(method); + } + + private void createSetNodeListAtMethod() { + CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC, FINAL), getType(void.class), "SetNodeListAt"); + + DeclaredType suppress = (DeclaredType) getType(SuppressWarnings.class); + CodeAnnotationMirror suppressMirror = new CodeAnnotationMirror(suppress); + suppressMirror.setElementValue(suppressMirror.findExecutableElement("value"), new CodeAnnotationValue("unchecked")); + method.getAnnotationMirrors().add(suppressMirror); + + method.addParameter(new CodeVariableElement(Position.asType(), "pos")); + method.addParameter(new CodeVariableElement(types.getDeclaredType(NodeList, types.getWildcardType(Node.asType(), null)), "list")); + CodeTreeBuilder b = method.createBuilder(); + b.startIf().string("pos.isInput()").end().startBlock(); + createSetNodeListAt(b, inputFields, inputListFields); + b.end(); + b.startElseBlock(); + createSetNodeListAt(b, successorFields, successorListFields); + b.end(); + genClass.add(method); + checkOnlyInGenNode(method); + } + + private void createGetNameOfMethod() { + CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC, FINAL), getType(String.class), "getNameOf"); + method.addParameter(new CodeVariableElement(Position.asType(), "pos")); + CodeTreeBuilder b = method.createBuilder(); + + b.startIf().string("pos.isInput()").end().startBlock(); + createGetNameOf(b, inputFields, inputListFields); + b.end(); + b.startElseBlock(); + createGetNameOf(b, successorFields, successorListFields); + b.end(); + genClass.add(method); + checkOnlyInGenNode(method); + } + + private void createGetInputTypeAtMethod() { + CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC, FINAL), getType(InputType.class), "getInputTypeAt"); + method.addParameter(new CodeVariableElement(Position.asType(), "pos")); + CodeTreeBuilder b = method.createBuilder(); + b.startAssert().string("pos.isInput()").end(); + boolean hasNodes = !inputFields.isEmpty(); + boolean hasNodeLists = !inputListFields.isEmpty(); + if (hasNodeLists || hasNodes) { + int index = 0; + for (VariableElement f : concat(inputFields, inputListFields)) { + b.startIf().string("pos.getIndex() == " + index).end().startBlock(); + b.startStatement().string("return ").staticReference(getType(InputType.class), inputTypes.get(f).getSimpleName().toString()).end(); + b.end(); + index++; + } + } + b.startThrow().startNew(getType(NoSuchElementException.class)).end().end(); + genClass.add(method); + checkOnlyInGenNode(method); + } + + private boolean hidesField(String name) { + for (VariableElement field : concat(inputFields, inputListFields, successorFields, successorListFields, dataFields)) { + if (field.getSimpleName().contentEquals(name)) { + return true; + } + } + return false; + } + + private void createUpdateOrInitializeNodeAtMethod(boolean isInitialization) { + CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC, FINAL), getType(void.class), (isInitialization ? "initialize" : "update") + "NodeAt"); + method.addParameter(new CodeVariableElement(Position.asType(), "pos")); + CodeVariableElement newValue = new CodeVariableElement(Node.asType(), "newValue"); + if (hidesField(newValue.getSimpleName().toString())) { + DeclaredType suppress = (DeclaredType) getType(SuppressWarnings.class); + CodeAnnotationMirror suppressMirror = new CodeAnnotationMirror(suppress); + suppressMirror.setElementValue(suppressMirror.findExecutableElement("value"), new CodeAnnotationValue("hiding")); + newValue.getAnnotationMirrors().add(suppressMirror); + } + method.addParameter(newValue); + CodeTreeBuilder b = method.createBuilder(); + b.startIf().string("pos.isInput()").end().startBlock(); + createUpdateOrInitializeNodeAt(b, inputFields, inputListFields, isInitialization); + b.end(); + b.startElseBlock(); + createUpdateOrInitializeNodeAt(b, successorFields, successorListFields, isInitialization); + b.end(); + genClass.add(method); + checkOnlyInGenNode(method); + } + + private void createGetNodeAt(CodeTreeBuilder b, List<VariableElement> nodes, List<VariableElement> nodeLists) { + boolean hasNodes = !nodes.isEmpty(); + boolean hasNodeLists = !nodeLists.isEmpty(); + if (!hasNodeLists && !hasNodes) { + b.startThrow().startNew(getType(NoSuchElementException.class)).end().end(); + } else { + if (hasNodes) { + if (!hasNodeLists) { + b.startAssert().string("pos.getSubIndex() == NOT_ITERABLE").end(); + } else { + b.startIf().string("pos.getSubIndex() == NOT_ITERABLE").end().startBlock(); + } + b.declaration("int", "at", "pos.getIndex()"); + createGetFieldCases(b, nodes, Node.asType(), null); + if (hasNodeLists) { + b.end(); + } } - @Override - public boolean scanSuccessorField(VariableElement field, boolean isList) { - isLeafNode[0] = false; - return false; + if (hasNodeLists) { + if (!hasNodes) { + b.startAssert().string("pos.getSubIndex() != NOT_ITERABLE").end(); + } else { + b.startElseBlock(); + } + b.declaration("int", "at", "pos.getIndex() - " + nodes.size()); + createGetFieldCases(b, nodeLists, Node.asType(), ".get(pos.getSubIndex())"); + if (hasNodes) { + b.end(); + } } - }); + } + } + + private void createGetNodeListAt(CodeTreeBuilder b, List<VariableElement> nodes, List<VariableElement> nodeLists) { + boolean hasNodeLists = !nodeLists.isEmpty(); + if (!hasNodeLists) { + b.startThrow().startNew(getType(NoSuchElementException.class)).end().end(); + } else { + b.startAssert().string("pos.getSubIndex() == NODE_LIST").end(); + b.declaration("int", "at", "pos.getIndex() - " + nodes.size()); + createGetFieldCases(b, nodeLists, Node.asType(), ""); + } + } + + private void createSetNodeListAt(CodeTreeBuilder b, List<VariableElement> nodes, List<VariableElement> nodeLists) { + boolean hasNodeLists = !nodeLists.isEmpty(); + if (!hasNodeLists) { + b.startThrow().startNew(getType(NoSuchElementException.class)).end().end(); + } else { + b.startAssert().string("pos.getSubIndex() == NODE_LIST").end(); + b.declaration("int", "at", "pos.getIndex() - " + nodes.size()); + createSetNodeListAtCases(b, nodeLists, Node.asType(), ""); + } + } - CodeTreeBuilder builder = method.createBuilder(); - builder.startReturn().string(String.valueOf(isLeafNode[0])).end(); + private void createGetNameOf(CodeTreeBuilder b, List<VariableElement> nodes, List<VariableElement> nodeLists) { + boolean hasNodes = !nodes.isEmpty(); + boolean hasNodeLists = !nodeLists.isEmpty(); + if (hasNodeLists || hasNodes) { + int index = 0; + for (VariableElement f : nodes) { + b.startIf().string("pos.getIndex() == " + index).end().startBlock(); + b.startStatement().string("return \"" + f.getSimpleName() + "\"").end(); + b.end(); + index++; + } + for (VariableElement f : nodeLists) { + b.startIf().string("pos.getIndex() == " + index).end().startBlock(); + b.startStatement().string("return \"" + f.getSimpleName() + "\"").end(); + b.end(); + index++; + } + } + b.startThrow().startNew(getType(NoSuchElementException.class)).end().end(); + } - return method; + private void createUpdateOrInitializeNodeAt(CodeTreeBuilder b, List<VariableElement> nodes, List<VariableElement> nodeLists, boolean isInitialization) { + boolean hasNodes = !nodes.isEmpty(); + boolean hasNodeLists = !nodeLists.isEmpty(); + if (nodes.isEmpty() && nodeLists.isEmpty()) { + b.startThrow().startNew(getType(NoSuchElementException.class)).end().end(); + } else { + if (hasNodes) { + if (!hasNodeLists) { + b.startAssert().string("pos.getSubIndex() == NOT_ITERABLE").end(); + } else { + b.startIf().string("pos.getSubIndex() == NOT_ITERABLE").end().startBlock(); + } + b.declaration("int", "at", "pos.getIndex()"); + createUpdateOrInitializeFieldCases(b, nodes, isInitialization, false); + if (hasNodeLists) { + b.end(); + } + } + + if (hasNodeLists) { + if (!hasNodes) { + b.startAssert().string("pos.getSubIndex() != NOT_ITERABLE").end(); + } else { + b.startElseBlock(); + } + b.declaration("int", "at", "pos.getIndex() - " + nodes.size()); + createUpdateOrInitializeFieldCases(b, nodeLists, isInitialization, true); + if (hasNodes) { + b.end(); + } + } + } } }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractDeoptimizeNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractDeoptimizeNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -36,7 +36,7 @@ @NodeInfo public abstract class AbstractDeoptimizeNode extends ControlSinkNode implements IterableNodeType, DeoptimizingNode.DeoptBefore { - @OptionalInput(InputType.State) private FrameState stateBefore; + @OptionalInput(InputType.State) FrameState stateBefore; public AbstractDeoptimizeNode() { super(StampFactory.forVoid());
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractFixedGuardNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractFixedGuardNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -32,7 +32,7 @@ @NodeInfo public abstract class AbstractFixedGuardNode extends DeoptimizingFixedWithNextNode implements Simplifiable, GuardingNode { - @Input(InputType.Condition) private LogicNode condition; + @Input(InputType.Condition) LogicNode condition; private final DeoptimizationReason reason; private final DeoptimizationAction action; private boolean negated; @@ -85,17 +85,17 @@ } public DeoptimizeNode lowerToIf() { - FixedNode next = next(); + FixedNode currentNext = next(); setNext(null); DeoptimizeNode deopt = graph().add(DeoptimizeNode.create(action, reason)); deopt.setStateBefore(stateBefore()); IfNode ifNode; BeginNode noDeoptSuccessor; if (negated) { - ifNode = graph().add(IfNode.create(condition, deopt, next, 0)); + ifNode = graph().add(IfNode.create(condition, deopt, currentNext, 0)); noDeoptSuccessor = ifNode.falseSuccessor(); } else { - ifNode = graph().add(IfNode.create(condition, next, deopt, 1)); + ifNode = graph().add(IfNode.create(condition, currentNext, deopt, 1)); noDeoptSuccessor = ifNode.trueSuccessor(); } ((FixedWithNextNode) predecessor()).setNext(ifNode);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractStateSplit.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractStateSplit.java Fri Aug 22 15:56:51 2014 +0200 @@ -31,7 +31,7 @@ @NodeInfo public abstract class AbstractStateSplit extends FixedWithNextNode implements StateSplit { - @OptionalInput(InputType.State) private FrameState stateAfter; + @OptionalInput(InputType.State) protected FrameState stateAfter; public FrameState stateAfter() { return stateAfter;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginStateSplitNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginStateSplitNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -35,7 +35,7 @@ @NodeInfo public abstract class BeginStateSplitNode extends BeginNode implements StateSplit { - @OptionalInput(InputType.State) private FrameState stateAfter; + @OptionalInput(InputType.State) protected FrameState stateAfter; public BeginStateSplitNode() { }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BinaryOpLogicNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BinaryOpLogicNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -29,8 +29,8 @@ @NodeInfo public abstract class BinaryOpLogicNode extends LogicNode implements LIRLowerable, Canonicalizable.Binary<ValueNode> { - @Input private ValueNode x; - @Input private ValueNode y; + @Input protected ValueNode x; + @Input protected ValueNode y; public ValueNode getX() { return x;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -48,7 +48,7 @@ @NodeInfo public class BreakpointNode extends FixedWithNextNode implements LIRLowerable { - @Input private final NodeInputList<ValueNode> arguments; + @Input NodeInputList<ValueNode> arguments; public static BreakpointNode create(ValueNode[] arguments) { return new BreakpointNodeGen(arguments);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/CallTargetNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/CallTargetNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -43,7 +43,7 @@ } } - @Input private final NodeInputList<ValueNode> arguments; + @Input protected NodeInputList<ValueNode> arguments; private ResolvedJavaMethod targetMethod; private InvokeKind invokeKind;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConditionAnchorNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConditionAnchorNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -32,7 +32,7 @@ @NodeInfo(nameTemplate = "ConditionAnchor(!={p#negated})", allowedUsageTypes = {InputType.Guard}) public class ConditionAnchorNode extends FixedWithNextNode implements Canonicalizable.Unary<Node>, Lowerable, GuardingNode { - @Input(InputType.Condition) private LogicNode condition; + @Input(InputType.Condition) LogicNode condition; private boolean negated; public static ConditionAnchorNode create(LogicNode condition) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizingFixedWithNextNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizingFixedWithNextNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -28,7 +28,7 @@ @NodeInfo public abstract class DeoptimizingFixedWithNextNode extends FixedWithNextNode implements DeoptimizingNode.DeoptBefore { - @OptionalInput(InputType.State) private FrameState stateBefore; + @OptionalInput(InputType.State) protected FrameState stateBefore; public DeoptimizingFixedWithNextNode(Stamp stamp) { super(stamp);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DynamicDeoptimizeNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DynamicDeoptimizeNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -30,8 +30,8 @@ @NodeInfo public class DynamicDeoptimizeNode extends AbstractDeoptimizeNode implements LIRLowerable, Canonicalizable { - @Input private ValueNode actionAndReason; - @Input private ValueNode speculation; + @Input ValueNode actionAndReason; + @Input ValueNode speculation; public static DynamicDeoptimizeNode create(ValueNode actionAndReason, ValueNode speculation) { return new DynamicDeoptimizeNodeGen(actionAndReason, speculation);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -55,9 +55,9 @@ if (condition() instanceof LogicConstantNode) { LogicConstantNode c = (LogicConstantNode) condition(); if (c.getValue() == isNegated()) { - FixedNode next = this.next(); - if (next != null) { - tool.deleteBranch(next); + FixedNode currentNext = this.next(); + if (currentNext != null) { + tool.deleteBranch(currentNext); } DeoptimizeNode deopt = graph().add(DeoptimizeNode.create(getAction(), getReason()));
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedWithNextNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedWithNextNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -32,7 +32,7 @@ @NodeInfo public abstract class FixedWithNextNode extends FixedNode { - @Successor private FixedNode next; + @Successor protected FixedNode next; public FixedNode next() { return next;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FloatingAnchoredNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FloatingAnchoredNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -30,7 +30,7 @@ @NodeInfo public abstract class FloatingAnchoredNode extends FloatingNode { - @Input(InputType.Anchor) private AnchoringNode anchor; + @Input(InputType.Anchor) AnchoringNode anchor; public FloatingAnchoredNode(Stamp stamp) { super(stamp);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FloatingGuardedNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FloatingGuardedNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -30,7 +30,7 @@ @NodeInfo public abstract class FloatingGuardedNode extends FloatingNode implements GuardedNode { - @OptionalInput(InputType.Guard) private GuardingNode guard; + @OptionalInput(InputType.Guard) protected GuardingNode guard; public FloatingGuardedNode(Stamp stamp) { super(stamp);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java Fri Aug 22 15:56:51 2014 +0200 @@ -55,16 +55,16 @@ private boolean duringCall; - @OptionalInput(value = InputType.State) private FrameState outerFrameState; + @OptionalInput(value = InputType.State) FrameState outerFrameState; /** * Contains the locals, the expressions and the locked objects, in this order. */ - @OptionalInput private final NodeInputList<ValueNode> values; + @OptionalInput NodeInputList<ValueNode> values; - @OptionalInput(InputType.Association) private final NodeInputList<MonitorIdNode> monitorIds; + @OptionalInput(InputType.Association) NodeInputList<MonitorIdNode> monitorIds; - @Input(InputType.State) private final NodeInputList<EscapeObjectState> virtualObjectMappings; + @Input(InputType.State) NodeInputList<EscapeObjectState> virtualObjectMappings; /** * The bytecode index to which this frame state applies.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FullInfopointNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FullInfopointNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -31,7 +31,7 @@ */ @NodeInfo public class FullInfopointNode extends InfopointNode implements LIRLowerable, NodeWithState { - @Input(InputType.State) private FrameState state; + @Input(InputType.State) FrameState state; public static FullInfopointNode create(InfopointReason reason, FrameState state) { return new FullInfopointNodeGen(reason, state);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -44,7 +44,7 @@ @NodeInfo(nameTemplate = "Guard(!={p#negated}) {p#reason/s}", allowedUsageTypes = {InputType.Guard}) public class GuardNode extends FloatingAnchoredNode implements Canonicalizable, IterableNodeType, GuardingNode { - @Input(InputType.Condition) private LogicNode condition; + @Input(InputType.Condition) LogicNode condition; private final DeoptimizationReason reason; private Constant speculation; private DeoptimizationAction action;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardPhiNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardPhiNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -33,7 +33,7 @@ @NodeInfo(nameTemplate = "GuardPhi({i#values})", allowedUsageTypes = {InputType.Guard}) public class GuardPhiNode extends PhiNode implements GuardingNode { - @OptionalInput(InputType.Guard) final NodeInputList<ValueNode> values; + @OptionalInput(InputType.Guard) NodeInputList<ValueNode> values; public static GuardPhiNode create(MergeNode merge) { return new GuardPhiNodeGen(merge);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardProxyNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardProxyNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -31,7 +31,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Guard}) public class GuardProxyNode extends ProxyNode implements GuardingNode, Proxy, LIRLowerable { - @Input(InputType.Guard) private GuardingNode value; + @Input(InputType.Guard) GuardingNode value; public static GuardProxyNode create(GuardingNode value, BeginNode proxyPoint) { return new GuardProxyNodeGen(value, proxyPoint);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardedValueNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardedValueNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -39,7 +39,7 @@ @NodeInfo public class GuardedValueNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, IterableNodeType, Canonicalizable, ValueProxy { - @Input private ValueNode object; + @Input ValueNode object; private final Stamp piStamp; public static GuardedValueNode create(ValueNode object, GuardingNode guard, Stamp stamp) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -38,8 +38,8 @@ @NodeInfo(nameTemplate = "GuardingPi(!={p#negated}) {p#reason/s}") public class GuardingPiNode extends FixedWithNextNode implements Lowerable, Virtualizable, Canonicalizable, ValueProxy { - @Input private ValueNode object; - @Input(InputType.Condition) private LogicNode condition; + @Input ValueNode object; + @Input(InputType.Condition) LogicNode condition; private final DeoptimizationReason reason; private final DeoptimizationAction action; private final Stamp piStamp;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -47,9 +47,9 @@ @NodeInfo public class IfNode extends ControlSplitNode implements Simplifiable, LIRLowerable { - @Successor private BeginNode trueSuccessor; - @Successor private BeginNode falseSuccessor; - @Input(InputType.Condition) private LogicNode condition; + @Successor BeginNode trueSuccessor; + @Successor BeginNode falseSuccessor; + @Input(InputType.Condition) LogicNode condition; private double trueSuccessorProbability; public LogicNode condition() { @@ -233,7 +233,7 @@ graph().addBeforeFixed(this, trueNext); for (Node usage : trueNext.usages().snapshot()) { if (usage.isAlive()) { - if (usage.getNodeClass().valueNumberable() && !usage.getNodeClass().isLeafNode()) { + if (usage.getNodeClass().valueNumberable() && !usage.isLeafNode()) { Node newNode = graph().findDuplicate(usage); if (newNode != null) { usage.replaceAtUsages(newNode);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IndirectCallTargetNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IndirectCallTargetNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -32,7 +32,7 @@ @NodeInfo public class IndirectCallTargetNode extends LoweredCallTargetNode { - @Input private ValueNode computedAddress; + @Input protected ValueNode computedAddress; public static IndirectCallTargetNode create(ValueNode computedAddress, List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, CallingConvention.Type callType, InvokeKind invokeKind) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -39,9 +39,9 @@ @NodeInfo(nameTemplate = "Invoke#{p#targetMethod/s}", allowedUsageTypes = {InputType.Memory}) public class InvokeNode extends AbstractMemoryCheckpoint implements Invoke, LIRLowerable, MemoryCheckpoint.Single, IterableNodeType { - @Input(InputType.Extension) private CallTargetNode callTarget; - @OptionalInput(InputType.State) private FrameState stateDuring; - @OptionalInput(InputType.Guard) private GuardingNode guard; + @Input(InputType.Extension) CallTargetNode callTarget; + @OptionalInput(InputType.State) FrameState stateDuring; + @OptionalInput(InputType.Guard) GuardingNode guard; private final int bci; private boolean polymorphic; private boolean useForInlining; @@ -159,10 +159,10 @@ public void intrinsify(Node node) { assert !(node instanceof ValueNode) || node.isAllowedUsageType(InputType.Value) == isAllowedUsageType(InputType.Value) : "replacing " + this + " with " + node; CallTargetNode call = callTarget; - FrameState stateAfter = stateAfter(); + FrameState currentStateAfter = stateAfter(); if (node instanceof StateSplit) { StateSplit stateSplit = (StateSplit) node; - stateSplit.setStateAfter(stateAfter); + stateSplit.setStateAfter(currentStateAfter); } if (node instanceof FixedWithNextNode) { graph().replaceFixedWithFixed(this, (FixedWithNextNode) node); @@ -175,8 +175,8 @@ graph().replaceFixed(this, node); } GraphUtil.killWithUnusedFloatingInputs(call); - if (stateAfter.usages().isEmpty()) { - GraphUtil.killWithUnusedFloatingInputs(stateAfter); + if (currentStateAfter.usages().isEmpty()) { + GraphUtil.killWithUnusedFloatingInputs(currentStateAfter); } }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -37,12 +37,12 @@ private static final double EXCEPTION_PROBA = 1e-5; - @Successor private BeginNode next; - @Successor private BeginNode exceptionEdge; - @Input(InputType.Extension) private CallTargetNode callTarget; - @OptionalInput(InputType.State) private FrameState stateDuring; - @OptionalInput(InputType.State) private FrameState stateAfter; - @OptionalInput(InputType.Guard) private GuardingNode guard; + @Successor BeginNode next; + @Successor BeginNode exceptionEdge; + @Input(InputType.Extension) CallTargetNode callTarget; + @OptionalInput(InputType.State) FrameState stateDuring; + @OptionalInput(InputType.State) FrameState stateAfter; + @OptionalInput(InputType.Guard) GuardingNode guard; private final int bci; private boolean polymorphic; private boolean useForInlining;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNegationNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNegationNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -31,7 +31,7 @@ @NodeInfo public class LogicNegationNode extends LogicNode implements Canonicalizable.Unary<LogicNode> { - @Input(InputType.Condition) private LogicNode value; + @Input(InputType.Condition) LogicNode value; public static LogicNegationNode create(LogicNode value) { return new LogicNegationNodeGen(value);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -41,7 +41,7 @@ private double loopFrequency; private int nextEndIndex; private int unswitches; - @OptionalInput(InputType.Guard) private GuardingNode overflowGuard; + @OptionalInput(InputType.Guard) GuardingNode overflowGuard; public static LoopBeginNode create() { return new LoopBeginNodeGen(); @@ -193,10 +193,10 @@ public void removeExits() { for (LoopExitNode loopexit : loopExits().snapshot()) { loopexit.removeProxies(); - FrameState stateAfter = loopexit.stateAfter(); + FrameState loopStateAfter = loopexit.stateAfter(); graph().replaceFixedWithFixed(loopexit, graph().add(BeginNode.create())); - if (stateAfter != null && stateAfter.isAlive() && stateAfter.usages().isEmpty()) { - GraphUtil.killWithUnusedFloatingInputs(stateAfter); + if (loopStateAfter != null && loopStateAfter.isAlive() && loopStateAfter.usages().isEmpty()) { + GraphUtil.killWithUnusedFloatingInputs(loopStateAfter); } } }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopEndNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopEndNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -31,7 +31,7 @@ @NodeInfo public class LoopEndNode extends AbstractEndNode { - @Input(InputType.Association) private LoopBeginNode loopBegin; + @Input(InputType.Association) LoopBeginNode loopBegin; private boolean canSafepoint; private int endIndex;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopExitNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopExitNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -29,7 +29,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Association}) public class LoopExitNode extends BeginStateSplitNode implements IterableNodeType { - @Input(InputType.Association) private LoopBeginNode loopBegin; + @Input(InputType.Association) LoopBeginNode loopBegin; public static LoopExitNode create(LoopBeginNode loop) { return new LoopExitNodeGen(loop);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryMapNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryMapNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -38,7 +38,7 @@ public class MemoryMapNode extends FloatingNode implements MemoryMap, LIRLowerable { private final List<LocationIdentity> locationIdentities; - @Input(InputType.Memory) private final NodeInputList<ValueNode> nodes; + @Input(InputType.Memory) NodeInputList<ValueNode> nodes; private boolean checkOrder(Map<LocationIdentity, MemoryNode> mmap) { for (int i = 0; i < locationIdentities.size(); i++) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryPhiNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryPhiNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -34,7 +34,7 @@ @NodeInfo(nameTemplate = "MemoryPhi({i#values}) {p#locationIdentity/s}", allowedUsageTypes = {InputType.Memory}) public class MemoryPhiNode extends PhiNode implements MemoryNode { - @Input(InputType.Memory) final NodeInputList<ValueNode> values; + @Input(InputType.Memory) NodeInputList<ValueNode> values; private final LocationIdentity locationIdentity; public static MemoryPhiNode create(MergeNode merge, LocationIdentity locationIdentity) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -50,7 +50,7 @@ MergeNode() { } - @Input(InputType.Association) private final NodeInputList<AbstractEndNode> ends = new NodeInputList<>(this); + @Input(InputType.Association) NodeInputList<AbstractEndNode> ends = new NodeInputList<>(this); @Override public void generate(NodeLIRBuilderTool gen) { @@ -149,9 +149,9 @@ */ @Override public void simplify(SimplifierTool tool) { - FixedNode next = next(); - if (next instanceof AbstractEndNode) { - AbstractEndNode origLoopEnd = (AbstractEndNode) next; + FixedNode currentNext = next(); + if (currentNext instanceof AbstractEndNode) { + AbstractEndNode origLoopEnd = (AbstractEndNode) currentNext; MergeNode merge = origLoopEnd.merge(); if (merge instanceof LoopBeginNode && !(origLoopEnd instanceof LoopEndNode)) { return; @@ -203,8 +203,8 @@ } } graph().reduceTrivialMerge(this); - } else if (next instanceof ReturnNode) { - ReturnNode returnNode = (ReturnNode) next; + } else if (currentNext instanceof ReturnNode) { + ReturnNode returnNode = (ReturnNode) currentNext; if (anchored().isNotEmpty() || returnNode.getMemoryMap() != null) { return; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -39,7 +39,7 @@ @NodeInfo public abstract class PhiNode extends FloatingNode implements Simplifiable { - @Input(InputType.Association) private MergeNode merge; + @Input(InputType.Association) MergeNode merge; protected PhiNode(Stamp stamp, MergeNode merge) { super(stamp);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiArrayNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiArrayNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -37,7 +37,7 @@ @NodeInfo public class PiArrayNode extends PiNode implements ArrayLengthProvider { - @Input private ValueNode length; + @Input ValueNode length; public ValueNode length() { return length;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -44,7 +44,7 @@ @NodeInfo public class PiNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, IterableNodeType, Canonicalizable, ValueProxy { - @Input private ValueNode object; + @Input ValueNode object; private final Stamp piStamp; public ValueNode object() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -36,7 +36,7 @@ @NodeInfo public abstract class ProxyNode extends FloatingNode implements IterableNodeType, ValueNumberable { - @Input(InputType.Association) private BeginNode proxyPoint; + @Input(InputType.Association) BeginNode proxyPoint; public ProxyNode(Stamp stamp, BeginNode proxyPoint) { super(stamp);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ReturnNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ReturnNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -30,8 +30,8 @@ @NodeInfo public class ReturnNode extends ControlSinkNode implements LIRLowerable, IterableNodeType { - @OptionalInput private ValueNode result; - @OptionalInput(InputType.Extension) private MemoryMapNode memoryMap; + @OptionalInput ValueNode result; + @OptionalInput(InputType.Extension) MemoryMapNode memoryMap; public ValueNode result() { return result;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ShortCircuitOrNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ShortCircuitOrNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -29,8 +29,8 @@ @NodeInfo public class ShortCircuitOrNode extends LogicNode implements IterableNodeType, Canonicalizable.Binary<LogicNode> { - @Input(InputType.Condition) private LogicNode x; - @Input(InputType.Condition) private LogicNode y; + @Input(InputType.Condition) LogicNode x; + @Input(InputType.Condition) LogicNode y; private boolean xNegated; private boolean yNegated; private double shortCircuitProbability;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnaryOpLogicNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnaryOpLogicNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -29,7 +29,7 @@ @NodeInfo public abstract class UnaryOpLogicNode extends LogicNode implements LIRLowerable, Canonicalizable.Unary<ValueNode> { - @Input private ValueNode value; + @Input protected ValueNode value; public ValueNode getValue() { return value;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -33,7 +33,7 @@ @NodeInfo public class UnwindNode extends ControlSinkNode implements Lowerable, LIRLowerable { - @Input private ValueNode exception; + @Input ValueNode exception; public ValueNode exception() { return exception;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValuePhiNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValuePhiNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -33,7 +33,7 @@ @NodeInfo(nameTemplate = "ValuePhi({i#values})") public class ValuePhiNode extends PhiNode { - @Input final NodeInputList<ValueNode> values; + @Input NodeInputList<ValueNode> values; /** * Create a value phi with the specified stamp.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -30,7 +30,7 @@ @NodeInfo public class ValueProxyNode extends ProxyNode implements Canonicalizable, Virtualizable, ValueAndStampProxy { - @Input private ValueNode value; + @Input ValueNode value; public static ValueProxyNode create(ValueNode value, BeginNode proxyPoint) { return new ValueProxyNodeGen(value, proxyPoint);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -35,8 +35,8 @@ @NodeInfo public abstract class BinaryNode extends FloatingNode implements Canonicalizable.Binary<ValueNode> { - @Input private ValueNode x; - @Input private ValueNode y; + @Input protected ValueNode x; + @Input protected ValueNode y; public ValueNode getX() { return x;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -40,9 +40,9 @@ @NodeInfo public class ConditionalNode extends FloatingNode implements Canonicalizable, LIRLowerable { - @Input(InputType.Condition) private LogicNode condition; - @Input private ValueNode trueValue; - @Input private ValueNode falseValue; + @Input(InputType.Condition) LogicNode condition; + @Input ValueNode trueValue; + @Input ValueNode falseValue; public LogicNode condition() { return condition;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FixedBinaryNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FixedBinaryNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -30,8 +30,8 @@ @NodeInfo public abstract class FixedBinaryNode extends DeoptimizingFixedWithNextNode implements Canonicalizable.Binary<ValueNode> { - @Input private ValueNode x; - @Input private ValueNode y; + @Input ValueNode x; + @Input ValueNode y; public FixedBinaryNode(Stamp stamp, ValueNode x, ValueNode y) { super(stamp);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatAddNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatAddNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -67,6 +67,7 @@ // Constant 0.0 can't be eliminated since it can affect the sign of the result. // Constant -0.0 is an additive identity. if (forY.isConstant()) { + @SuppressWarnings("hiding") Constant y = forY.asConstant(); switch (y.getKind()) { case Float:
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatDivNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatDivNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -58,6 +58,7 @@ return ConstantNode.forPrimitive(evalConst(forX.asConstant(), forY.asConstant())); } if (forY.isConstant()) { + @SuppressWarnings("hiding") Constant y = forY.asConstant(); switch (y.getKind()) { case Float:
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatMulNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatMulNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -65,6 +65,7 @@ return ConstantNode.forPrimitive(evalConst(forX.asConstant(), forY.asConstant())); } if (forY.isConstant()) { + @SuppressWarnings("hiding") Constant y = forY.asConstant(); switch (y.getKind()) { case Float:
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatSubNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatSubNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -67,6 +67,7 @@ } // Constant -0.0 is an additive identity, so (-0.0) - x == (-0.0) + (-x) == -x. if (forX.isConstant()) { + @SuppressWarnings("hiding") Constant x = forX.asConstant(); switch (x.getKind()) { case Float: @@ -86,6 +87,7 @@ // Constant -0.0 can't be eliminated since it can affect the sign of the result. // Constant 0.0 is a subtractive identity. if (forY.isConstant()) { + @SuppressWarnings("hiding") Constant y = forY.asConstant(); switch (y.getKind()) { case Float:
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerConvertNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerConvertNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -60,7 +60,7 @@ } } - protected ValueNode canonicalConvert(ValueNode value) { + protected ValueNode canonicalConvert(@SuppressWarnings("hiding") ValueNode value) { if (value.stamp() instanceof IntegerStamp) { int inputBits = ((IntegerStamp) value.stamp()).getBits(); if (inputBits == resultBits) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -50,6 +50,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { if (forX.isConstant() && forY.isConstant()) { + @SuppressWarnings("hiding") long y = forY.asConstant().asLong(); if (y == 0) { return this; // this will trap, can not canonicalize
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -49,6 +49,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { if (forX.isConstant() && forY.isConstant()) { + @SuppressWarnings("hiding") long y = forY.asConstant().asLong(); if (y == 0) { return this; // this will trap, can not canonicalize
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -58,6 +58,7 @@ return Constant.forPrimitiveInt(PrimitiveStamp.getBits(stamp()), inputs[0].asLong() - inputs[1].asLong()); } + @SuppressWarnings("hiding") @Override public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { if (GraphUtil.unproxify(forX) == GraphUtil.unproxify(forY)) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnaryNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnaryNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -34,7 +34,7 @@ @NodeInfo public abstract class UnaryNode extends FloatingNode implements Canonicalizable.Unary<ValueNode> { - @Input private ValueNode value; + @Input protected ValueNode value; public ValueNode getValue() { return value;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -38,7 +38,7 @@ @NodeInfo public class DynamicCounterNode extends FixedWithNextNode implements Lowerable { - @Input private ValueNode increment; + @Input ValueNode increment; private final String name; private final String group;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/WeakCounterNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/WeakCounterNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -36,7 +36,7 @@ @NodeInfo public class WeakCounterNode extends DynamicCounterNode implements Simplifiable, Virtualizable { - @Input private ValueNode checkedValue; + @Input ValueNode checkedValue; public static WeakCounterNode create(String group, String name, ValueNode increment, boolean addContext, ValueNode checkedValue) { return new WeakCounterNodeGen(group, name, increment, addContext, checkedValue);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AbstractWriteNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AbstractWriteNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -31,9 +31,9 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public abstract class AbstractWriteNode extends FixedAccessNode implements StateSplit, MemoryCheckpoint.Single, MemoryAccess, GuardingNode { - @Input private ValueNode value; - @OptionalInput(InputType.State) private FrameState stateAfter; - @OptionalInput(InputType.Memory) private Node lastLocationAccess; + @Input ValueNode value; + @OptionalInput(InputType.State) FrameState stateAfter; + @OptionalInput(InputType.Memory) Node lastLocationAccess; private final boolean initialization;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -40,8 +40,8 @@ @NodeInfo(nameTemplate = "AddLoc {p#locationIdentity/s}") public class AddLocationNode extends LocationNode implements Canonicalizable.Binary<LocationNode> { - @Input(InputType.Association) private ValueNode x; - @Input(InputType.Association) private ValueNode y; + @Input(InputType.Association) ValueNode x; + @Input(InputType.Association) ValueNode y; public LocationNode getX() { return (LocationNode) x;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -50,8 +50,8 @@ public static final double VERY_FAST_PATH_PROBABILITY = 0.999; public static final double VERY_SLOW_PATH_PROBABILITY = 1 - VERY_FAST_PATH_PROBABILITY; - @Input private ValueNode probability; - @Input private ValueNode condition; + @Input ValueNode probability; + @Input ValueNode condition; public static BranchProbabilityNode create(ValueNode probability, ValueNode condition) { return new BranchProbabilityNodeGen(probability, condition);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BytecodeExceptionNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BytecodeExceptionNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -37,7 +37,7 @@ public class BytecodeExceptionNode extends AbstractMemoryCheckpoint implements Lowerable, MemoryCheckpoint.Single { private final Class<? extends Throwable> exceptionClass; - @Input private final NodeInputList<ValueNode> arguments; + @Input NodeInputList<ValueNode> arguments; public static BytecodeExceptionNode create(MetaAccessProvider metaAccess, Class<? extends Throwable> exceptionClass, ValueNode... arguments) { return new BytecodeExceptionNodeGen(metaAccess, exceptionClass, arguments);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ComputeAddressNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ComputeAddressNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -32,8 +32,8 @@ @NodeInfo public class ComputeAddressNode extends FloatingNode implements LIRLowerable { - @Input private ValueNode object; - @Input(InputType.Association) private ValueNode location; + @Input ValueNode object; + @Input(InputType.Association) ValueNode location; public ValueNode getObject() { return object;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FixedAccessNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FixedAccessNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -33,9 +33,9 @@ @NodeInfo public abstract class FixedAccessNode extends DeoptimizingFixedWithNextNode implements Access { - @OptionalInput(InputType.Guard) private GuardingNode guard; - @Input private ValueNode object; - @Input(InputType.Association) private ValueNode location; + @OptionalInput(InputType.Guard) protected GuardingNode guard; + @Input protected ValueNode object; + @Input(InputType.Association) protected ValueNode location; private boolean nullCheck; private BarrierType barrierType;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FixedValueAnchorNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FixedValueAnchorNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -30,7 +30,7 @@ @NodeInfo public class FixedValueAnchorNode extends FixedWithNextNode implements LIRLowerable, ValueProxy { - @Input private ValueNode object; + @Input ValueNode object; public ValueNode object() { return object;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingAccessNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingAccessNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -30,8 +30,8 @@ @NodeInfo public abstract class FloatingAccessNode extends FloatingGuardedNode implements Access, MemoryAccess { - @Input private ValueNode object; - @Input(InputType.Association) private LocationNode location; + @Input ValueNode object; + @Input(InputType.Association) LocationNode location; private BarrierType barrierType; public ValueNode object() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -37,7 +37,7 @@ @NodeInfo public class FloatingReadNode extends FloatingAccessNode implements IterableNodeType, LIRLowerable, Canonicalizable { - @OptionalInput(InputType.Memory) private MemoryNode lastLocationAccess; + @OptionalInput(InputType.Memory) MemoryNode lastLocationAccess; public static FloatingReadNode create(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp) { return new FloatingReadNodeGen(object, location, lastLocationAccess, stamp);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -38,8 +38,8 @@ @NodeInfo(nameTemplate = "ForeignCall#{p#descriptor/s}", allowedUsageTypes = {InputType.Memory}) public class ForeignCallNode extends AbstractMemoryCheckpoint implements LIRLowerable, DeoptimizingNode.DeoptDuring, MemoryCheckpoint.Multi { - @Input private final NodeInputList<ValueNode> arguments; - @OptionalInput(InputType.State) private FrameState stateDuring; + @Input protected NodeInputList<ValueNode> arguments; + @OptionalInput(InputType.State) protected FrameState stateDuring; private final ForeignCallsProvider foreignCalls; private final ForeignCallDescriptor descriptor; @@ -129,12 +129,13 @@ } @Override - public void computeStateDuring(FrameState stateAfter) { + public void computeStateDuring(FrameState currentStateAfter) { FrameState newStateDuring; - if ((stateAfter.stackSize() > 0 && stateAfter.stackAt(stateAfter.stackSize() - 1) == this) || (stateAfter.stackSize() > 1 && stateAfter.stackAt(stateAfter.stackSize() - 2) == this)) { - newStateDuring = stateAfter.duplicateModified(stateAfter.bci, stateAfter.rethrowException(), this.getKind()); + if ((currentStateAfter.stackSize() > 0 && currentStateAfter.stackAt(currentStateAfter.stackSize() - 1) == this) || + (currentStateAfter.stackSize() > 1 && currentStateAfter.stackAt(currentStateAfter.stackSize() - 2) == this)) { + newStateDuring = currentStateAfter.duplicateModified(currentStateAfter.bci, currentStateAfter.rethrowException(), this.getKind()); } else { - newStateDuring = stateAfter; + newStateDuring = currentStateAfter; } setStateDuring(newStateDuring); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -44,7 +44,7 @@ private final Kind valueKind; private final LocationIdentity locationIdentity; private final long displacement; - @Input private ValueNode index; + @Input ValueNode index; private final int indexScaling; /**
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -37,7 +37,7 @@ @NodeInfo public class LoadHubNode extends FloatingGuardedNode implements Lowerable, Canonicalizable, Virtualizable { - @Input private ValueNode value; + @Input ValueNode value; public ValueNode getValue() { return value;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -37,7 +37,7 @@ @NodeInfo public class LoadMethodNode extends FixedWithNextNode implements Lowerable, Canonicalizable { - @Input private ValueNode hub; + @Input ValueNode hub; private final ResolvedJavaMethod method; private final ResolvedJavaType receiverType;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/NullCheckNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/NullCheckNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -30,7 +30,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Guard}) public class NullCheckNode extends DeoptimizingFixedWithNextNode implements LIRLowerable, GuardingNode { - @Input private ValueNode object; + @Input ValueNode object; public static NullCheckNode create(ValueNode object) { return new NullCheckNodeGen(object);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -85,10 +85,9 @@ @Override public Node canonical(CanonicalizerTool tool) { if (usages().isEmpty()) { - GuardingNode guard = getGuard(); - if (guard != null && !(guard instanceof FixedNode)) { + if (getGuard() != null && !(getGuard() instanceof FixedNode)) { // The guard is necessary even if the read goes away. - return ValueAnchorNode.create((ValueNode) guard); + return ValueAnchorNode.create((ValueNode) getGuard()); } else { // Read without usages or guard can be safely removed. return null;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/StoreHubNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/StoreHubNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -30,8 +30,8 @@ @NodeInfo public class StoreHubNode extends FixedWithNextNode implements Lowerable { - @Input private ValueNode value; - @Input private ValueNode object; + @Input ValueNode value; + @Input ValueNode object; public ValueNode getValue() { return value;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -37,8 +37,8 @@ @NodeInfo public abstract class SwitchNode extends ControlSplitNode { - @Successor private final NodeSuccessorList<BeginNode> successors; - @Input private ValueNode value; + @Successor protected NodeSuccessorList<BeginNode> successors; + @Input protected ValueNode value; // do not change the contents of these arrays: private final double[] keyProbabilities;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeAccessNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeAccessNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -33,8 +33,8 @@ @NodeInfo public abstract class UnsafeAccessNode extends FixedWithNextNode implements Canonicalizable { - @Input private ValueNode object; - @Input private ValueNode offset; + @Input ValueNode object; + @Input ValueNode offset; private final Kind accessKind; private final LocationIdentity locationIdentity;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -40,7 +40,7 @@ @NodeInfo public class UnsafeCastNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, GuardingNode, IterableNodeType, Canonicalizable, ValueProxy { - @Input private ValueNode object; + @Input ValueNode object; public static UnsafeCastNode create(ValueNode object, Stamp stamp) { return new UnsafeCastNodeGen(object, stamp);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -37,7 +37,7 @@ */ @NodeInfo public class UnsafeLoadNode extends UnsafeAccessNode implements Lowerable, Virtualizable { - @OptionalInput(InputType.Condition) private LogicNode guardingCondition; + @OptionalInput(InputType.Condition) LogicNode guardingCondition; public static UnsafeLoadNode create(ValueNode object, ValueNode offset, Kind accessKind, LocationIdentity locationIdentity) { return new UnsafeLoadNodeGen(object, offset, accessKind, locationIdentity); @@ -71,8 +71,8 @@ if (state != null && state.getState() == EscapeState.Virtual) { ValueNode offsetValue = tool.getReplacedValue(offset()); if (offsetValue.isConstant()) { - long offset = offsetValue.asConstant().asLong(); - int entryIndex = state.getVirtualObject().entryIndexForOffset(offset); + long off = offsetValue.asConstant().asLong(); + int entryIndex = state.getVirtualObject().entryIndexForOffset(off); if (entryIndex != -1) { ValueNode entry = state.getEntry(entryIndex); if (entry.getKind() == getKind() || state.getVirtualObject().entryKind(entryIndex) == accessKind()) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -38,8 +38,8 @@ @NodeInfo public class UnsafeStoreNode extends UnsafeAccessNode implements StateSplit, Lowerable, Virtualizable, MemoryCheckpoint.Single { - @Input private ValueNode value; - @OptionalInput(InputType.State) private FrameState stateAfter; + @Input ValueNode value; + @OptionalInput(InputType.State) FrameState stateAfter; public static UnsafeStoreNode create(ValueNode object, ValueNode offset, ValueNode value, Kind accessKind, LocationIdentity locationIdentity) { return new UnsafeStoreNodeGen(object, offset, value, accessKind, locationIdentity); @@ -89,8 +89,8 @@ if (state != null && state.getState() == EscapeState.Virtual) { ValueNode indexValue = tool.getReplacedValue(offset()); if (indexValue.isConstant()) { - long offset = indexValue.asConstant().asLong(); - int entryIndex = state.getVirtualObject().entryIndexForOffset(offset); + long off = indexValue.asConstant().asLong(); + int entryIndex = state.getVirtualObject().entryIndexForOffset(off); if (entryIndex != -1) { Kind entryKind = state.getVirtualObject().entryKind(entryIndex); ValueNode entry = state.getEntry(entryIndex); @@ -99,7 +99,7 @@ tool.delete(); } else { if ((accessKind() == Kind.Long || accessKind() == Kind.Double) && entryKind == Kind.Int) { - int nextIndex = state.getVirtualObject().entryIndexForOffset(offset + 4); + int nextIndex = state.getVirtualObject().entryIndexForOffset(off + 4); if (nextIndex != -1) { Kind nextKind = state.getVirtualObject().entryKind(nextIndex); if (nextKind == Kind.Int) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -36,7 +36,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Anchor, InputType.Guard}) public class ValueAnchorNode extends FixedWithNextNode implements LIRLowerable, Simplifiable, Virtualizable, AnchoringNode, GuardingNode { - @OptionalInput(InputType.Guard) private ValueNode anchored; + @OptionalInput(InputType.Guard) ValueNode anchored; public static ValueAnchorNode create(ValueNode value) { return new ValueAnchorNodeGen(value); @@ -70,13 +70,13 @@ } } if (usages().isEmpty() && next() instanceof FixedAccessNode) { - FixedAccessNode next = (FixedAccessNode) next(); - if (next.getGuard() == anchored) { + FixedAccessNode currentNext = (FixedAccessNode) next(); + if (currentNext.getGuard() == anchored) { GraphUtil.removeFixedWithUnusedInputs(this); return; - } else if (next.getGuard() == null && anchored instanceof GuardNode && ((GuardNode) anchored).condition() instanceof IsNullNode) { + } else if (currentNext.getGuard() == null && anchored instanceof GuardNode && ((GuardNode) anchored).condition() instanceof IsNullNode) { // coalesce null check guards into subsequent read/write - next.setGuard((GuardingNode) anchored); + currentNext.setGuard((GuardingNode) anchored); tool.addToWorkList(next()); return; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewArrayNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewArrayNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -34,7 +34,7 @@ @NodeInfo public class AbstractNewArrayNode extends AbstractNewObjectNode implements ArrayLengthProvider { - @Input private ValueNode length; + @Input ValueNode length; @Override public ValueNode length() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessArrayNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessArrayNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -32,7 +32,7 @@ @NodeInfo public abstract class AccessArrayNode extends FixedWithNextNode { - @Input private ValueNode array; + @Input protected ValueNode array; public ValueNode array() { return array; @@ -40,7 +40,7 @@ /** * Creates a new AccessArrayNode. - * + * * @param array the instruction that produces the array object value */ public AccessArrayNode(Stamp stamp, ValueNode array) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -34,7 +34,7 @@ @NodeInfo public abstract class AccessFieldNode extends FixedWithNextNode implements Lowerable { - @OptionalInput private ValueNode object; + @OptionalInput ValueNode object; protected final ResolvedJavaField field;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -35,7 +35,7 @@ @NodeInfo public abstract class AccessIndexedNode extends AccessArrayNode implements Lowerable { - @Input private ValueNode index; + @Input protected ValueNode index; private final Kind elementKind; public ValueNode index() { @@ -44,7 +44,7 @@ /** * Create an new AccessIndexedNode. - * + * * @param stamp the result kind of the access * @param array the instruction producing the array * @param index the instruction producing the index @@ -58,7 +58,7 @@ /** * Gets the element type of the array. - * + * * @return the element type */ public Kind elementKind() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessMonitorNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessMonitorNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -37,9 +37,9 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public abstract class AccessMonitorNode extends AbstractMemoryCheckpoint implements MemoryCheckpoint, DeoptimizingNode.DeoptBefore, DeoptimizingNode.DeoptAfter { - @OptionalInput(InputType.State) private FrameState stateBefore; - @Input private ValueNode object; - @Input(InputType.Association) private MonitorIdNode monitorId; + @OptionalInput(InputType.State) FrameState stateBefore; + @Input ValueNode object; + @Input(InputType.Association) MonitorIdNode monitorId; @Override public boolean canDeoptimize() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -36,7 +36,7 @@ @NodeInfo public class ArrayLengthNode extends FixedWithNextNode implements Canonicalizable.Unary<ValueNode>, Lowerable, Virtualizable { - @Input private ValueNode array; + @Input ValueNode array; public ValueNode array() { return array;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndAddNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndAddNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -38,9 +38,9 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public class AtomicReadAndAddNode extends AbstractMemoryCheckpoint implements LIRLowerable, MemoryCheckpoint.Single { - @Input private ValueNode object; - @Input private ValueNode offset; - @Input private ValueNode delta; + @Input ValueNode object; + @Input ValueNode offset; + @Input ValueNode delta; private final LocationIdentity locationIdentity;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndWriteNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndWriteNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -39,9 +39,9 @@ @NodeInfo public class AtomicReadAndWriteNode extends AbstractMemoryCheckpoint implements Lowerable, MemoryCheckpoint.Single { - @Input private ValueNode object; - @Input private ValueNode offset; - @Input private ValueNode newValue; + @Input ValueNode object; + @Input ValueNode offset; + @Input ValueNode newValue; private final Kind valueKind; private final LocationIdentity locationIdentity;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -36,8 +36,8 @@ @NodeInfo public class CheckCastDynamicNode extends FixedWithNextNode implements Canonicalizable.Binary<ValueNode>, Lowerable { - @Input private ValueNode object; - @Input private ValueNode hub; + @Input ValueNode object; + @Input ValueNode hub; /** * Determines the exception thrown by this node if the check fails: {@link ClassCastException}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -43,7 +43,7 @@ @NodeInfo public class CheckCastNode extends FixedWithNextNode implements Canonicalizable, Simplifiable, Lowerable, Virtualizable, ValueProxy { - @Input private ValueNode object; + @Input ValueNode object; private final ResolvedJavaType type; private final JavaTypeProfile profile;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -38,10 +38,10 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public class CompareAndSwapNode extends AbstractMemoryCheckpoint implements Lowerable, MemoryCheckpoint.Single { - @Input private ValueNode object; - @Input private ValueNode offset; - @Input private ValueNode expected; - @Input private ValueNode newValue; + @Input ValueNode object; + @Input ValueNode offset; + @Input ValueNode expected; + @Input ValueNode newValue; private final Kind valueKind; private final LocationIdentity locationIdentity;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -40,7 +40,7 @@ @NodeInfo public class DynamicNewArrayNode extends AbstractNewArrayNode { - @Input private ValueNode elementType; + @Input ValueNode elementType; public static DynamicNewArrayNode create(ValueNode elementType, ValueNode length) { return new DynamicNewArrayNodeGen(elementType, length); @@ -68,8 +68,8 @@ if (isAlive() && elementType.isConstant()) { ResolvedJavaType javaType = tool.getConstantReflection().asJavaType(elementType.asConstant()); if (javaType != null && !javaType.equals(tool.getMetaAccess().lookupJavaType(void.class))) { - ValueNode length = length(); - NewArrayNode newArray = graph().add(NewArrayNode.create(javaType, length.isAlive() ? length : graph().addOrUniqueWithInputs(length), fillContents())); + ValueNode len = length(); + NewArrayNode newArray = graph().add(NewArrayNode.create(javaType, len.isAlive() ? len : graph().addOrUniqueWithInputs(len), fillContents())); List<Node> snapshot = inputs().snapshot(); graph().replaceFixedWithFixed(this, newArray); for (Node input : snapshot) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewInstanceNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewInstanceNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -32,7 +32,7 @@ @NodeInfo public class DynamicNewInstanceNode extends AbstractNewObjectNode implements Canonicalizable { - @Input private ValueNode clazz; + @Input ValueNode clazz; public static DynamicNewInstanceNode create(ValueNode clazz, boolean fillContents) { return new DynamicNewInstanceNodeGen(clazz, fillContents);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -37,8 +37,8 @@ @NodeInfo public class InstanceOfDynamicNode extends LogicNode implements Canonicalizable.Binary<ValueNode>, Lowerable { - @Input private ValueNode object; - @Input private ValueNode mirror; + @Input ValueNode object; + @Input ValueNode mirror; /** * @param mirror the {@link Class} value representing the target target type of the test
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -69,9 +69,9 @@ State arrayState = tool.getObjectState(array()); if (arrayState != null && arrayState.getState() == EscapeState.Virtual) { ValueNode indexValue = tool.getReplacedValue(index()); - int index = indexValue.isConstant() ? indexValue.asConstant().asInt() : -1; - if (index >= 0 && index < arrayState.getVirtualObject().entryCount()) { - tool.replaceWith(arrayState.getEntry(index)); + int idx = indexValue.isConstant() ? indexValue.asConstant().asInt() : -1; + if (idx >= 0 && idx < arrayState.getVirtualObject().entryCount()) { + tool.replaceWith(arrayState.getEntry(idx)); } } }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredAtomicReadAndWriteNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredAtomicReadAndWriteNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -37,8 +37,8 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public class LoweredAtomicReadAndWriteNode extends FixedAccessNode implements StateSplit, LIRLowerable, MemoryCheckpoint.Single { - @Input private ValueNode newValue; - @OptionalInput(InputType.State) private FrameState stateAfter; + @Input ValueNode newValue; + @OptionalInput(InputType.State) FrameState stateAfter; public static LoweredAtomicReadAndWriteNode create(ValueNode object, LocationNode location, ValueNode newValue, BarrierType barrierType) { return new LoweredAtomicReadAndWriteNodeGen(object, location, newValue, barrierType);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredCompareAndSwapNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredCompareAndSwapNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -35,9 +35,9 @@ @NodeInfo(allowedUsageTypes = {InputType.Value, InputType.Memory}) public class LoweredCompareAndSwapNode extends FixedAccessNode implements StateSplit, LIRLowerable, MemoryCheckpoint.Single { - @Input private ValueNode expectedValue; - @Input private ValueNode newValue; - @OptionalInput(InputType.State) private FrameState stateAfter; + @Input ValueNode expectedValue; + @Input ValueNode newValue; + @OptionalInput(InputType.State) FrameState stateAfter; public FrameState stateAfter() { return stateAfter;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -39,7 +39,7 @@ @NodeInfo public class MonitorExitNode extends AccessMonitorNode implements Virtualizable, Simplifiable, Lowerable, IterableNodeType, MonitorExit, MemoryCheckpoint.Single { - @OptionalInput private ValueNode escapedReturnValue; + @OptionalInput ValueNode escapedReturnValue; /** * Creates a new MonitorExitNode.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -35,7 +35,7 @@ @NodeInfo public class NewMultiArrayNode extends DeoptimizingFixedWithNextNode implements Lowerable, ArrayLengthProvider { - @Input private final NodeInputList<ValueNode> dimensions; + @Input NodeInputList<ValueNode> dimensions; private final ResolvedJavaType type; public ValueNode dimension(int index) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -38,8 +38,8 @@ @NodeInfo public class RegisterFinalizerNode extends AbstractStateSplit implements Canonicalizable.Unary<ValueNode>, LIRLowerable, Virtualizable, DeoptimizingNode.DeoptAfter { - @OptionalInput(InputType.State) private FrameState deoptState; - @Input private ValueNode value; + @OptionalInput(InputType.State) FrameState deoptState; + @Input ValueNode value; public static RegisterFinalizerNode create(ValueNode value) { return new RegisterFinalizerNodeGen(value);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/SelfReplacingMethodCallTargetNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/SelfReplacingMethodCallTargetNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -42,7 +42,7 @@ // Replacement method data private final ResolvedJavaMethod replacementTargetMethod; private final JavaType replacementReturnType; - @Input private final NodeInputList<ValueNode> replacementArguments; + @Input NodeInputList<ValueNode> replacementArguments; public static SelfReplacingMethodCallTargetNode create(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] arguments, JavaType returnType, ResolvedJavaMethod replacementTargetMethod, ValueNode[] replacementArguments, JavaType replacementReturnType) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreFieldNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreFieldNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -35,8 +35,8 @@ @NodeInfo(nameTemplate = "StoreField#{p#field/s}") public class StoreFieldNode extends AccessFieldNode implements StateSplit, VirtualizableRoot { - @Input private ValueNode value; - @OptionalInput(InputType.State) private FrameState stateAfter; + @Input ValueNode value; + @OptionalInput(InputType.State) FrameState stateAfter; public FrameState stateAfter() { return stateAfter;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -35,8 +35,8 @@ @NodeInfo public class StoreIndexedNode extends AccessIndexedNode implements StateSplit, Lowerable, Virtualizable { - @Input private ValueNode value; - @OptionalInput(InputType.State) private FrameState stateAfter; + @Input ValueNode value; + @OptionalInput(InputType.State) FrameState stateAfter; public FrameState stateAfter() { return stateAfter; @@ -78,12 +78,12 @@ State arrayState = tool.getObjectState(array()); if (arrayState != null && arrayState.getState() == EscapeState.Virtual) { ValueNode indexValue = tool.getReplacedValue(index()); - int index = indexValue.isConstant() ? indexValue.asConstant().asInt() : -1; - if (index >= 0 && index < arrayState.getVirtualObject().entryCount()) { + int idx = indexValue.isConstant() ? indexValue.asConstant().asInt() : -1; + if (idx >= 0 && idx < arrayState.getVirtualObject().entryCount()) { ResolvedJavaType componentType = arrayState.getVirtualObject().type().getComponentType(); if (componentType.isPrimitive() || StampTool.isObjectAlwaysNull(value) || componentType.getSuperclass() == null || (StampTool.typeOrNull(value) != null && componentType.isAssignableFrom(StampTool.typeOrNull(value)))) { - tool.setVirtualEntry(arrayState, index, value(), false); + tool.setVirtualEntry(arrayState, idx, value(), false); tool.delete(); } }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/AllocatedObjectNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/AllocatedObjectNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -35,8 +35,8 @@ @NodeInfo public class AllocatedObjectNode extends FloatingNode implements Virtualizable, ArrayLengthProvider { - @Input private VirtualObjectNode virtualObject; - @Input(InputType.Extension) private CommitAllocationNode commit; + @Input VirtualObjectNode virtualObject; + @Input(InputType.Extension) CommitAllocationNode commit; public static AllocatedObjectNode create(VirtualObjectNode virtualObject) { return new AllocatedObjectNodeGen(virtualObject);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -35,9 +35,9 @@ @NodeInfo(nameTemplate = "Alloc {i#virtualObjects}", allowedUsageTypes = {InputType.Extension}) public class CommitAllocationNode extends FixedWithNextNode implements VirtualizableAllocation, Lowerable, Simplifiable { - @Input private final NodeInputList<VirtualObjectNode> virtualObjects = new NodeInputList<>(this); - @Input private final NodeInputList<ValueNode> values = new NodeInputList<>(this); - @Input(InputType.Association) private final NodeInputList<MonitorIdNode> locks = new NodeInputList<>(this); + @Input NodeInputList<VirtualObjectNode> virtualObjects = new NodeInputList<>(this); + @Input NodeInputList<ValueNode> values = new NodeInputList<>(this); + @Input(InputType.Association) NodeInputList<MonitorIdNode> locks = new NodeInputList<>(this); private ArrayList<Integer> lockIndexes = new ArrayList<>(Arrays.asList(0)); public static CommitAllocationNode create() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EscapeObjectState.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EscapeObjectState.java Fri Aug 22 15:56:51 2014 +0200 @@ -29,7 +29,7 @@ @NodeInfo public abstract class EscapeObjectState extends VirtualState implements ValueNumberable { - @Input private VirtualObjectNode object; + @Input protected VirtualObjectNode object; public VirtualObjectNode object() { return object;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java Fri Aug 22 15:56:51 2014 +0200 @@ -213,7 +213,7 @@ } public static boolean tryGlobalValueNumbering(Node node, NodeClass nodeClass) { - if (nodeClass.valueNumberable() && !nodeClass.isLeafNode()) { + if (nodeClass.valueNumberable() && !node.isLeafNode()) { Node newNode = node.graph().findDuplicate(node); if (newNode != null) { assert !(node instanceof FixedNode || newNode instanceof FixedNode);
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Fri Aug 22 15:56:51 2014 +0200 @@ -49,7 +49,7 @@ @NodeInfo static class DummyGuardHandle extends ValueNode implements GuardedNode { - @Input(InputType.Guard) private GuardingNode guard; + @Input(InputType.Guard) GuardingNode guard; public static DummyGuardHandle create(GuardingNode guard) { return new LoweringPhase_DummyGuardHandleGen(guard);
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java Fri Aug 22 15:56:51 2014 +0200 @@ -34,7 +34,6 @@ import com.oracle.graal.graph.Graph.Mark; import com.oracle.graal.graph.*; import com.oracle.graal.graph.NodeClass.NodeClassIterator; -import com.oracle.graal.graph.NodeClass.Position; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.VirtualState.NodeClosure;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/FlowUtil.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/FlowUtil.java Fri Aug 22 15:56:51 2014 +0200 @@ -22,18 +22,13 @@ */ package com.oracle.graal.phases.common.cfs; -import com.oracle.graal.api.meta.ResolvedJavaType; -import com.oracle.graal.graph.Node; -import com.oracle.graal.graph.NodeClass; +import java.util.*; + +import com.oracle.graal.api.meta.*; +import com.oracle.graal.compiler.common.type.*; +import com.oracle.graal.graph.*; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.compiler.common.type.ObjectStamp; -import com.oracle.graal.compiler.common.type.Stamp; -import com.oracle.graal.compiler.common.type.StampFactory; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; public class FlowUtil { @@ -236,7 +231,7 @@ ArrayList<ValueNode> result = null; NodeClass.NodeClassIterator iter = n.inputs().iterator(); while (iter.hasNext()) { - NodeClass.Position pos = iter.nextPosition(); + Position pos = iter.nextPosition(); InputType inputType = pos.getInputType(n); boolean isReducibleInput = (inputType == InputType.Value || inputType == InputType.Condition); if (isReducibleInput) {
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java Fri Aug 22 15:56:51 2014 +0200 @@ -34,7 +34,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.graph.*; -import com.oracle.graal.graph.NodeClass.Position; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.phases.graph.*; @@ -299,14 +298,14 @@ Collection<Position> directInputPositions = nodeClass.getFirstLevelInputPositions(); writeShort((char) directInputPositions.size()); for (Position pos : directInputPositions) { - writeByte(pos.getSubIndex() == NodeClass.NOT_ITERABLE ? 0 : 1); + writeByte(pos.getSubIndex() == Node.NOT_ITERABLE ? 0 : 1); writePoolObject(nodeClass.getName(pos)); writePoolObject(nodeClass.getInputType(pos)); } Collection<Position> directSuccessorPositions = nodeClass.getFirstLevelSuccessorPositions(); writeShort((char) directSuccessorPositions.size()); for (Position pos : directSuccessorPositions) { - writeByte(pos.getSubIndex() == NodeClass.NOT_ITERABLE ? 0 : 1); + writeByte(pos.getSubIndex() == Node.NOT_ITERABLE ? 0 : 1); writePoolObject(nodeClass.getName(pos)); } } else if (object instanceof ResolvedJavaMethod) { @@ -440,7 +439,7 @@ private void writeEdges(Node node, Collection<Position> positions) throws IOException { NodeClass nodeClass = node.getNodeClass(); for (Position pos : positions) { - if (pos.getSubIndex() == NodeClass.NOT_ITERABLE) { + if (pos.getSubIndex() == Node.NOT_ITERABLE) { Node edge = nodeClass.get(node, pos); writeNodeRef(edge); } else {
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Fri Aug 22 15:56:51 2014 +0200 @@ -35,7 +35,6 @@ import com.oracle.graal.compiler.gen.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.NodeClass.NodeClassIterator; -import com.oracle.graal.graph.NodeClass.Position; import com.oracle.graal.java.*; import com.oracle.graal.java.BciBlockMapping.BciBlock; import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java Fri Aug 22 15:56:51 2014 +0200 @@ -31,7 +31,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.NodeClass.NodeClassIterator; -import com.oracle.graal.graph.NodeClass.Position; import com.oracle.graal.java.*; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64FloatConvertNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64FloatConvertNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -43,7 +43,10 @@ private final FloatConvert op; -public static AMD64FloatConvertNode create(Stamp stamp, FloatConvert op, ValueNode value) { return new AMD64FloatConvertNodeGen(stamp, op, value); } + public static AMD64FloatConvertNode create(Stamp stamp, FloatConvert op, ValueNode value) { + return new AMD64FloatConvertNodeGen(stamp, op, value); + } + protected AMD64FloatConvertNode(Stamp stamp, FloatConvert op, ValueNode value) { super(stamp, value); this.op = op;
--- a/graal/com.oracle.graal.replacements.hsail/src/com/oracle/graal/replacements/hsail/HSAILMathIntrinsicsNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.replacements.hsail/src/com/oracle/graal/replacements/hsail/HSAILMathIntrinsicsNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -44,7 +44,7 @@ /** * The parameter passed to the math operation that this node represents. */ - @Input private ValueNode param; + @Input ValueNode param; /** * The math operation that this Node represents.
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ArrayEqualsNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ArrayEqualsNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -42,13 +42,13 @@ private final Kind kind; /** One array to be tested for equality. */ - @Input private ValueNode array1; + @Input ValueNode array1; /** The other array to be tested for equality. */ - @Input private ValueNode array2; + @Input ValueNode array2; /** Length of both arrays. */ - @Input private ValueNode length; + @Input ValueNode length; public static ArrayEqualsNode create(ValueNode array1, ValueNode array2, ValueNode length) { return new ArrayEqualsNodeGen(array1, array2, length);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/AssertionNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/AssertionNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -38,7 +38,7 @@ @NodeInfo public class AssertionNode extends FixedWithNextNode implements Lowerable, Canonicalizable, LIRLowerable { - @Input private ValueNode value; + @Input ValueNode value; private final boolean compileTimeAssertion; private final String message;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -37,9 +37,9 @@ @NodeInfo public class DirectObjectStoreNode extends FixedWithNextNode implements Lowerable { - @Input private ValueNode object; - @Input private ValueNode value; - @Input private ValueNode offset; + @Input ValueNode object; + @Input ValueNode value; + @Input ValueNode offset; private final int displacement; private final LocationIdentity locationIdentity;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectReadNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectReadNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -38,7 +38,7 @@ @NodeInfo public class DirectReadNode extends FixedWithNextNode implements LIRLowerable { - @Input private ValueNode address; + @Input protected ValueNode address; private final Kind readKind; public static DirectReadNode create(ValueNode address, Kind readKind) {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectStoreNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectStoreNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -38,8 +38,8 @@ @NodeInfo public class DirectStoreNode extends FixedWithNextNode implements LIRLowerable { - @Input private ValueNode address; - @Input private ValueNode value; + @Input protected ValueNode address; + @Input protected ValueNode value; private final Kind kind; public static DirectStoreNode create(ValueNode address, ValueNode value, Kind kind) {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ExplodeLoopNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ExplodeLoopNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -48,20 +48,20 @@ } public LoopBeginNode findLoopBegin() { - Node next = next(); + Node currentNext = next(); ArrayList<Node> succs = new ArrayList<>(); - while (!(next instanceof LoopBeginNode)) { - assert next != null : "cannot find loop after " + this; - for (Node n : next.cfgSuccessors()) { + while (!(currentNext instanceof LoopBeginNode)) { + assert currentNext != null : "cannot find loop after " + this; + for (Node n : currentNext.cfgSuccessors()) { succs.add(n); } if (succs.size() == 1) { - next = succs.get(0); + currentNext = succs.get(0); } else { return null; } } - return (LoopBeginNode) next; + return (LoopBeginNode) currentNext; } /**
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/LoadSnippetVarargParameterNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/LoadSnippetVarargParameterNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -35,9 +35,9 @@ @NodeInfo public class LoadSnippetVarargParameterNode extends FixedWithNextNode implements Canonicalizable { - @Input private ValueNode index; + @Input ValueNode index; - @Input private final NodeInputList<ParameterNode> parameters; + @Input NodeInputList<ParameterNode> parameters; public static LoadSnippetVarargParameterNode create(ParameterNode[] locals, ValueNode index, Stamp stamp) { return new LoadSnippetVarargParameterNodeGen(locals, index, stamp);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -59,7 +59,7 @@ @NodeInfo public class MacroNode extends FixedWithNextNode implements Lowerable { - @Input protected final NodeInputList<ValueNode> arguments; + @Input protected NodeInputList<ValueNode> arguments; private final int bci; private final ResolvedJavaMethod targetMethod;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroStateSplitNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroStateSplitNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -37,7 +37,7 @@ @NodeInfo public class MacroStateSplitNode extends MacroNode implements StateSplit, MemoryCheckpoint.Single { - @OptionalInput(InputType.State) private FrameState stateAfter; + @OptionalInput(InputType.State) protected FrameState stateAfter; public static MacroStateSplitNode create(Invoke invoke) { return new MacroStateSplitNodeGen(invoke);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/WriteRegisterNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/WriteRegisterNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -43,7 +43,7 @@ /** * The new value assigned to the register. */ - @Input private ValueNode value; + @Input ValueNode value; public static WriteRegisterNode create(Register register, ValueNode value) { return new WriteRegisterNodeGen(register, value);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerExactArithmeticSplitNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerExactArithmeticSplitNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -32,10 +32,10 @@ @NodeInfo public abstract class IntegerExactArithmeticSplitNode extends ControlSplitNode implements LIRLowerable { - @Successor private BeginNode overflowSuccessor; - @Successor private BeginNode next; - @Input private ValueNode x; - @Input private ValueNode y; + @Successor BeginNode overflowSuccessor; + @Successor BeginNode next; + @Input ValueNode x; + @Input ValueNode y; public IntegerExactArithmeticSplitNode(Stamp stamp, ValueNode x, ValueNode y, BeginNode next, BeginNode overflowSuccessor) { super(stamp);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/ForceMaterializeNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/ForceMaterializeNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -30,7 +30,7 @@ @NodeInfo public class ForceMaterializeNode extends FixedWithNextNode implements LIRLowerable { - @Input private ValueNode object; + @Input ValueNode object; public static ForceMaterializeNode create(ValueNode object) { return new ForceMaterializeNodeGen(object);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/MaterializeFrameNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/MaterializeFrameNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -33,7 +33,7 @@ @NodeInfo(nameTemplate = "MaterializeFrame{p#frame/s}") public class MaterializeFrameNode extends FixedWithNextNode implements IterableNodeType { - @Input private ValueNode frame; + @Input ValueNode frame; public static MaterializeFrameNode create(ValueNode frame) { return new MaterializeFrameNodeGen(frame);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -48,8 +48,8 @@ @NodeInfo public class NewFrameNode extends FixedWithNextNode implements IterableNodeType, VirtualizableAllocation, Canonicalizable { - @Input private ValueNode descriptor; - @Input private ValueNode arguments; + @Input ValueNode descriptor; + @Input ValueNode arguments; public static NewFrameNode create(Stamp stamp, ValueNode descriptor, ValueNode arguments) { return new NewFrameNodeGen(stamp, descriptor, arguments);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeLoadFinalNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeLoadFinalNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -42,10 +42,10 @@ */ @NodeInfo public class CustomizedUnsafeLoadFinalNode extends FixedWithNextNode implements Canonicalizable, Virtualizable, Lowerable { - @Input private ValueNode object; - @Input private ValueNode offset; - @Input private ValueNode condition; - @Input private ValueNode location; + @Input ValueNode object; + @Input ValueNode offset; + @Input ValueNode condition; + @Input ValueNode location; private final Kind accessKind; public static CustomizedUnsafeLoadFinalNode create(ValueNode object, ValueNode offset, ValueNode condition, ValueNode location, Kind accessKind) {
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java Fri Aug 22 15:56:51 2014 +0200 @@ -33,7 +33,7 @@ @NodeInfo public class MaterializedObjectState extends EscapeObjectState implements Node.ValueNumberable { - @Input private ValueNode materializedValue; + @Input ValueNode materializedValue; public ValueNode materializedValue() { return materializedValue;
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java Fri Aug 22 15:56:51 2014 +0200 @@ -35,7 +35,7 @@ @NodeInfo public class VirtualObjectState extends EscapeObjectState implements Node.ValueNumberable { - @Input private final NodeInputList<ValueNode> values; + @Input NodeInputList<ValueNode> values; public NodeInputList<ValueNode> values() { return values;
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -48,18 +48,18 @@ private final SnippetReflectionProvider snippetReflection; - @Input private ValueNode valueKind; - @Input(InputType.Association) private ValueNode locationIdentity; - @Input private ValueNode displacement; - @Input private ValueNode index; - @Input private ValueNode indexScaling; + @Input ValueNode valueKind; + @Input(InputType.Association) ValueNode locationIdentity; + @Input ValueNode displacement; + @Input ValueNode index; + @Input ValueNode indexScaling; - public static SnippetLocationNode create(SnippetReflectionProvider snippetReflection, ValueNode identity, ValueNode kind, ValueNode displacement, ValueNode index, ValueNode indexScaling, - Graph graph) { + public static SnippetLocationNode create(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode identity, ValueNode kind, ValueNode displacement, ValueNode index, + ValueNode indexScaling, Graph graph) { return graph.unique(SnippetLocationNode.create(snippetReflection, identity, kind, displacement, index, indexScaling)); } - public static SnippetLocationNode create(SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement) { + public static SnippetLocationNode create(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement) { return new SnippetLocationNodeGen(snippetReflection, locationIdentity, kind, displacement); } @@ -67,11 +67,12 @@ this(snippetReflection, locationIdentity, kind, displacement, null, null); } - public static SnippetLocationNode create(SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement, ValueNode index, ValueNode indexScaling) { + public static SnippetLocationNode create(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement, ValueNode index, + ValueNode indexScaling) { return new SnippetLocationNodeGen(snippetReflection, locationIdentity, kind, displacement, index, indexScaling); } - SnippetLocationNode(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement, ValueNode index, ValueNode indexScaling) { + SnippetLocationNode(SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement, ValueNode index, ValueNode indexScaling) { super(StampFactory.object()); this.snippetReflection = snippetReflection; this.valueKind = kind;
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/WordCastNode.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/WordCastNode.java Fri Aug 22 15:56:51 2014 +0200 @@ -38,7 +38,7 @@ @NodeInfo public class WordCastNode extends FixedWithNextNode implements LIRLowerable, Canonicalizable { - @Input private ValueNode input; + @Input ValueNode input; public static WordCastNode wordToObject(ValueNode input, Kind wordKind) { assert input.getKind() == wordKind;
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/ElementUtils.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/ElementUtils.java Fri Aug 22 15:56:51 2014 +0200 @@ -900,19 +900,29 @@ return null; } - private static boolean isDeclaredMethod(TypeElement element, String name, TypeMirror[] params) { - return getDeclaredMethod(element, name, params) != null; + public static boolean isDeclaredMethodInSuperType(TypeElement element, String name, TypeMirror[] params) { + return !getDeclaredMethodsInSuperTypes(element, name, params).isEmpty(); } - public static boolean isDeclaredMethodInSuperType(TypeElement element, String name, TypeMirror[] params) { - List<TypeElement> superElements = getSuperTypes(element); + /** + * Gets the methods in the super type hierarchy (excluding interfaces) that are overridden by a + * method in a subtype. + * + * @param declaringElement the subtype element declaring the method + * @param name the name of the method + * @param params the signature of the method + */ + public static List<ExecutableElement> getDeclaredMethodsInSuperTypes(TypeElement declaringElement, String name, TypeMirror... params) { + List<ExecutableElement> superMethods = new ArrayList<>(); + List<TypeElement> superElements = getSuperTypes(declaringElement); - for (TypeElement typeElement : superElements) { - if (isDeclaredMethod(typeElement, name, params)) { - return true; + for (TypeElement superElement : superElements) { + ExecutableElement superMethod = getDeclaredMethod(superElement, name, params); + if (superMethod != null) { + superMethods.add(superMethod); } } - return false; + return superMethods; } public static boolean typeEquals(TypeMirror type1, TypeMirror type2) {