if (ypTakenInCallerCMID == STACKFRAME_SENTINEL_FP.toInt() || ypTakenInCallerCMID == INVISIBLE_METHOD_ID    ||
if (ypTakenInCallerCMID == INVISIBLE_METHOD_ID    ||
  public static void threadSwitch(int whereFrom) throws VM_PragmaNoInline   {    VM_Processor.getCurrentProcessor().threadSwitchRequested   = 0;    //-#if RVM_FOR_POWERPC    /* give a chance to check the sync request     */    if (VM_Processor.getCurrentProcessor().needsSync) {      VM_Processor.getCurrentProcessor().needsSync = false;      // make sure not get stale data      VM_Magic.isync();      VM_Synchronization.fetchAndDecrement(VM_Magic.getJTOC(), VM_Entrypoints.toSyncProcessorsField.getOffset(), 1);    }    //-#endif    if (!VM_Processor.getCurrentProcessor().threadSwitchingEnabled()) {       // thread in critical section: can't switch right now, defer 'till later      VM_Processor.getCurrentProcessor().threadSwitchPending = true;      return;    }    /*     * Thread switch only when interruptQuantumCounter == schedulingMultiplier.     * Otherwise sample HPM counter values and return.     * This code must go after checking for thread switch enabled to ensure that we don't     * interrupt thread switch disabled code!  In particular, the VM.write(String) method.     */    VM_Processor.getCurrentProcessor().interruptQuantumCounter++;    boolean threadSwitch = ! (VM_Processor.getCurrentProcessor().interruptQuantumCounter < VM.schedulingMultiplier);    //-#if RVM_WITH_HPM    if (VM_HardwarePerformanceMonitors.sample || threadSwitch) {      // sample HPM counter values at every interrupt or a thread switch.      if (VM.BuildForHPM && VM_HardwarePerformanceMonitors.safe && 	  ! VM_HardwarePerformanceMonitors.hpm_thread_group) {	VM_Thread myThread = getCurrentThread();	VM_Processor.getCurrentProcessor().hpm.updateHPMcounters(myThread, myThread, true, threadSwitch);      }    }    //-#endif     if (! threadSwitch) return;    VM_Processor.getCurrentProcessor().interruptQuantumCounter = 0;    if (VM_Scheduler.debugRequested && VM_Scheduler.allProcessorsInitialized) {       // service "debug request" generated by external signal      VM_Scheduler.debuggerMutex.lock();      if (VM_Scheduler.debuggerQueue.isEmpty())      { // debugger already running        VM_Scheduler.debuggerMutex.unlock();      }      else      { // awaken debugger        VM_Thread t = VM_Scheduler.debuggerQueue.dequeue();        VM_Scheduler.debuggerMutex.unlock();        t.schedule();      }    }    if (!VM_Scheduler.attachThreadRequested.isZero()) {      // service AttachCurrentThread request from an external pthread      VM_Scheduler.attachThreadMutex.lock();      if (VM_Scheduler.attachThreadQueue.isEmpty())      { // JNIServiceThread already running        VM_Scheduler.attachThreadMutex.unlock();      }      else      { // awaken JNIServiceThread        VM_Thread t = VM_Scheduler.attachThreadQueue.dequeue();        VM_Scheduler.attachThreadMutex.unlock();        t.schedule();      }    }    if (VM_Scheduler.wakeupQueue.isReady()) {      VM_Scheduler.wakeupMutex.lock();      VM_Thread t = VM_Scheduler.wakeupQueue.dequeue();      VM_Scheduler.wakeupMutex.unlock();      if (t != null)      {        // VM_Scheduler.trace("VM_Thread",         // "threadSwitch: awaken ", t.getIndex());        t.schedule();      }    }    // Reset thread switch count for deterministic thread switching    if(VM.BuildForDeterministicThreadSwitching)       VM_Processor.getCurrentProcessor().deterministicThreadSwitchCount =         VM.deterministicThreadSwitchInterval;    //-#if RVM_WITH_ADAPTIVE_SYSTEM    // We use threadswitches as a rough approximation of time.     // Every threadswitch is a clock tick.    VM_Controller.controllerClock++;    //    // "The idle thread is boring, and does not deserve to be sampled"    //                           -- AOS Commandment Number 1    if (!VM_Thread.getCurrentThread().isIdleThread) {      // First, get the cmid for the method in which the yieldpoint was taken.      // Get pointer to my caller's frame      VM_Address fp = VM_Magic.getCallerFramePointer(VM_Magic.getFramePointer());       // Skip over wrapper to "real" method      fp = VM_Magic.getCallerFramePointer(fp);                                   int ypTakenInCMID = VM_Magic.getCompiledMethodID(fp);      // Next, get the cmid for that method's caller.      fp = VM_Magic.getCallerFramePointer(fp);      int ypTakenInCallerCMID = VM_Magic.getCompiledMethodID(fp);      // Determine if ypTakenInCallerCMID actually corresponds to a real       // Java stackframe.      boolean ypTakenInCallerCMIDValid = true;      VM_CompiledMethod ypTakenInCM = VM_CompiledMethods.getCompiledMethod(ypTakenInCMID);      // Check for one of the following:      //    Caller is top-of-stack psuedo-frame      //    Caller is out-of-line assembly (no VM_Method object)      //    Caller is a native method      if (ypTakenInCallerCMID == STACKFRAME_SENTINEL_FP.toInt() ||          ypTakenInCallerCMID == INVISIBLE_METHOD_ID    ||          ypTakenInCM.getMethod().getDeclaringClass().isBridgeFromNative()) {         ypTakenInCallerCMIDValid = false;      }       //-#if RVM_WITH_OSR         // check if there are pending osr request      if ((VM_Controller.osrOrganizer != null) 		&& (VM_Controller.osrOrganizer.osr_flag)) {	VM_Controller.osrOrganizer.activate();       }           if (!VM_Thread.getCurrentThread().isSystemThread) {        boolean baseToOptOSR = false;	if (whereFrom == VM_Thread.BACKEDGE) {	  if (ypTakenInCM.isOutdated()) {	    baseToOptOSR = true;	  }	}	if (baseToOptOSR || (whereFrom == VM_Thread.OSROPT)) {		  // get this fram pointer	  VM_Address tsFP = VM_Magic.getFramePointer(); 		  // Get pointer to my caller's frame	  VM_Address tsFromFP = VM_Magic.getCallerFramePointer(tsFP);	  // Skip over wrapper to "real" method	  VM_Address realFP = VM_Magic.getCallerFramePointer(tsFromFP);	  	  VM_Address stackbeg = VM_Magic.objectAsAddress(VM_Thread.getCurrentThread().stack);	  	  VM_Offset tsFromFPoff = tsFromFP.diff(stackbeg);	  VM_Offset realFPoff = realFP.diff(stackbeg);	  	  OSR_OnStackReplacementTrigger.trigger(ypTakenInCMID, 						tsFromFPoff,						realFPoff,						whereFrom);	}      }      //-#endif      // Now that we have the basic information we need,       // notify all currently registered listeners      if (VM_RuntimeMeasurements.hasMethodListener()){        // set the Caller CMID to -1 if invalid        if (!ypTakenInCallerCMIDValid) ypTakenInCallerCMID = -1;          VM_RuntimeMeasurements.activateMethodListeners(ypTakenInCMID,                                                       ypTakenInCallerCMID,                                                        whereFrom);      }      if (ypTakenInCallerCMIDValid &&           VM_RuntimeMeasurements.hasContextListener()) {        // Have to start over again in case an intervening GC has moved fp         //    since the last time we did this.        // Get pointer to my caller's frame        fp = VM_Magic.getCallerFramePointer(VM_Magic.getFramePointer());        // Skip over wrapper to "real" method        fp = VM_Magic.getCallerFramePointer(fp);                                 VM_RuntimeMeasurements.activateContextListeners(fp, whereFrom);      }      if (VM_RuntimeMeasurements.hasNullListener()){        VM_RuntimeMeasurements.activateNullListeners(whereFrom);      }    }    //-#endif    // VM_Scheduler.trace("VM_Thread", "threadSwitch");    timerTickYield(whereFrom);    //-#if RVM_WITH_OSR    VM_Thread myThread = getCurrentThread();    if (myThread.isWaitingForOsr) {      OSR_PostThreadSwitch.postProcess(myThread);    }    //-#endif   }