Mercurial > hg > truffle
comparison graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/CanonicalizerPhase.java @ 5806:3842904e46c2
Kill unused floating nodes in Canonicalizer
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 03 Jul 2012 16:11:04 +0200 |
parents | 21e8f6b5a7d1 |
children | 7bc36486ef27 |
comparison
equal
deleted
inserted
replaced
5746:17d2c3b72762 | 5806:3842904e46c2 |
---|---|
95 workList = graph.createNodeWorkList(newNodesMark == 0, MAX_ITERATION_PER_NODE); | 95 workList = graph.createNodeWorkList(newNodesMark == 0, MAX_ITERATION_PER_NODE); |
96 workList.addAll(initWorkingSet); | 96 workList.addAll(initWorkingSet); |
97 } | 97 } |
98 tool = new Tool(workList, runtime, target, assumptions, immutabilityPredicate); | 98 tool = new Tool(workList, runtime, target, assumptions, immutabilityPredicate); |
99 processWorkSet(graph); | 99 processWorkSet(graph); |
100 | |
101 while (graph.getUsagesDroppedNodesCount() > 0) { | |
102 for (Node n : graph.getAndCleanUsagesDroppedNodes()) { | |
103 if (!n.isDeleted() && n.usages().size() == 0 && GraphUtil.isFloatingNode().apply(n)) { | |
104 n.safeDelete(); | |
105 } | |
106 } | |
107 } | |
108 } | 100 } |
109 | 101 |
110 public interface IsImmutablePredicate { | 102 public interface IsImmutablePredicate { |
111 /** | 103 /** |
112 * Determines if a given constant is an object/array whose current | 104 * Determines if a given constant is an object/array whose current |
138 return; | 130 return; |
139 } | 131 } |
140 int mark = graph.getMark(); | 132 int mark = graph.getMark(); |
141 tryCanonicalize(node, graph, tool); | 133 tryCanonicalize(node, graph, tool); |
142 tryInferStamp(node, graph); | 134 tryInferStamp(node, graph); |
135 tryKillUnused(node); | |
143 | 136 |
144 for (Node newNode : graph.getNewNodes(mark)) { | 137 for (Node newNode : graph.getNewNodes(mark)) { |
145 workList.add(newNode); | 138 workList.add(newNode); |
146 } | 139 } |
140 } | |
141 } | |
142 | |
143 private static void tryKillUnused(Node node) { | |
144 if (node.isAlive() && GraphUtil.isFloatingNode().apply(node) && node.usages().isEmpty()) { | |
145 GraphUtil.killWithUnusedFloatingInputs(node); | |
147 } | 146 } |
148 } | 147 } |
149 | 148 |
150 public static boolean tryGlobalValueNumbering(Node node, StructuredGraph graph) { | 149 public static boolean tryGlobalValueNumbering(Node node, StructuredGraph graph) { |
151 if (node.getNodeClass().valueNumberable()) { | 150 if (node.getNodeClass().valueNumberable()) { |