currentThread.startQuantum(VM_Time.cycles());
  public static void boot() throws Exception,                                    VM_PragmaLogicallyUninterruptible {    writingBootImage = false;    runningVM        = true;    runningAsSubsystem = false;    verboseBoot = VM_BootRecord.the_boot_record.verboseBoot;    sysWriteLockOffset = VM_Entrypoints.sysWriteLockField.getOffset();    if (verboseBoot >= 1) VM.sysWriteln("Booting");    // Set up the current VM_Processor object.  The bootstrap program    // has placed a pointer to the current VM_Processor in a special    // register.    if (verboseBoot >= 1) VM.sysWriteln("Setting up current VM_Processor");    VM_ProcessorLocalState.boot();    // Finish thread initialization that couldn't be done in boot image.    // The "stackLimit" must be set before any interruptible methods are called    // because it's accessed by compiler-generated stack overflow checks.    //    if (verboseBoot >= 1) VM.sysWriteln("Doing thread initialization");    VM_Thread currentThread = VM_Processor.getCurrentProcessor().activeThread;    currentThread.stackLimit = VM_Magic.objectAsAddress(currentThread.stack).add(STACK_SIZE_GUARD);    VM_Processor.getCurrentProcessor().activeThreadStackLimit = currentThread.stackLimit;    // get pthread_id from OS and store into vm_processor field    //     if (!BuildForSingleVirtualProcessor)      VM_Processor.getCurrentProcessor().pthread_id = VM_SysCall.sysPthreadSelf();    // Initialize memory manager's virtual processor local state.    // This must happen before any putfield or arraystore of object refs    // because the buffer is accessed by compiler-generated write barrier code.    //    if (verboseBoot >= 1) VM.sysWriteln("Setting up write barrier");    MM_Interface.setupProcessor(VM_Processor.getCurrentProcessor());        // Initialize memory manager.    //    This must happen before any uses of "new".    //    if (verboseBoot >= 1) VM.sysWriteln("Setting up memory manager: bootrecord = ", VM_Magic.objectAsAddress(VM_BootRecord.the_boot_record));    MM_Interface.boot(VM_BootRecord.the_boot_record);        // Start calculation of cycles to millsecond conversion factor    if (verboseBoot >= 1) VM.sysWriteln("Stage one of booting VM_Time");    VM_Time.bootStageOne();    // Reset the options for the baseline compiler to avoid carrying     // them over from bootimage writing time.    //     if (verboseBoot >= 1) VM.sysWriteln("Initializing baseline compiler options to defaults");    VM_BaselineCompiler.initOptions();    // Create class objects for static synchronized methods in the bootimage.    // This must happen before any static synchronized methods of bootimage     // classes can be invoked.    if (verboseBoot >= 1) VM.sysWriteln("Creating class objects for static synchronized methods");    createClassObjects();    // Fetch arguments from program command line.    //    if (verboseBoot >= 1) VM.sysWriteln("Fetching command-line arguments");    VM_CommandLineArgs.fetchCommandLineArguments();    // Process most virtual machine command line arguments.    //    if (verboseBoot >= 1) VM.sysWriteln("Early stage processing of command line");    VM_CommandLineArgs.earlyProcessCommandLineArguments();    // Allow Memory Manager to respond to its command line arguments    //    if (verboseBoot >= 1) VM.sysWriteln("Collector processing rest of boot options");    MM_Interface.postBoot();    // Initialize class loader.    //    if (verboseBoot >= 1) VM.sysWriteln("Initializing class loader");    String vmClasses = VM_CommandLineArgs.getVMClasses();    VM_ClassLoader.boot(vmClasses);    VM_SystemClassLoader.boot();    // Complete calculation of cycles to millsecond conversion factor    // Must be done before any dynamic compilation occurs.    if (verboseBoot >= 1) VM.sysWriteln("Stage two of booting VM_Time");    VM_Time.bootStageTwo();    // Initialize statics that couldn't be placed in bootimage, either     // because they refer to external state (open files), or because they     // appear in fields that are unique to Jikes RVM implementation of     // standard class library (not part of standard jdk).    // We discover the latter by observing "host has no field" and     // "object not part of bootimage" messages printed out by bootimage     // writer.    //    if (verboseBoot >= 1) VM.sysWriteln("Running various class initializers");    runClassInitializer("java.lang.Runtime");    runClassInitializer("java.lang.System");    runClassInitializer("java.io.File");    runClassInitializer("java.lang.Void");    runClassInitializer("java.lang.Boolean");    runClassInitializer("java.lang.Byte");    runClassInitializer("java.lang.Short");    runClassInitializer("java.lang.Number");    runClassInitializer("java.lang.Integer");    runClassInitializer("java.lang.Long");    runClassInitializer("java.lang.Float");    runClassInitializer("java.lang.Character");    runClassInitializer("gnu.java.io.EncodingManager");    runClassInitializer("java.lang.Thread");    runClassInitializer("java.lang.ThreadGroup");    runClassInitializer("java.io.PrintWriter");    runClassInitializer("gnu.java.lang.SystemClassLoader");    runClassInitializer("java.lang.String");    runClassInitializer("java.lang.VMString");    runClassInitializer("gnu.java.security.provider.DefaultPolicy");    runClassInitializer("java.security.Policy");    runClassInitializer("java.util.WeakHashMap");    runClassInitializer("java.lang.ClassLoader");    runClassInitializer("java.lang.Math");    runClassInitializer("java.util.TimeZone");    runClassInitializer("java.util.Locale");    runClassInitializer("java.util.Calendar");    runClassInitializer("java.util.GregorianCalendar");    runClassInitializer("java.util.ResourceBundle");    runClassInitializer("java.util.zip.ZipEntry");    runClassInitializer("java.util.zip.Inflater");    runClassInitializer("java.util.zip.DeflaterHuffman");    runClassInitializer("java.util.zip.InflaterDynHeader");    runClassInitializer("java.util.zip.InflaterHuffmanTree");    runClassInitializer("gnu.java.locale.Calendar");    runClassInitializer("java.util.Date");    //-#if RVM_WITH_ALL_CLASSES    runClassInitializer("java.util.jar.Attributes$Name");    //-#endif    if (verboseBoot >= 1) VM.sysWriteln("Booting VM_Lock");    VM_Lock.boot();        // set up HPM    //-#if RVM_WITH_HPM    if (BuildForHPM) {      if (VM_HardwarePerformanceMonitors.enabled()) {        // assume only one Java thread is executing!        if(VM_HardwarePerformanceMonitors.verbose>=2)          VM.sysWriteln("VM.boot() call VM_HardwarePerformanceMonitors.boot()");        VM_HardwarePerformanceMonitors.boot();      }    }    //-#endif    // Enable multiprocessing.    // Among other things, after this returns, GC and dynamic class loading are enabled.    //     if (verboseBoot >= 1) VM.sysWriteln("Booting scheduler");    VM_Scheduler.boot();    // Create JNI Environment for boot thread.      // After this point the boot thread can invoke native methods.    com.ibm.JikesRVM.jni.VM_JNIEnvironment.boot();    if (verboseBoot >= 1) VM.sysWriteln("Initializing JNI for boot thread");    VM_Thread.getCurrentThread().initializeJNIEnv();    //-#if RVM_WITH_HPM    runClassInitializer("com.ibm.JikesRVM.Java2HPM");    VM_HardwarePerformanceMonitors.setUpHPMinfo();    //-#endif    // Run class intializers that require JNI    if (verboseBoot >= 1) VM.sysWriteln("Running late class initializers");    runClassInitializer("gnu.java.nio.channels.FileChannelImpl");    runClassInitializer("java.io.FileDescriptor");    runClassInitializer("java.lang.Double");    runClassInitializer("java.util.PropertyPermission");    runClassInitializer("com.ibm.JikesRVM.VM_Process");    // Initialize java.lang.System.out, java.lang.System.err, java.lang.System.in    VM_FileSystem.initializeStandardStreams();    ///////////////////////////////////////////////////////////////    // The VM is now fully booted.                               //    // By this we mean that we can execute arbitrary Java code.  //    ///////////////////////////////////////////////////////////////    if (verboseBoot >= 1) VM.sysWriteln("VM is now fully booted");        // Inform interested subsystems that VM is fully booted.    VM.fullyBooted = true;    MM_Interface.fullyBootedVM();    VM_BaselineCompiler.fullyBootedVM();    // Allow profile information to be read in from a file    //     VM_EdgeCounts.boot();    // Initialize compiler that compiles dynamically loaded classes.    //    if (verboseBoot >= 1) VM.sysWriteln("Initializing runtime compiler");    VM_RuntimeCompiler.boot();    // Process remainder of the VM's command line arguments.    if (verboseBoot >= 1) VM.sysWriteln("Late stage processing of command line");    String[] applicationArguments = VM_CommandLineArgs.lateProcessCommandLineArguments();    if (VM.verboseClassLoading || verboseBoot >= 1) VM.sysWrite("[VM booted]\n");    // set up JikesRVM socket I/O    if (verboseBoot >= 1) VM.sysWriteln("Initializing socket factories");    JikesRVMSocketImpl.boot();    //-#if RVM_WITH_ADAPTIVE_SYSTEM    if (verboseBoot >= 1) VM.sysWriteln("Initializing adaptive system");    com.ibm.JikesRVM.adaptive.VM_Controller.boot();    //-#endif    // The first argument must be a class name.    if (verboseBoot >= 1) VM.sysWriteln("Extracting name of class to execute");    if (applicationArguments.length == 0) {      pleaseSpecifyAClass();    }    if (applicationArguments.length > 0 &&         ! VM_TypeDescriptorParsing.isJavaClassName(applicationArguments[0])) {      VM.sysWrite("vm: \"");      VM.sysWrite(applicationArguments[0]);      VM.sysWrite("\" is not a legal Java class name.\n");      pleaseSpecifyAClass();    }    // Create main thread.    // Work around class incompatibilities in boot image writer    // (JDK's java.lang.Thread does not extend VM_Thread) [--IP].    // Junk this when we do feature 3601.    if (verboseBoot >= 1) VM.sysWriteln("Constructing mainThread");    Thread      xx         = new MainThread(applicationArguments);    VM_Address  yy         = VM_Magic.objectAsAddress(xx);    VM_Thread   mainThread = (VM_Thread)VM_Magic.addressAsObject(yy);    //-#if RVM_WITH_OSR    // Notify application run start    VM_Callbacks.notifyAppRunStart("VM", 0);    //-#endif    // Schedule "main" thread for execution.    if (verboseBoot >= 1) VM.sysWriteln("Starting main thread");    mainThread.start();    // Create one debugger thread.    VM_Thread t = new DebuggerThread();    t.start(VM_Scheduler.debuggerQueue);    //-#if RVM_WITH_HPM    if (VM_HardwarePerformanceMonitors.enabled()) {      // IS THIS NEEDED?      if (!VM_HardwarePerformanceMonitors.thread_group) {        if(VM_HardwarePerformanceMonitors.verbose>=2)          VM.sysWrite(" VM.boot() call sysHPMresetMyThread()\n");        VM_SysCall.sysHPMresetMyThread();      }    }    //-#endif    // End of boot thread.    //    if (VM.TraceThreads) VM_Scheduler.trace("VM.boot", "completed - terminating");    VM_Thread.terminate();    if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED);  }