Mercurial > hg > truffle
comparison graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java @ 11864:fbcde297f87a
NewMemoryAwareScheudling: process loop a second time in order to compute the loop exists correctly with the new merged state
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Wed, 02 Oct 2013 11:16:21 +0200 |
parents | 7763a42d1658 |
children | 3d97040060d4 |
comparison
equal
deleted
inserted
replaced
11863:7763a42d1658 | 11864:fbcde297f87a |
---|---|
248 return new HashMap<>(state); | 248 return new HashMap<>(state); |
249 } | 249 } |
250 | 250 |
251 @Override | 251 @Override |
252 protected List<Map<LocationIdentity, Node>> processLoop(Loop loop, Map<LocationIdentity, Node> state) { | 252 protected List<Map<LocationIdentity, Node>> processLoop(Loop loop, Map<LocationIdentity, Node> state) { |
253 LoopInfo<Map<LocationIdentity, Node>> info = ReentrantBlockIterator.processLoop(this, loop, new HashMap<>(state)); | 253 LoopInfo<Map<LocationIdentity, Node>> info = ReentrantBlockIterator.processLoop(this, loop, cloneState(state)); |
254 | 254 |
255 assert loop.header.getBeginNode() instanceof LoopBeginNode; | 255 assert loop.header.getBeginNode() instanceof LoopBeginNode; |
256 Map<LocationIdentity, Node> headerState = merge(loop.header, info.endStates); | 256 Map<LocationIdentity, Node> headerState = merge(loop.header, info.endStates); |
257 // getBlockToKillMap().put(loop.header, headerState); | 257 // second iteration, for computing information at loop exits |
258 info = ReentrantBlockIterator.processLoop(this, loop, cloneState(headerState)); | |
258 | 259 |
259 int i = 0; | 260 int i = 0; |
260 for (Block exit : loop.exits) { | 261 for (Block exit : loop.exits) { |
261 Map<LocationIdentity, Node> exitState = info.exitStates.get(i++); | 262 Map<LocationIdentity, Node> exitState = info.exitStates.get(i++); |
262 for (LocationIdentity key : headerState.keySet()) { | |
263 exitState.put(key, headerState.get(key)); | |
264 } | |
265 | 263 |
266 Node begin = exit.getBeginNode(); | 264 Node begin = exit.getBeginNode(); |
267 assert begin instanceof LoopExitNode; | 265 assert begin instanceof LoopExitNode; |
268 for (Node usage : begin.usages()) { | 266 for (Node usage : begin.usages()) { |
269 if (usage instanceof ProxyNode && ((ProxyNode) usage).type() == PhiType.Memory) { | 267 if (usage instanceof ProxyNode && ((ProxyNode) usage).type() == PhiType.Memory) { |