Program: 149990
Project: 149990
Buggy source:
/** 
 * Unwind a stackframe.
 */
public void unwindStackFrame(VM_CompiledMethod compiledMethod,VM_Registers registers){
  VM_NormalMethod method=(VM_NormalMethod)compiledMethod.getMethod();
  VM_QuickCompiledMethod qcm=(VM_QuickCompiledMethod)compiledMethod;
  if (method.isSynchronized()) {
    Address ip=registers.getInnermostInstructionAddress();
    Offset instr=compiledMethod.getInstructionOffset(ip);
    Offset lockOffset=((VM_QuickCompiledMethod)compiledMethod).getLockAcquisitionOffset();
    if (instr.sGT(lockOffset)) {
      Object lock;
      if (method.isStatic()) {
        lock=method.getDeclaringClass().getClassForType();
      }
 else {
        Address fp=registers.getInnermostFramePointer();
        int offset=VM_QuickCompiler.getThisPtrSaveAreaOffset(method);
        lock=VM_Magic.addressAsObject(fp.add(offset).loadAddress());
      }
      VM_ObjectModel.genericUnlock(lock);
    }
  }
  Address fp=registers.getInnermostFramePointer();
  Offset frameOffset=Offset.fromIntSignExtend(VM_QuickCompiler.getCallerSaveOffset(method));
  int limit;
  for (int i=qcm.firstGPR; i <= qcm.lastGPR; i++, frameOffset=frameOffset.sub(BYTES_IN_ADDRESS)) {
    registers.gprs.set(i,fp.loadWord(frameOffset));
  }
  registers.gprs.set(VM_QuickCompiler.S1,fp.loadWord(frameOffset));
  frameOffset=frameOffset.sub(BYTES_IN_ADDRESS);
  registers.gprs.set(VM_QuickCompiler.S0,fp.loadWord(frameOffset));
  frameOffset=frameOffset.sub(BYTES_IN_ADDRESS);
  for (int i=qcm.firstFPR; i <= qcm.lastFPR; i++, frameOffset=frameOffset.sub(BYTES_IN_DOUBLE)) {
    long temp=VM_Magic.getLongAtOffset(VM_Magic.addressAsObject(fp),frameOffset);
    registers.fprs[i]=VM_Magic.longBitsAsDouble(temp);
  }
  long temp=VM_Magic.getLongAtOffset(VM_Magic.addressAsObject(fp),frameOffset);
  frameOffset=frameOffset.sub(BYTES_IN_DOUBLE);
  registers.fprs[VM_QuickCompiler.SF0]=VM_Magic.longBitsAsDouble(temp);
  registers.unwindStackFrame();
}

Fixed version (ground truth):
/** 
 * Unwind a stackframe.
 */
public void unwindStackFrame(VM_CompiledMethod compiledMethod,VM_Registers registers){
  VM_NormalMethod method=(VM_NormalMethod)compiledMethod.getMethod();
  VM_QuickCompiledMethod qcm=(VM_QuickCompiledMethod)compiledMethod;
  if (method.isSynchronized()) {
    Address ip=registers.getInnermostInstructionAddress();
    Offset instr=compiledMethod.getInstructionOffset(ip);
    Offset lockOffset=((VM_QuickCompiledMethod)compiledMethod).getLockAcquisitionOffset();
    if (instr.sGT(lockOffset)) {
      Object lock;
      if (method.isStatic()) {
        lock=method.getDeclaringClass().getClassForType();
      }
 else {
        Address fp=registers.getInnermostFramePointer();
        int offset=VM_QuickCompiler.getThisPtrSaveAreaOffset(method);
        lock=VM_Magic.addressAsObject(fp.plus(offset).loadAddress());
      }
      VM_ObjectModel.genericUnlock(lock);
    }
  }
  Address fp=registers.getInnermostFramePointer();
  Offset frameOffset=Offset.fromIntSignExtend(VM_QuickCompiler.getCallerSaveOffset(method));
  int limit;
  for (int i=qcm.firstGPR; i <= qcm.lastGPR; i++, frameOffset=frameOffset.minus(BYTES_IN_ADDRESS)) {
    registers.gprs.set(i,fp.loadWord(frameOffset));
  }
  registers.gprs.set(VM_QuickCompiler.S1,fp.loadWord(frameOffset));
  frameOffset=frameOffset.minus(BYTES_IN_ADDRESS);
  registers.gprs.set(VM_QuickCompiler.S0,fp.loadWord(frameOffset));
  frameOffset=frameOffset.minus(BYTES_IN_ADDRESS);
  for (int i=qcm.firstFPR; i <= qcm.lastFPR; i++, frameOffset=frameOffset.minus(BYTES_IN_DOUBLE)) {
    long temp=VM_Magic.getLongAtOffset(VM_Magic.addressAsObject(fp),frameOffset);
    registers.fprs[i]=VM_Magic.longBitsAsDouble(temp);
  }
  long temp=VM_Magic.getLongAtOffset(VM_Magic.addressAsObject(fp),frameOffset);
  frameOffset=frameOffset.minus(BYTES_IN_DOUBLE);
  registers.fprs[VM_QuickCompiler.SF0]=VM_Magic.longBitsAsDouble(temp);
  registers.unwindStackFrame();
}