Mercurial > hg > truffle
comparison graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java @ 19543:353669a84287
Utilities Node#acceptInputs and Node#acceptSuccessors.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 22 Feb 2015 23:44:37 +0100 |
parents | f98e2f0c35d8 |
children | 10a0f4aef97c |
comparison
equal
deleted
inserted
replaced
19542:f98e2f0c35d8 | 19543:353669a84287 |
---|---|
47 assert node.isAlive(); | 47 assert node.isAlive(); |
48 if (node instanceof AbstractEndNode) { | 48 if (node instanceof AbstractEndNode) { |
49 // We reached a control flow end. | 49 // We reached a control flow end. |
50 AbstractEndNode end = (AbstractEndNode) node; | 50 AbstractEndNode end = (AbstractEndNode) node; |
51 killEnd(end, tool); | 51 killEnd(end, tool); |
52 } else { | 52 } else if (node instanceof FixedNode) { |
53 // Normal control flow node. | 53 // Normal control flow node. |
54 /* | 54 /* |
55 * We do not take a successor snapshot because this iterator supports concurrent | 55 * We do not take a successor snapshot because this iterator supports concurrent |
56 * modifications as long as they do not change the size of the successor list. Not | 56 * modifications as long as they do not change the size of the successor list. Not |
57 * taking a snapshot allows us to see modifications to other branches that may happen | 57 * taking a snapshot allows us to see modifications to other branches that may happen |
114 | 114 |
115 public static void propagateKill(Node node) { | 115 public static void propagateKill(Node node) { |
116 if (node != null && node.isAlive()) { | 116 if (node != null && node.isAlive()) { |
117 node.unsafeDelete(); | 117 node.unsafeDelete(); |
118 | 118 |
119 for (Node in : node.inputs()) { | 119 node.acceptInputs(in -> { |
120 if (in.isAlive() && in.hasNoUsages() && !(in instanceof FixedNode)) { | 120 if (in.isAlive() && in.hasNoUsages() && !(in instanceof FixedNode)) { |
121 killWithUnusedFloatingInputs(in); | 121 killWithUnusedFloatingInputs(in); |
122 } | 122 } |
123 } | 123 }); |
124 | 124 |
125 ArrayList<Node> usageToKill = null; | 125 ArrayList<Node> usageToKill = null; |
126 for (Node usage : node.usages()) { | 126 for (Node usage : node.usages()) { |
127 if (usage.isAlive() && !(usage instanceof FixedNode)) { | 127 if (usage.isAlive() && !(usage instanceof FixedNode)) { |
128 if (usageToKill == null) { | 128 if (usageToKill == null) { |