Program: 149976
Project: 149976
Buggy source:
/** 
 * Schedule prologue for 'normal' case (see above)
 */
final void insertNormalPrologue(){
  OPT_PhysicalRegisterSet phys=ir.regpool.getPhysicalRegisterSet();
  OPT_Register FP=phys.getFP();
  OPT_Register PR=phys.getPR();
  OPT_Register TSR=phys.getTSR();
  OPT_Register R0=phys.getTemp();
  OPT_Register S0=phys.getGPR(FIRST_SCRATCH_GPR);
  OPT_Register S1=phys.getGPR(LAST_SCRATCH_GPR);
  boolean interruptible=ir.method.isInterruptible();
  boolean stackOverflow=interruptible;
  boolean yp=hasPrologueYieldpoint();
  int frameFixedSize=getFrameFixedSize();
  ir.compiledMethod.setFrameFixedSize(frameFixedSize);
  if (frameFixedSize >= STACK_SIZE_GUARD || ir.compiledMethod.isSaveVolatile()) {
    insertExceptionalPrologue();
    return;
  }
  OPT_Instruction ptr=ir.firstInstructionInCodeOrder().nextInstructionInCodeOrder();
  if (VM.VerifyAssertions)   VM._assert(ptr.getOpcode() == IR_PROLOGUE_opcode);
  ptr.insertBefore(MIR_Move.create(PPC_MFSPR,A(R0),A(phys.getLR())));
  if (yp) {
    Offset offset=VM_Entrypoints.takeYieldpointField.getOffset();
    if (VM.VerifyAssertions)     VM._assert(OPT_Bits.fits(offset,16));
    ptr.insertBefore(MIR_Load.create(PPC_LInt,I(S1),A(PR),IC(OPT_Bits.PPCMaskLower16(offset))));
  }
  ptr.insertBefore(MIR_StoreUpdate.create(PPC_STAddrU,A(FP),A(FP),IC(-frameSize)));
  if (stackOverflow) {
    Offset offset=VM_Entrypoints.activeThreadStackLimitField.getOffset();
    if (VM.VerifyAssertions)     VM._assert(OPT_Bits.fits(offset,16));
    ptr.insertBefore(MIR_Load.create(PPC_LAddr,A(S0),A(phys.getPR()),IC(OPT_Bits.PPCMaskLower16(offset))));
  }
  saveNonVolatiles(ptr);
  if (yp) {
    ptr.insertBefore(MIR_Binary.create(PPC_CMPI,I(TSR),I(S1),IC(0)));
  }
  int cmid=ir.compiledMethod.getId();
  if (cmid <= 0x7fff) {
    ptr.insertBefore(MIR_Unary.create(PPC_LDI,I(S1),IC(cmid)));
  }
 else {
    ptr.insertBefore(MIR_Unary.create(PPC_LDIS,I(S1),IC(cmid >>> 16)));
    ptr.insertBefore(MIR_Binary.create(PPC_ORI,I(S1),I(S1),IC(cmid & 0xffff)));
  }
  ptr.insertBefore(MIR_Store.create(PPC_STAddr,A(R0),A(FP),IC(frameSize + STACKFRAME_NEXT_INSTRUCTION_OFFSET)));
  ptr.insertBefore(MIR_Store.create(PPC_STW,I(S1),A(FP),IC(STACKFRAME_METHOD_ID_OFFSET)));
  ptr.insertBefore(Empty.create(IR_ENDPROLOGUE));
  if (stackOverflow) {
    MIR_Trap.mutate(ptr,PPC_TAddr,OPT_PowerPCTrapOperand.GREATER(),A(S0),A(FP),OPT_TrapCodeOperand.StackOverflow());
  }
 else {
    ptr.remove();
  }
}

Fixed version (ground truth):
/** 
 * Schedule prologue for 'normal' case (see above)
 */
final void insertNormalPrologue(){
  OPT_PhysicalRegisterSet phys=ir.regpool.getPhysicalRegisterSet();
  OPT_Register FP=phys.getFP();
  OPT_Register PR=phys.getPR();
  OPT_Register TSR=phys.getTSR();
  OPT_Register R0=phys.getTemp();
  OPT_Register S0=phys.getGPR(FIRST_SCRATCH_GPR);
  OPT_Register S1=phys.getGPR(LAST_SCRATCH_GPR);
  boolean interruptible=ir.method.isInterruptible();
  boolean stackOverflow=interruptible;
  boolean yp=hasPrologueYieldpoint();
  int frameFixedSize=getFrameFixedSize();
  ir.compiledMethod.setFrameFixedSize(frameFixedSize);
  if (frameFixedSize >= STACK_SIZE_GUARD || ir.compiledMethod.isSaveVolatile()) {
    insertExceptionalPrologue();
    return;
  }
  OPT_Instruction ptr=ir.firstInstructionInCodeOrder().nextInstructionInCodeOrder();
  if (VM.VerifyAssertions)   VM._assert(ptr.getOpcode() == IR_PROLOGUE_opcode);
  ptr.insertBefore(MIR_Move.create(PPC_MFSPR,A(R0),A(phys.getLR())));
  if (yp) {
    Offset offset=VM_Entrypoints.takeYieldpointField.getOffset();
    if (VM.VerifyAssertions)     VM._assert(OPT_Bits.fits(offset,16));
    ptr.insertBefore(MIR_Load.create(PPC_LInt,I(S1),A(PR),IC(OPT_Bits.PPCMaskLower16(offset))));
  }
  ptr.insertBefore(MIR_StoreUpdate.create(PPC_STAddrU,A(FP),A(FP),IC(-frameSize)));
  if (stackOverflow) {
    Offset offset=VM_Entrypoints.activeThreadStackLimitField.getOffset();
    if (VM.VerifyAssertions)     VM._assert(OPT_Bits.fits(offset,16));
    ptr.insertBefore(MIR_Load.create(PPC_LAddr,A(S0),A(phys.getPR()),IC(OPT_Bits.PPCMaskLower16(offset))));
  }
  saveNonVolatiles(ptr);
  if (yp) {
    ptr.insertBefore(MIR_Binary.create(PPC_CMPI,I(TSR),I(S1),IC(0)));
  }
  int cmid=ir.compiledMethod.getId();
  if (cmid <= 0x7fff) {
    ptr.insertBefore(MIR_Unary.create(PPC_LDI,I(S1),IC(cmid)));
  }
 else {
    ptr.insertBefore(MIR_Unary.create(PPC_LDIS,I(S1),IC(cmid >>> 16)));
    ptr.insertBefore(MIR_Binary.create(PPC_ORI,I(S1),I(S1),IC(cmid & 0xffff)));
  }
  ptr.insertBefore(MIR_Store.create(PPC_STAddr,A(R0),A(FP),IC(frameSize + STACKFRAME_NEXT_INSTRUCTION_OFFSET)));
  ptr.insertBefore(MIR_Store.create(PPC_STW,I(S1),A(FP),IC(STACKFRAME_METHOD_ID_OFFSET)));
  if (stackOverflow) {
    MIR_Trap.mutate(ptr,PPC_TAddr,OPT_PowerPCTrapOperand.GREATER(),A(S0),A(FP),OPT_TrapCodeOperand.StackOverflow());
  }
 else {
    ptr.remove();
  }
}