void unwindStackFrame(VM_CompiledMethod compiledMethod, VM_Registers registers) { VM_Method method = compiledMethod.getMethod(); if (method.isSynchronized()) { VM_Address ip = registers.getInnermostInstructionAddress(); VM_Address base = VM_Magic.objectAsAddress(compiledMethod.getInstructions()); int instr = ip.diff(base); int lockOffset = ((VM_BaselineCompiledMethod)compiledMethod).getLockAcquisitionOffset(); if (instr > lockOffset) { Object lock; if (method.isStatic()) { lock = method.getDeclaringClass().getClassForType(); } else { VM_Address fp = registers.getInnermostFramePointer(); int offset = VM_Compiler.getFirstLocalOffset(method); lock = VM_Magic.addressAsObject(VM_Magic.getMemoryAddress(fp.add(offset))); } VM_ObjectModel.genericUnlock(lock); } } registers.unwindStackFrame(); }
  void deliverException(VM_CompiledMethod compiledMethod,			VM_Address        catchBlockInstructionAddress,			Throwable         exceptionObject,			VM_Registers      registers) {    VM_Address fp    = registers.getInnermostFramePointer();    VM_Method method = compiledMethod.getMethod();    // reset sp to "empty expression stack" state    //    VM_Address sp = fp.add(VM_Compiler.getEmptyStackOffset(method));    // push exception object as argument to catch block    //    sp = sp.sub(4);    VM_Magic.setMemoryWord(sp, VM_Magic.objectAsAddress(exceptionObject).toInt());    registers.gprs[SP] = sp.toInt();    // set address at which to resume executing frame    //    registers.ip = catchBlockInstructionAddress;    // branch to catch block    //    VM.enableGC(); // disabled right before VM_Runtime.deliverException was called    if (VM.VerifyAssertions) VM.assert(registers.inuse == true);     registers.inuse = false;    VM_Magic.restoreHardwareExceptionState(registers);    if (VM.VerifyAssertions) VM.assert(NOT_REACHED);  }     /**   * Unwind a stackframe.   */  void unwindStackFrame(VM_CompiledMethod compiledMethod, VM_Registers registers) {    VM_Method method = compiledMethod.getMethod();    if (method.isSynchronized()) {       VM_Address ip = registers.getInnermostInstructionAddress();      VM_Address base = VM_Magic.objectAsAddress(compiledMethod.getInstructions());      int instr = ip.diff(base);      int lockOffset = ((VM_BaselineCompiledMethod)compiledMethod).getLockAcquisitionOffset();      if (instr > lockOffset) { // we actually have the lock, so must unlock it.	Object lock;	if (method.isStatic()) {	  lock = method.getDeclaringClass().getClassForType();	} else {	  VM_Address fp = registers.getInnermostFramePointer();	  int offset = VM_Compiler.getFirstLocalOffset(method);	  lock = VM_Magic.addressAsObject(VM_Magic.getMemoryAddress(fp.add(offset)));	}	VM_ObjectModel.genericUnlock(lock);      }    }    registers.unwindStackFrame();  }