int ipOffset = compiledMethod.getInstructionOffset(ip);
Offset ipOffset = compiledMethod.getInstructionOffset(ip);
  private static void deliverException(Throwable exceptionObject,                                        VM_Registers exceptionRegisters) {    if (VM.debugOOM) {      VM.sysWriteln("VM_Runtime.deliverException() entered; just got an exception object.");    }    //-#if RVM_FOR_IA32    VM_Magic.clearFloatingPointState();    //-#endif        // walk stack and look for a catch block    //    if(VM.debugOOM)      VM.sysWrite("Hunting for a catch block...");    VM_Type exceptionType = VM_Magic.getObjectType(exceptionObject);    Address fp = exceptionRegisters.getInnermostFramePointer();    while (VM_Magic.getCallerFramePointer(fp).NE(STACKFRAME_SENTINEL_FP) ){      int compiledMethodId = VM_Magic.getCompiledMethodID(fp);      if (compiledMethodId != INVISIBLE_METHOD_ID) {           VM_CompiledMethod compiledMethod = VM_CompiledMethods.getCompiledMethod(compiledMethodId);          VM_ExceptionDeliverer exceptionDeliverer = compiledMethod.getExceptionDeliverer();          Address ip = exceptionRegisters.getInnermostInstructionAddress();          int ipOffset = compiledMethod.getInstructionOffset(ip);          int catchBlockOffset = compiledMethod.findCatchBlockForInstruction(ipOffset, exceptionType);          if (catchBlockOffset >= 0  ){             // found an appropriate catch block            if (VM.debugOOM)              VM.sysWriteln("found one; delivering.");            Address methodStartAddress = VM_Magic.objectAsAddress(compiledMethod.getInstructions());            exceptionDeliverer.deliverException(compiledMethod,                                                 methodStartAddress.add(catchBlockOffset),                                                 exceptionObject,                                                 exceptionRegisters);            if (VM.VerifyAssertions) VM._assert(NOT_REACHED);          }                    exceptionDeliverer.unwindStackFrame(compiledMethod, exceptionRegisters);      } else {        unwindInvisibleStackFrame(exceptionRegisters);      }      fp = exceptionRegisters.getInnermostFramePointer();    }    if (VM.debugOOM) {      VM.sysWriteln("Nope.");      VM.sysWriteln("VM_Runtime.deliverException() found no catch block.");    }    /* No appropriate catch block found. */    VM_Thread.getCurrentThread().dyingWithUncaughtException = true;        /* Grow the heap.     * This could be (but isn't) undoable.  That doesn't matter here, since     * we're dying in any case.       *     * There's no way to give the additional memory exclusively to this     * particular thread; too bad. */    if (VM.doEmergencyGrowHeap && exceptionObject instanceof OutOfMemoryError)      MM_Interface.emergencyGrowHeap(5 * (1<<20)); // ask for 5 megs and pray    handlePossibleRecursiveException();    VM.enableGC();        VM_Thread vmThr = VM_Thread.getCurrentThread();    Thread thr = vmThr.peekJavaLangThread();    if (thr == null) {      VM.sysWrite("Exception in the primordial thread \"", vmThr.toString(),                   "\" while booting: ");    } else {      // This is output like that of the Sun JDK.      VM.sysWrite("Exception in thread \"", thr.getName(), "\": ");    }    exceptionObject.printStackTrace();    VM_Thread.terminate();    if (VM.VerifyAssertions) VM._assert(NOT_REACHED);  }