static void unlockAndThrow(Object objToUnlock, Throwable objToThrow) throws VM_PragmaNoInline { VM_ObjectModel.genericUnlock(objToUnlock); athrow(objToThrow); }
  static void deliverHardwareException(int trapCode, int trapInfo) {    VM_Thread    myThread           = VM_Thread.getCurrentThread();    VM_Registers exceptionRegisters = myThread.hardwareExceptionRegisters;    if ((trapCode == TRAP_STACK_OVERFLOW || trapCode == TRAP_JNI_STACK) && 	myThread.stack.length < (STACK_SIZE_MAX >> 2) && 	!myThread.hasNativeStackFrame()) {       // expand stack by the size appropriate for normal or native frame       // and resume execution at successor to trap instruction      // (C trap handler has set register.ip to the instruction following the trap).      if (trapCode == TRAP_JNI_STACK) {	VM_Thread.resizeCurrentStack(myThread.stack.length + (STACK_SIZE_JNINATIVE_GROW >> 2), exceptionRegisters);      } else {	VM_Thread.resizeCurrentStack(myThread.stack.length + (STACK_SIZE_GROW >> 2), exceptionRegisters);      }      if (VM.VerifyAssertions) VM.assert(exceptionRegisters.inuse == true);       exceptionRegisters.inuse = false;      VM_Magic.restoreHardwareExceptionState(exceptionRegisters);      if (VM.VerifyAssertions) VM.assert(NOT_REACHED);    }    Throwable exceptionObject;    switch (trapCode) {    case TRAP_NULL_POINTER:      exceptionObject = new java.lang.NullPointerException();      break;    case TRAP_ARRAY_BOUNDS:      exceptionObject = new java.lang.ArrayIndexOutOfBoundsException(trapInfo);      break;    case TRAP_DIVIDE_BY_ZERO:      exceptionObject = new java.lang.ArithmeticException();      break;    case TRAP_STACK_OVERFLOW:    case TRAP_JNI_STACK:      exceptionObject = new java.lang.StackOverflowError();      break;    case TRAP_CHECKCAST:      exceptionObject = new java.lang.ClassCastException();      break;    case TRAP_MUST_IMPLEMENT:      exceptionObject = new java.lang.IncompatibleClassChangeError();      break;    case TRAP_STORE_CHECK:      exceptionObject = new java.lang.ArrayStoreException();      break;    default:      exceptionObject = new java.lang.UnknownError();      VM_Scheduler.traceback("UNKNOWN ERROR");      break;    }          VM.disableGC();  // VM.enableGC() is called when the exception is delivered.    deliverException(exceptionObject, exceptionRegisters);  }       /**   * Unlock an object and then deliver a software exception    * to current java thread.   * @param objToUnlock object to unlock    * @param objToThrow exception object to deliver    * (null --> deliver NullPointerException).   * does not return (stack is unwound and execution resumes in a catch block)   */   static void unlockAndThrow(Object objToUnlock, Throwable objToThrow) throws VM_PragmaNoInline {    VM_ObjectModel.genericUnlock(objToUnlock);    athrow(objToThrow);  }