VM.assert( VM_Magic.objectAsAddress(VM_Processor.getCurrentProcessor()) ==
VM._assert( VM_Magic.objectAsAddress(VM_Processor.getCurrentProcessor()) ==
  public void run_ForNormalJava() { // original 3GT run loop    // Make sure Opt compiler does not compile this method.  Although GC will scan    // this run methods frame, fixing references, any references saved in register    // save areas would not get reported, so we prevent OPT compilation.    //    VM_Magic.pragmaNoOptCompile();    // Save current frame pointer in threads JNIEnv,     // and set flag recognized by GC    // which will cause this (NativeIdleThread) thread to have its stack scanned    // starting at this frame, if it is in a sigwait syscall during a collection.    //    VM_Thread.getCurrentThread().jniEnv.JNITopJavaFP = VM_Magic.getFramePointer();    // Get the Native Processor this NativeIdleThread is running on.     // It will always    // be associated with the same Native Processor, although it will "visit"     // other RVM Processors.    //    VM_Processor myNativeProcessor =      VM_ProcessorLocalState.getCurrentProcessor();    while (true) {            // At this point this Native Idle Thread should be executing on the      // its associated NativeProcessor.  We either just entered      // the run loop, or are starting again after the yield below.      if (VM.VerifyAssertions)	VM.assert( VM_Magic.objectAsAddress(VM_Processor.getCurrentProcessor()) ==		   VM_Magic.objectAsAddress(myNativeProcessor) );      // Get ID of osThread currently executing in the NativeProcessor, and this      // NativeIdleThread, and remember it, it is ours for now!      //      int currentOSThreadId = myNativeProcessor.pthread_id;      // Place Processor we are running on onto the AvailableNativeProcessorQueue      //      VM_Scheduler.nativeProcessorMutex.lock();      VM_Scheduler.nativeProcessorQueue.enqueue(myNativeProcessor);      VM_Scheduler.nativeProcessorMutex.unlock();      // now suspend executing osThread in sigWait, and set status of this native      // processor to "IN_SIGWAIT", a state expected by GC. (see VM_Handshake ??)      //      inSysWait = true;  // temporary...GC code looks for this flag in native idle threads      int TOC = 0;      //-#if RVM_FOR_POWERPC      TOC = VM_BootRecord.the_boot_record.sysTOC;      //-#endif      VM_Magic.sysCallSigWait(VM_BootRecord.the_boot_record.sysPthreadSigWaitIP,			      TOC,		              myNativeProcessor.vpStatusAddress.toInt(),			      VM_Processor.IN_SIGWAIT,			      VM_Thread.getCurrentThread().contextRegisters);      inSysWait = false;      // Someone (watchdog daemon likely) has woken this       // NativeIdleThread up. Another Java thread,      // blocked in native, should have displaced this thread       // as the active thread on       // the native processor. This idle thread should have       // been set to be the activeThread      // of the processor, although the processor register       // (restored by AIX after the      // sigWait) still points to the native processor.      //      VM_ProcessorLocalState.setCurrentProcessor(blockedProcessor);      // change the status of the processor this thread is now running      // on to IN_JAVA (from IN_SIGWAIT)      //      VM_Processor.vpStatus[blockedProcessor.vpStatusIndex] = VM_Processor.IN_JAVA;      // Now executing as the active thread of that processor, yield back to my      // associated NativeProcessor. This Idle Thread will go there to be reused later.      // The osThread executing here will stay on the current processor, to take over      // execution of Java threads on that processor.      //      // This "yield" to native processor will also unblock the native processor,      // changing its vpStatus from BLOCKED_IN_NATIVE to IN_NATIVE, thus allowing      // the "stuck in native" thread, previously moved to the native processor, to       // return from native, at which time it will find itself on a native processor      // and transfer to a RVM processor (as in red-blue threading)      //      VM_Thread.yield(myNativeProcessor);      // Waking up on the NativeProcessor, after the yield.      //      // The Java thread that was executing has reentered Java and transferred back to      // its "returnAffinity" RVM Processor.  The osThread, left behind, has      // scheduled and is executing this NativeIdleThread.      //      // We go to the top of the run loop, to make this <processor, idleThread, osThread>      // triple available again, for some other Java thread found blocked in Native    }  // while(true)  }  // end of run