Mercurial > hg > graal-compiler
comparison graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Edges.java @ 17328:c9bb0da795d4
Backed out of changeset 17322:655f3e6b467b
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 03 Oct 2014 14:19:58 +0200 |
parents | 655f3e6b467b |
children | 1e7e354e407f |
comparison
equal
deleted
inserted
replaced
17327:655f3e6b467b | 17328:c9bb0da795d4 |
---|---|
133 index++; | 133 index++; |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 /** | 137 /** |
138 * Clear edges in a given node. This is accomplished by setting {@linkplain #getDirectCount() | |
139 * direct} edges to null and replacing the lists containing indirect edges with new lists. The | |
140 * latter is important so that this method can be used to clear the edges of cloned nodes. | |
141 * | |
142 * @param toNode the node whose list edges are to be initialized | |
143 */ | |
144 public void initializeLists(Node toNode, Node fromNode) { | |
145 int index = getDirectCount(); | |
146 while (index < getCount()) { | |
147 NodeList<Node> list = getNodeList(fromNode, index); | |
148 int size = list.initialSize; | |
149 NodeList<Node> newList = type == Edges.Type.Inputs ? new NodeInputList<>(toNode, size) : new NodeSuccessorList<>(toNode, size); | |
150 | |
151 // replacing with a new list object is the expected behavior! | |
152 initializeList(toNode, index, newList); | |
153 index++; | |
154 } | |
155 } | |
156 | |
157 /** | |
158 * Copies edges from {@code fromNode} to {@code toNode}. The nodes are expected to be of the | 138 * Copies edges from {@code fromNode} to {@code toNode}. The nodes are expected to be of the |
159 * exact same type. | 139 * exact same type. |
160 * | 140 * |
161 * @param fromNode the node from which the edges should be copied. | 141 * @param fromNode the node from which the edges should be copied. |
162 * @param toNode the node to which the edges should be copied. | 142 * @param toNode the node to which the edges should be copied. |
168 initializeNode(toNode, index, getNode(fromNode, index)); | 148 initializeNode(toNode, index, getNode(fromNode, index)); |
169 index++; | 149 index++; |
170 } | 150 } |
171 while (index < getCount()) { | 151 while (index < getCount()) { |
172 NodeList<Node> list = getNodeList(toNode, index); | 152 NodeList<Node> list = getNodeList(toNode, index); |
173 if (list == null) { | 153 list.copy(getNodeList(fromNode, index)); |
174 NodeList<Node> fromList = getNodeList(fromNode, index); | |
175 list = type == Edges.Type.Inputs ? new NodeInputList<>(toNode, fromList) : new NodeSuccessorList<>(toNode, fromList); | |
176 initializeList(toNode, index, list); | |
177 } else { | |
178 list.copy(getNodeList(fromNode, index)); | |
179 } | |
180 index++; | 154 index++; |
181 } | 155 } |
182 } | 156 } |
183 | 157 |
184 /** | 158 /** |