comparison graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java @ 2716:c1a9bf38da28

Removed bci from the Instruction class.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Thu, 19 May 2011 13:59:55 +0200
parents 3ac3dd97d8df
children c1ce2a53d6c3
comparison
equal deleted inserted replaced
2715:3ac3dd97d8df 2716:c1a9bf38da28
106 106
107 // LIR block 107 // LIR block
108 public final LIRBlock lirBlock = new LIRBlock(); 108 public final LIRBlock lirBlock = new LIRBlock();
109 109
110 /** 110 /**
111 * Index of bytecode that generated this node when appended in a basic block.
112 * Negative values indicate special cases.
113 */
114 private int bci;
115
116 /**
111 * Constructs a new BlockBegin at the specified bytecode index. 117 * Constructs a new BlockBegin at the specified bytecode index.
112 * @param bci the bytecode index of the start 118 * @param bci the bytecode index of the start
113 * @param blockID the ID of the block 119 * @param blockID the ID of the block
114 * @param graph 120 * @param graph
115 */ 121 */
286 } 292 }
287 } 293 }
288 } 294 }
289 } 295 }
290 296
297 /**
298 * Gets the bytecode index of this instruction.
299 * @return the bytecode index of this instruction
300 */
301 public int bci() {
302 return bci;
303 }
304
305 /**
306 * Sets the bytecode index of this instruction.
307 * @param bci the new bytecode index for this instruction
308 */
309 public void setBCI(int bci) {
310 this.bci = bci;
311 }
312
291 private void iterate(IdentityHashMap<BlockBegin, BlockBegin> mark, BlockClosure closure) { 313 private void iterate(IdentityHashMap<BlockBegin, BlockBegin> mark, BlockClosure closure) {
292 if (!mark.containsKey(this)) { 314 if (!mark.containsKey(this)) {
293 mark.put(this, this); 315 mark.put(this, this);
294 closure.apply(this); 316 closure.apply(this);
295 BlockEnd e = end(); 317 BlockEnd e = end();
309 } 331 }
310 if (excBlocks.size() > 0) { 332 if (excBlocks.size() > 0) {
311 iterateReverse(mark, closure, excBlocks); 333 iterateReverse(mark, closure, excBlocks);
312 } 334 }
313 335
314 // if (exceptionHandlerBlocks != null) {
315 // iterateReverse(mark, closure, exceptionHandlerBlocks);
316 // }
317 assert e != null : "block must have block end"; 336 assert e != null : "block must have block end";
318 iterateReverse(mark, closure, e.blockSuccessors()); 337 iterateReverse(mark, closure, e.blockSuccessors());
319 } 338 }
320 } 339 }
321 340
334 FrameState existingState = stateBefore(); 353 FrameState existingState = stateBefore();
335 354
336 if (existingState == null) { 355 if (existingState == null) {
337 // copy state because it is modified 356 // copy state because it is modified
338 FrameState duplicate = newState.duplicate(bci()); 357 FrameState duplicate = newState.duplicate(bci());
339 assert duplicate.bci == bci() : "duplicate.bci=" + duplicate.bci + " my bci=" + bci();
340 358
341 if (C1XOptions.UseStackMapTableLiveness && method != null) { 359 if (C1XOptions.UseStackMapTableLiveness && method != null) {
342 // if a liveness map is available, use it to invalidate dead locals 360 // if a liveness map is available, use it to invalidate dead locals
343 CiBitMap[] livenessMap = method.livenessMap(); 361 CiBitMap[] livenessMap = method.livenessMap();
344 if (livenessMap != null && bci() >= 0) { 362 if (livenessMap != null && bci() >= 0) {
427 StringBuilder builder = new StringBuilder(); 445 StringBuilder builder = new StringBuilder();
428 builder.append("block #"); 446 builder.append("block #");
429 builder.append(blockID); 447 builder.append(blockID);
430 builder.append(","); 448 builder.append(",");
431 builder.append(depthFirstNumber); 449 builder.append(depthFirstNumber);
432 builder.append(" @ ");
433 builder.append(bci());
434 builder.append(" ["); 450 builder.append(" [");
435 boolean hasFlag = false; 451 boolean hasFlag = false;
436 for (BlockFlag f : BlockFlag.values()) { 452 for (BlockFlag f : BlockFlag.values()) {
437 if (checkBlockFlag(f)) { 453 if (checkBlockFlag(f)) {
438 if (hasFlag) { 454 if (hasFlag) {
538 if (sb.length() != 0) { 554 if (sb.length() != 0) {
539 out.print('(').print(sb.toString()).print(')'); 555 out.print('(').print(sb.toString()).print(')');
540 } 556 }
541 557
542 // print block bci range 558 // print block bci range
543 out.print('[').print(bci()).print(", ").print(end == null ? -1 : end.bci()).print(']'); 559 out.print('[').print(-1).print(", ").print(-1).print(']');
544 560
545 // print block successors 561 // print block successors
546 if (end != null && end.blockSuccessors().size() > 0) { 562 if (end != null && end.blockSuccessors().size() > 0) {
547 out.print(" ."); 563 out.print(" .");
548 for (BlockBegin successor : end.blockSuccessors()) { 564 for (BlockBegin successor : end.blockSuccessors()) {