VM_Thread target = new VM_StartupThread(MM_Interface.newStack(STACK_SIZE_NORMAL, false));
VM_Thread target = processors[i].idleQueue.dequeue();
  static void boot () throws VM_PragmaInterruptible {    if (VM.VerifyAssertions) VM._assert(1 <= numProcessors && numProcessors <= MAX_PROCESSORS);    if (VM.TraceThreads)      trace("VM_Scheduler.boot","numProcessors =", numProcessors);    // Create a VM_Processor object for each virtual cpu that we'll be running.    // Note that the VM_Processor object for the primordial processor    // (the virtual cpu in whose context we are currently running)    // was already created in the boot image by init(), above.    //    VM_Processor primordialProcessor = processors[PRIMORDIAL_PROCESSOR_ID];    VM_Processor [] origProcs = processors;    processors = new VM_Processor[1 + numProcessors];    for (int i = PRIMORDIAL_PROCESSOR_ID; i <= numProcessors; i++) {      VM_Processor p = (i < origProcs.length) ? origProcs[i] : null;      if (p == null) {        processors[i] = new VM_Processor(i);      } else {         processors[i] = p;        //-#if RVM_FOR_IA32        p.jtoc = VM_Magic.getJTOC();  // only needed for EXTRA_PROCS        //-#endif      }      //-#if RVM_WITH_HPM      // boot virtual processor's HPM producer      if (VM_HardwarePerformanceMonitors.booted()) {	processors[i].hpm.boot();          }      //-#endif    }    // Create work queues.    //    wakeupQueue     = new VM_ProxyWakeupQueue();    wakeupMutex     = new VM_ProcessorLock();    debuggerQueue   = new VM_ThreadQueue();    debuggerMutex   = new VM_ProcessorLock();    collectorQueue  = new VM_ThreadQueue();    collectorMutex  = new VM_ProcessorLock();    finalizerQueue  = new VM_ThreadQueue();    finalizerMutex  = new VM_ProcessorLock();    deadVPQueue     = new VM_ProcessorQueue();    availableProcessorQueue     = new VM_ProcessorQueue();    VM_CollectorThread.boot(numProcessors);    // Create one one idle thread per processor.    //    for (int i = 0; i < numProcessors; ++i) {      VM_Thread t = new VM_IdleThread(processors[1+i]);      t.start(processors[1+i].idleQueue);    }    // JNI support    terminated = false;             // the one we're running on    processors[PRIMORDIAL_PROCESSOR_ID].isInitialized = true;     // Create virtual cpu's.    //    //-#if RVM_FOR_SINGLE_VIRTUAL_PROCESSOR    //-#else    //-#if RVM_WITHOUT_INTERCEPT_BLOCKING_SYSTEM_CALLS     //-#else    // Create thread-specific data key which will allow us to find    // the correct VM_Processor from an arbitrary pthread.    VM_SysCall.sysCreateThreadSpecificDataKeys();    // enable spoofing of blocking native select calls    System.loadLibrary("syswrap");    //-#endif    VM_SysCall.sysInitializeStartupLocks(numProcessors);    if (cpuAffinity != NO_CPU_AFFINITY)      VM_SysCall.sysVirtualProcessorBind(cpuAffinity + PRIMORDIAL_PROCESSOR_ID - 1); // bind it to a physical cpu    for (int i = PRIMORDIAL_PROCESSOR_ID; ++i <= numProcessors; ) {      // create VM_Thread for virtual cpu to execute      //      VM_Thread target = new VM_StartupThread(MM_Interface.newStack(STACK_SIZE_NORMAL, false));      // create virtual cpu and wait for execution to enter target's code/stack.      // this is done with gc disabled to ensure that garbage collector doesn't move      // code or stack before the C startoff function has a chance      // to transfer control into vm image.      //      if (VM.TraceThreads)        trace("VM_Scheduler.boot", "starting processor id", i);      processors[i].activeThread = target;      processors[i].activeThreadStackLimit = target.stackLimit;      target.registerThread(); // let scheduler know that thread is active.      if (VM.BuildForPowerPC) {        //-#if RVM_FOR_POWERPC        // NOTE: it is critical that we acquire the tocPointer explicitly        //       before we start the SysCall sequence. This prevents         //       the opt compiler from generating code that passes the AIX         //       sys toc instead of the RVM jtoc. --dave        VM_Address toc = VM_Magic.getTocPointer();        VM_SysCall.sysVirtualProcessorCreate(toc,                                             VM_Magic.objectAsAddress(processors[i]),                                             target.contextRegisters.ip,                                              target.contextRegisters.getInnermostFramePointer());        if (cpuAffinity != NO_CPU_AFFINITY)          VM_SysCall.sysVirtualProcessorBind(cpuAffinity + i - 1); // bind it to a physical cpu        //-#endif      } else if (VM.BuildForIA32) {        VM_SysCall.sysVirtualProcessorCreate(VM_Magic.getTocPointer(),                                             VM_Magic.objectAsAddress(processors[i]),                                             target.contextRegisters.ip,                                              target.contextRegisters.getInnermostFramePointer());      }    }    // wait for everybody to start up    //    VM_SysCall.sysWaitForVirtualProcessorInitialization();    //-#endif    allProcessorsInitialized = true;    //    for (int i = PRIMORDIAL_PROCESSOR_ID; i <= numProcessors; ++i)    //      processors[i].enableThreadSwitching();    VM_Processor.getCurrentProcessor().enableThreadSwitching();    // Start interrupt driven timeslicer to improve threading fairness and responsiveness.    //    if (!VM.BuildForDeterministicThreadSwitching) {      schedulingQuantum = VM.interruptQuantum * VM.schedulingMultiplier;      if (VM.TraceThreads) {        VM.sysWrite("  schedulingQuantum "       +  schedulingQuantum);        VM.sysWrite(" = VM.interruptQuantum "    +VM.interruptQuantum);        VM.sysWrite(" * VM.schedulingMultiplier "+VM.schedulingMultiplier);        VM.sysWriteln();      }      VM_SysCall.sysVirtualProcessorEnableTimeSlicing(VM.interruptQuantum);    }    // Allow virtual cpus to commence feeding off the work queues.    //    //-#if RVM_FOR_SINGLE_VIRTUAL_PROCESSOR    //-#else    VM_SysCall.sysWaitForMultithreadingStart();    //-#endif    //-#if RVM_WITH_OSR    OSR_ObjectHolder.boot();    //-#endif    // Start collector threads on each VM_Processor.    for (int i = 0; i < numProcessors; ++i) {      VM_Thread t = VM_CollectorThread.createActiveCollectorThread(processors[1+i]);      t.start(processors[1+i].readyQueue);    }    // Start the G.C. system.    // Create the FinalizerThread    FinalizerThread tt = new FinalizerThread();    tt.makeDaemon(true);    tt.start();    //-#if RVM_WITHOUT_INTERCEPT_BLOCKING_SYSTEM_CALLS    //-#else    // Store VM_Processor in pthread    VM_Processor.getCurrentProcessor().stashProcessorInPthread();    //-#endif  }