comparison graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java @ 2564:274360f98f97

Remove inlining (2nd part) removed IRScope
author Gilles Duboscq <gilles.duboscq@oracle.com>
date Fri, 29 Apr 2011 13:19:17 +0200
parents a384fac3fd34
children cc1f1d396288
comparison
equal deleted inserted replaced
2563:491896f81cae 2564:274360f98f97
407 // copy state because it is modified 407 // copy state because it is modified
408 newState = newState.copy(); 408 newState = newState.copy();
409 409
410 if (C1XOptions.UseStackMapTableLiveness) { 410 if (C1XOptions.UseStackMapTableLiveness) {
411 // if a liveness map is available, use it to invalidate dead locals 411 // if a liveness map is available, use it to invalidate dead locals
412 CiBitMap[] livenessMap = newState.scope().method.livenessMap(); 412 CiBitMap[] livenessMap = newState.method.livenessMap();
413 if (livenessMap != null && bci() >= 0) { 413 if (livenessMap != null && bci() >= 0) {
414 assert bci() < livenessMap.length; 414 assert bci() < livenessMap.length;
415 CiBitMap liveness = livenessMap[bci()]; 415 CiBitMap liveness = livenessMap[bci()];
416 if (liveness != null) { 416 if (liveness != null) {
417 invalidateDeadLocals(newState, liveness); 417 invalidateDeadLocals(newState, liveness);
428 } else { 428 } else {
429 if (!C1XOptions.AssumeVerifiedBytecode && !existingState.isSameAcrossScopes(newState)) { 429 if (!C1XOptions.AssumeVerifiedBytecode && !existingState.isSameAcrossScopes(newState)) {
430 // stacks or locks do not match--bytecodes would not verify 430 // stacks or locks do not match--bytecodes would not verify
431 throw new CiBailout("stack or locks do not match"); 431 throw new CiBailout("stack or locks do not match");
432 } 432 }
433
434 // while (existingState.scope() != newState.scope()) {
435 // // XXX: original code is not sure if this is necessary
436 // newState = newState.scope().callerState();
437 // assert newState != null : "could not match scopes";
438 // }
439 // above code replaced with assert for the moment
440 assert existingState.scope() == newState.scope();
441 433
442 assert existingState.localsSize() == newState.localsSize(); 434 assert existingState.localsSize() == newState.localsSize();
443 assert existingState.stackSize() == newState.stackSize(); 435 assert existingState.stackSize() == newState.stackSize();
444 436
445 if (wasVisited() && !isParserLoopHeader()) { 437 if (wasVisited() && !isParserLoopHeader()) {
469 for (int i = 0; i < stackSize; i++) { 461 for (int i = 0; i < stackSize; i++) {
470 // always insert phis for the stack 462 // always insert phis for the stack
471 newState.setupPhiForStack(this, i); 463 newState.setupPhiForStack(this, i);
472 } 464 }
473 int localsSize = newState.localsSize(); 465 int localsSize = newState.localsSize();
474 CiBitMap requiresPhi = newState.scope().getStoresInLoops();
475 for (int i = 0; i < localsSize; i++) { 466 for (int i = 0; i < localsSize; i++) {
476 Value x = newState.localAt(i); 467 Value x = newState.localAt(i);
477 if (x != null) { 468 if (x != null) {
478 if (requiresPhi != null) { 469 newState.setupPhiForLocal(this, i);
479 if (requiresPhi.get(i) || x.kind.isDoubleWord() && requiresPhi.get(i + 1)) {
480 // selectively do a phi
481 newState.setupPhiForLocal(this, i);
482 }
483 } else {
484 // always setup a phi
485 newState.setupPhiForLocal(this, i);
486 }
487 } 470 }
488 } 471 }
489 } 472 }
490 473
491 public boolean isStandardEntry() { 474 public boolean isStandardEntry() {
790 } else { 773 } else {
791 i++; 774 i++;
792 } 775 }
793 } 776 }
794 777
795 do { 778 for (i = 0; !hasPhisInLocals && i < state.localsSize();) {
796 for (i = 0; !hasPhisInLocals && i < state.localsSize();) { 779 Value value = state.localAt(i);
797 Value value = state.localAt(i); 780 hasPhisInLocals = isPhiAtBlock(value);
798 hasPhisInLocals = isPhiAtBlock(value); 781 // also ignore illegal HiWords
799 // also ignore illegal HiWords 782 if (value != null && !value.isIllegal()) {
800 if (value != null && !value.isIllegal()) { 783 i += value.kind.sizeInSlots();
801 i += value.kind.sizeInSlots(); 784 } else {
802 } else { 785 i++;
803 i++; 786 }
804 } 787 }
805 }
806 state = state.callerState();
807 } while (state != null);
808 } 788 }
809 789
810 // print values in locals 790 // print values in locals
811 if (hasPhisInLocals) { 791 if (hasPhisInLocals) {
812 out.println(); 792 out.println();
813 out.println("Locals:"); 793 out.println("Locals:");
814 794
815 FrameState state = stateBefore(); 795 FrameState state = stateBefore();
816 do { 796 int i = 0;
817 int i = 0; 797 while (i < state.localsSize()) {
818 while (i < state.localsSize()) { 798 Value value = state.localAt(i);
819 Value value = state.localAt(i); 799 if (value != null) {
820 if (value != null) { 800 out.println(stateString(i, value));
821 out.println(stateString(i, value)); 801 // also ignore illegal HiWords
822 // also ignore illegal HiWords 802 i += value.isIllegal() ? 1 : value.kind.sizeInSlots();
823 i += value.isIllegal() ? 1 : value.kind.sizeInSlots(); 803 } else {
824 } else { 804 i++;
825 i++; 805 }
826 } 806 }
827 } 807 out.println();
828 out.println();
829 state = state.callerState();
830 } while (state != null);
831 } 808 }
832 809
833 // print values on stack 810 // print values on stack
834 if (hasPhisOnStack) { 811 if (hasPhisOnStack) {
835 out.println(); 812 out.println();