final Vm vm = new Vm(arch, new DefaultHeapManager(clsMgr, helper,
final Vm vm = new Vm(version, arch, new DefaultHeapManager(clsMgr, helper,
    private final void doExecute() throws BuildException {        debug = (getProject().getProperty("jnode.debug") != null);        final long lmJar = jarFile.lastModified();        final long lmKernel = kernelFile.lastModified();        final long lmDest = destFile.lastModified();        final long lmPIL = getPluginListFile().lastModified();        final PluginList piList;        final long lmPI;        try {            log("plugin-list: " + getPluginListFile(), Project.MSG_DEBUG);            piList = getPluginList();            lmPI = piList.lastModified();        } catch (PluginException ex) {            throw new BuildException(ex);        } catch (IOException ex) {            throw new BuildException(ex);        }        if ((lmJar < lmDest) && (lmKernel < lmDest) && (lmPIL < lmDest)                && (lmPI < lmDest)) {         // No need to do anything, skip        return; }        if (debugFile != null) {            debugFile.delete();        }        try {            System.getProperties().setProperty(BUILDTIME_PROPERTY, "1");            // Load the plugin descriptors            final PluginRegistry piRegistry;            piRegistry = new PluginRegistryModel(piList.getPluginList());            //piRegistry = new            // PluginRegistryModel(piList.getDescriptorUrlList());            testPluginPrerequisites(piRegistry);            /* Now create the processor */            final VmArchitecture arch = getArchitecture();            final NativeStream os = createNativeStream();            clsMgr = new VmSystemClassLoader(classesURL, arch,                    new BuildObjectResolver(os, this));            blockedObjects.add(clsMgr);            blockedObjects.add(clsMgr.getStatics());            blockedObjects.add(clsMgr.getStatics().getTable());            if (debug) {                log("Building in DEBUG mode", Project.MSG_WARN);            }            // Create the VM            final HeapHelper helper = new HeapHelperImpl(arch);            final Vm vm = new Vm(arch, new DefaultHeapManager(clsMgr, helper,                    clsMgr.getStatics()), clsMgr.getStatics(), debug);            blockedObjects.add(vm);            final VmProcessor proc = createProcessor(clsMgr.getStatics());            log("Building for " + proc.getCPUID());            final Label clInitCaller = new Label("$$clInitCaller");            VmType systemClasses[] = VmType.initializeForBootImage(clsMgr);            for (int i = 0; i < systemClasses.length; i++) {                clsMgr.addLoadedClass(systemClasses[ i].getName(),                        systemClasses[ i]);            }            // First copy the native kernel file            copyKernel(os);            os.setObjectRef(bootHeapStart);            // Setup a call to our first java method            initImageHeader(os, clInitCaller, vm, piRegistry);            // Create the initial stack            createInitialStack(os, initialStack, initialStackPtr);            /* Now load the classes */            loadClass(VmMethodCode.class);            loadClass(Unsafe.class);            loadClass(VmSystemClassLoader.class);            loadClass(VmType[].class);            loadClass(Vm.class);            loadClass(VmBootHeap.class);            loadClass(VmDefaultHeap.class);            loadClass(VmHeapManager.class);            loadClass(VmStatics.class);            loadClass(vm.getHeapManager().getClass());            loadClass(HeapHelper.class);            loadClass(HeapHelperImpl.class);            loadSystemClasses();            /* Now emit the processor */            os.getObjectRef(proc);            /* Let the compilers load its native symbol offsets */            final NativeCodeCompiler[] cmps = arch.getCompilers();            for (int i = 0; i < cmps.length; i++) {                final NativeCodeCompiler cmp = cmps[ i];                cmp.initialize(clsMgr);                os.getObjectRef(cmp);            }            // Load the jarfile as byte-array            copyJarFile(os);            // Now emit all object images to the actual image            emitObjects(os, arch, blockedObjects);            // Disallow the loading of new classes            clsMgr.setFailOnNewLoad(true);            emitObjects(os, arch, blockedObjects);            // Emit the classmanager            log("Emit vm", Project.MSG_VERBOSE);            blockedObjects.remove(vm);            emitObjects(os, arch, blockedObjects);            // Twice, this is intended!            emitObjects(os, arch, blockedObjects);            /* Set the bootclasses */            log("prepare bootClassArray", Project.MSG_VERBOSE);            final VmType bootClasses[] = clsMgr.prepareAfterBootstrap();            os.getObjectRef(bootClasses);            emitObjects(os, arch, blockedObjects);            // Twice, this is intended!            emitObjects(os, arch, blockedObjects);            // Emit the classmanager            log("Emit clsMgr", Project.MSG_VERBOSE);            // Turn auto-compilation on            clsMgr.setCompileRequired();            blockedObjects.remove(clsMgr);            emitObjects(os, arch, blockedObjects);            // Twice, this is intended!            emitObjects(os, arch, blockedObjects);            // Emit the classmanager            log("Emit statics", Project.MSG_VERBOSE);            blockedObjects.remove(clsMgr.getStatics());            emitObjects(os, arch, blockedObjects);            // Twice, this is intended!            emitObjects(os, arch, blockedObjects);            // Emit the remaining objects            log("Emit rest; blocked=" + blockedObjects, Project.MSG_VERBOSE);            emitObjects(os, arch, null);            log("statics table 0x"                    + NumberUtils.hex(os.getObjectRef(                            clsMgr.getStatics().getTable()).getOffset()),                    Project.MSG_VERBOSE);            /* Write static initializer code */            emitStaticInitializerCalls(os, bootClasses, clInitCaller);            // This is the end of the image            X86Stream.ObjectInfo dummyObjectAtEnd = os                    .startObject(loadClass(VmMethodCode.class));            pageAlign(os);            dummyObjectAtEnd.markEnd();            os.setObjectRef(imageEnd);            os.setObjectRef(bootHeapEnd);            /* Link all native symbols */            linkNativeSymbols(os);            // Patch multiboot header            patchHeader(os);            // Store the image            storeImage(os);            // Generate the listfile            printLabels(os, bootClasses, clsMgr.getStatics());            // Generate debug info            for (int i = 0; i < cmps.length; i++) {                cmps[ i].dumpStatistics();            }            final int bootHeapSize = os.getObjectRef(bootHeapEnd).getOffset()                    - os.getObjectRef(bootHeapStart).getOffset();            final int bootHeapBitmapSize = (bootHeapSize / ObjectLayout.OBJECT_ALIGN) >> 3;            log("Boot heap size " + (bootHeapSize >>> 10) + "K bitmap size "                    + (bootHeapBitmapSize >>> 10) + "K");            clsMgr.getStatics().dumpStatistics(System.out);            logStatistics(os);            BytecodeParser.dumpStatistics();                        log("Optimized methods     : " + totalHighMethods + ", avg size "                    + (totalHighMethodSize / totalHighMethods) + ", tot size "                    + totalHighMethodSize);            log("Ondemand comp. methods: " + totalLowMethods + ", avg size "                    + (totalLowMethodSize / totalLowMethods) + ", tot size "                    + totalLowMethodSize);                        log("Done.");                        os.clear();        } catch (Throwable ex) {            ex.printStackTrace();            throw new BuildException(ex);        }            }