Mercurial > hg > truffle
comparison graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java @ 2581:4a36a0bd6d18
added GraalGraph to classpath, Node as superclass of Value
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 05 May 2011 13:27:48 +0200 |
parents | cc1f1d396288 |
children | 768d77a1c7af |
comparison
equal
deleted
inserted
replaced
2579:4984c8ebd6c7 | 2581:4a36a0bd6d18 |
---|---|
116 | 116 |
117 /** | 117 /** |
118 * Gets the list of predecessors of this block. | 118 * Gets the list of predecessors of this block. |
119 * @return the predecessor list | 119 * @return the predecessor list |
120 */ | 120 */ |
121 public List<BlockBegin> predecessors() { | 121 public List<BlockBegin> blockPredecessors() { |
122 return predecessors; | 122 return predecessors; |
123 } | 123 } |
124 | 124 |
125 /** | 125 /** |
126 * Gets the dominator of this block. | 126 * Gets the dominator of this block. |
238 if (old != end) { | 238 if (old != end) { |
239 if (old != null) { | 239 if (old != null) { |
240 // disconnect this block from the old end | 240 // disconnect this block from the old end |
241 old.setBegin(null); | 241 old.setBegin(null); |
242 // disconnect this block from its current successors | 242 // disconnect this block from its current successors |
243 for (BlockBegin s : old.successors()) { | 243 for (BlockBegin s : old.blockSuccessors()) { |
244 s.predecessors().remove(this); | 244 s.blockPredecessors().remove(this); |
245 } | 245 } |
246 } | 246 } |
247 this.end = end; | 247 this.end = end; |
248 end.setBegin(this); | 248 end.setBegin(this); |
249 for (BlockBegin s : end.successors()) { | 249 for (BlockBegin s : end.blockSuccessors()) { |
250 s.addPredecessor(this); | 250 s.addPredecessor(this); |
251 } | 251 } |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
302 mark.put(this, this); | 302 mark.put(this, this); |
303 BlockBegin block; | 303 BlockBegin block; |
304 while ((block = queue.poll()) != null) { | 304 while ((block = queue.poll()) != null) { |
305 closure.apply(block); | 305 closure.apply(block); |
306 queueBlocks(queue, block.exceptionHandlerBlocks(), mark); | 306 queueBlocks(queue, block.exceptionHandlerBlocks(), mark); |
307 queueBlocks(queue, block.end.successors(), mark); | 307 queueBlocks(queue, block.end.blockSuccessors(), mark); |
308 queueBlocks(queue, predecessors ? block.predecessors : null, mark); | 308 queueBlocks(queue, predecessors ? block.predecessors : null, mark); |
309 } | 309 } |
310 } | 310 } |
311 | 311 |
312 private void queueBlocks(LinkedList<BlockBegin> queue, List<BlockBegin> list, IdentityHashMap<BlockBegin, BlockBegin> mark) { | 312 private void queueBlocks(LinkedList<BlockBegin> queue, List<BlockBegin> list, IdentityHashMap<BlockBegin, BlockBegin> mark) { |
327 BlockEnd e = end(); | 327 BlockEnd e = end(); |
328 if (exceptionHandlerBlocks != null) { | 328 if (exceptionHandlerBlocks != null) { |
329 iterateReverse(mark, closure, exceptionHandlerBlocks); | 329 iterateReverse(mark, closure, exceptionHandlerBlocks); |
330 } | 330 } |
331 assert e != null : "block must have block end"; | 331 assert e != null : "block must have block end"; |
332 iterateReverse(mark, closure, e.successors()); | 332 iterateReverse(mark, closure, e.blockSuccessors()); |
333 } | 333 } |
334 } | 334 } |
335 | 335 |
336 private void iterateReverse(IdentityHashMap<BlockBegin, BlockBegin> mark, BlockClosure closure, List<BlockBegin> list) { | 336 private void iterateReverse(IdentityHashMap<BlockBegin, BlockBegin> mark, BlockClosure closure, List<BlockBegin> list) { |
337 for (int i = list.size() - 1; i >= 0; i--) { | 337 for (int i = list.size() - 1; i >= 0; i--) { |
425 insertLoopPhis(newState); | 425 insertLoopPhis(newState); |
426 } | 426 } |
427 | 427 |
428 stateBefore = newState; | 428 stateBefore = newState; |
429 } else { | 429 } else { |
430 if (!C1XOptions.AssumeVerifiedBytecode && !existingState.isSame(newState)) { | 430 if (!C1XOptions.AssumeVerifiedBytecode && !existingState.isCompatibleWith(newState)) { |
431 // stacks or locks do not match--bytecodes would not verify | 431 // stacks or locks do not match--bytecodes would not verify |
432 throw new CiBailout("stack or locks do not match"); | 432 throw new CiBailout("stack or locks do not match"); |
433 } | 433 } |
434 | 434 |
435 assert existingState.localsSize() == newState.localsSize(); | 435 assert existingState.localsSize() == newState.localsSize(); |
590 | 590 |
591 builder.append("]"); | 591 builder.append("]"); |
592 if (end != null) { | 592 if (end != null) { |
593 builder.append(" -> "); | 593 builder.append(" -> "); |
594 boolean hasSucc = false; | 594 boolean hasSucc = false; |
595 for (BlockBegin s : end.successors()) { | 595 for (BlockBegin s : end.blockSuccessors()) { |
596 if (hasSucc) { | 596 if (hasSucc) { |
597 builder.append(", "); | 597 builder.append(", "); |
598 } | 598 } |
599 builder.append("#"); | 599 builder.append("#"); |
600 builder.append(s.blockID); | 600 builder.append(s.blockID); |
722 | 722 |
723 // print block bci range | 723 // print block bci range |
724 out.print('[').print(bci()).print(", ").print(end == null ? -1 : end.bci()).print(']'); | 724 out.print('[').print(bci()).print(", ").print(end == null ? -1 : end.bci()).print(']'); |
725 | 725 |
726 // print block successors | 726 // print block successors |
727 if (end != null && end.successors().size() > 0) { | 727 if (end != null && end.blockSuccessors().size() > 0) { |
728 out.print(" ."); | 728 out.print(" ."); |
729 for (BlockBegin successor : end.successors()) { | 729 for (BlockBegin successor : end.blockSuccessors()) { |
730 out.print(" B").print(successor.blockID); | 730 out.print(" B").print(successor.blockID); |
731 } | 731 } |
732 } | 732 } |
733 // print exception handlers | 733 // print exception handlers |
734 if (!exceptionHandlers().isEmpty()) { | 734 if (!exceptionHandlers().isEmpty()) { |
743 if (dominator() != null) { | 743 if (dominator() != null) { |
744 out.print(" dom B").print(dominator().blockID); | 744 out.print(" dom B").print(dominator().blockID); |
745 } | 745 } |
746 | 746 |
747 // print predecessors | 747 // print predecessors |
748 if (!predecessors().isEmpty()) { | 748 if (!blockPredecessors().isEmpty()) { |
749 out.print(" pred:"); | 749 out.print(" pred:"); |
750 for (BlockBegin pred : predecessors()) { | 750 for (BlockBegin pred : blockPredecessors()) { |
751 out.print(" B").print(pred.blockID); | 751 out.print(" B").print(pred.blockID); |
752 } | 752 } |
753 } | 753 } |
754 } | 754 } |
755 | 755 |