Mercurial > hg > truffle
comparison graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java @ 3015:02a3d70f6fc0
Fixed bug where a ControlSplit with only one successor (e.g. degenerated switch) would cause infinite loops.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Sat, 18 Jun 2011 11:33:58 +0200 |
parents | 6264ecd38bc2 |
children | 2f5f6ffbafa0 |
comparison
equal
deleted
inserted
replaced
3014:681a227c332b | 3015:02a3d70f6fc0 |
---|---|
100 if (n != null) { | 100 if (n != null) { |
101 if (n instanceof EndNode || n instanceof Return || n instanceof Unwind || n instanceof LoopEnd || n instanceof Deoptimize) { | 101 if (n instanceof EndNode || n instanceof Return || n instanceof Unwind || n instanceof LoopEnd || n instanceof Deoptimize) { |
102 Block block = null; | 102 Block block = null; |
103 Node currentNode = n; | 103 Node currentNode = n; |
104 while (nodeToBlock.get(currentNode) == null) { | 104 while (nodeToBlock.get(currentNode) == null) { |
105 if (block != null && IdentifyBlocksPhase.trueSuccessorCount(currentNode) > 1) { | 105 if (block != null && (currentNode instanceof ControlSplit || trueSuccessorCount(currentNode) > 1)) { |
106 // We are at a split node => start a new block. | 106 // We are at a split node => start a new block. |
107 block = null; | 107 block = null; |
108 } | 108 } |
109 block = assignBlockNew(currentNode, block); | 109 block = assignBlockNew(currentNode, block); |
110 if (currentNode.predecessors().size() == 0) { | 110 if (currentNode.predecessors().size() == 0) { |
370 assert dominatorRoot.getPredecessors().size() == 0; | 370 assert dominatorRoot.getPredecessors().size() == 0; |
371 CiBitMap visited = new CiBitMap(blocks.size()); | 371 CiBitMap visited = new CiBitMap(blocks.size()); |
372 visited.set(dominatorRoot.blockID()); | 372 visited.set(dominatorRoot.blockID()); |
373 LinkedList<Block> workList = new LinkedList<Block>(); | 373 LinkedList<Block> workList = new LinkedList<Block>(); |
374 workList.add(dominatorRoot); | 374 workList.add(dominatorRoot); |
375 // TODO: Add all predecessor.size()==0 nodes. | |
375 | 376 |
376 while (!workList.isEmpty()) { | 377 while (!workList.isEmpty()) { |
377 Block b = workList.remove(); | 378 Block b = workList.remove(); |
378 | 379 |
379 List<Block> predecessors = b.getPredecessors(); | 380 List<Block> predecessors = b.getPredecessors(); |