VM.assert(VM_Processor.vpStatus[stuckProcessor.vpStatusIndex] == VM_Processor.IN_SIGWAIT); VM.assert(VM_Processor.vpStatus[nativeProcessor.vpStatusIndex] == VM_Processor.BLOCKED_IN_NATIVE);
VM._assert(VM_Processor.vpStatus[stuckProcessor.vpStatusIndex] == VM_Processor.IN_SIGWAIT); VM._assert(VM_Processor.vpStatus[nativeProcessor.vpStatusIndex] == VM_Processor.BLOCKED_IN_NATIVE);
   void transfer (VM_Processor stuckProcessor) {     if (trace) VM_Scheduler.trace("NDT","Entering transfer for processor",stuckProcessor.id);		 switch_count++;     VM_Scheduler.nativeProcessorMutex.lock();     VM_Processor nativeProcessor = VM_Scheduler.nativeProcessorQueue.dequeue();     VM_Scheduler.nativeProcessorMutex.unlock();     if (nativeProcessor == null) {       if (trace) VM.sysWrite("NDT: transfer: dequeue returned null\n");       VM.sysFail("No Native Processors For Blocked Threads");     }     // stuck Processor is now blocked in C. Swap p_threads with native Processor,     // and also swap status words of the two processors.     //      switchPThread(stuckProcessor, nativeProcessor);     // active java thread of stuck Processor should now be the native processors     // NativeIdleThread, IN_SIGWAIT, waiting for a signal.     if (VM.VerifyAssertions) {       VM.assert(VM_Processor.vpStatus[stuckProcessor.vpStatusIndex] == VM_Processor.IN_SIGWAIT);       VM.assert(VM_Processor.vpStatus[nativeProcessor.vpStatusIndex] == VM_Processor.BLOCKED_IN_NATIVE);     }     // now the native idle thread is "active" on the blue/stuck vp, and     // waiting for a signal.  Signal its p_thread now, upon awakening it will     // become the new p_thread for the stuck vp.  The java nativeIdleThread     // will yield back to its native processor.     //      if (trace) {      VM_Scheduler.trace("NDT","signalling NIT on processor",stuckProcessor.id);      VM_Scheduler.trace("NDT","with pthread_id =",stuckProcessor.pthread_id);     }     VM.sysCall1(VM_BootRecord.the_boot_record.sysPthreadSignalIP, stuckProcessor.pthread_id);     // wait for the native processor status to become UNBLOCKED before returning.     // if we return with it blocked, and GC immediately initiates, GC will find     // the native processor in an unexpected BLOCKED_IN_NATIVE state     //     int loopCount = 1;     while (VM_Processor.vpStatus[nativeProcessor.vpStatusIndex] ==	    VM_Processor.BLOCKED_IN_NATIVE) {       // just spin - we are running on a separate pthread       if (VM.VerifyAssertions && (loopCount++%100000==0))	 if (trace) VM_Scheduler.trace("NDT","waiting for native VP to unblock, count =",loopCount);     }	   }