From: <ls...@us...> - 2009-04-11 13:57:52
|
Revision: 5245 http://jnode.svn.sourceforge.net/jnode/?rev=5245&view=rev Author: lsantha Date: 2009-04-11 13:57:39 +0000 (Sat, 11 Apr 2009) Log Message: ----------- Removing non-classlib classes. Modified Paths: -------------- classlib6/builder/build.xml classlib6/core/build.xml classlib6/core/src/core/org/jnode/vm/VmSystem.java Removed Paths: ------------- classlib6/builder/src/builder/org/jnode/ant/taskdefs/Native2AsciiTask.java classlib6/builder/src/builder/org/jnode/ant/taskdefs/NativeCheckTask.java classlib6/builder/src/builder/org/jnode/build/AbstractAsmConstBuilder.java classlib6/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java classlib6/builder/src/builder/org/jnode/build/AbstractPluginsTask.java classlib6/builder/src/builder/org/jnode/build/AddressFinder.java classlib6/builder/src/builder/org/jnode/build/BuildObjectResolver.java classlib6/builder/src/builder/org/jnode/build/FieldInfo.java classlib6/builder/src/builder/org/jnode/build/InitJarBuilder.java classlib6/builder/src/builder/org/jnode/build/InitJarsBuilder.java classlib6/builder/src/builder/org/jnode/build/ObjectEmitter.java classlib6/builder/src/builder/org/jnode/build/PluginList.java classlib6/builder/src/builder/org/jnode/build/dependencies/ classlib6/builder/src/builder/org/jnode/build/documentation/ classlib6/builder/src/builder/org/jnode/build/packager/PluginListInsertor.java classlib6/builder/src/builder/org/jnode/build/x86/ classlib6/builder/src/builder/org/jnode/jnasm/ classlib6/builder/src/builder/org/jnode/linker/ classlib6/builder/src/builder/org/jnode/pluginlist/ classlib6/core/descriptors/org.jnode.vm.memmgr.mmtk.genrc.xml classlib6/core/descriptors/org.jnode.vm.memmgr.mmtk.ms.xml classlib6/core/descriptors/org.jnode.vm.memmgr.mmtk.nogc.xml classlib6/core/src/core/org/jnode/debugger/ classlib6/core/src/core/org/jnode/log4j/config/ classlib6/core/src/core/org/jnode/security/JNodeSecurityManager.java classlib6/core/src/core/org/jnode/security/SecurityPlugin.java classlib6/core/src/template/ Modified: classlib6/builder/build.xml =================================================================== --- classlib6/builder/build.xml 2009-04-11 11:08:25 UTC (rev 5244) +++ classlib6/builder/build.xml 2009-04-11 13:57:39 UTC (rev 5245) @@ -54,38 +54,8 @@ includes="org/jnode/ant/taskdefs/**"/> </target> - <target name="javacc" depends="prepare" > - <javacc target="${jnasm-src.dir}/preprocessor/gen/JNAsmPP.jj" - javacchome="${javacc.dir}" - outputdirectory="${jnasm-preprocessor-gen.dir}" /> - <javacc target="${jnasm-src.dir}/assembler/gen/JNAsm.jj" - javacchome="${javacc.dir}" - outputdirectory="${jnasm-assembler-gen.dir}" /> - <condition property="run.native2ascii"> - <or> - <isfileselected file="${jnasm-assembler-gen.dir}/JNAsm.java"> - <date datetime="${hotswap.class.tstamp}" pattern="${hotswap.class.tstamp.pattern}" when="after"/> - </isfileselected> - <isfileselected file="${jnasm-preprocessor-gen.dir}/JNAsmPP.java"> - <date datetime="${hotswap.class.tstamp}" pattern="${hotswap.class.tstamp.pattern}" when="after"/> - </isfileselected> - </or> - </condition> - </target> - - <target name="native2ascii" depends="javacc" if="run.native2ascii"> - <native2ascii src="${jnasm-preprocessor-gen.dir}" includes="JNAsmPP.java" - dest="${jnasm-preprocessor-gen.dir}" ext=".tmp"/> - <move file="${jnasm-preprocessor-gen.dir}/JNAsmPP.tmp" - tofile="${jnasm-preprocessor-gen.dir}/JNAsmPP.java" overwrite="yes"/> - <native2ascii src="${jnasm-assembler-gen.dir}" includes="JNAsm.java" - dest="${jnasm-assembler-gen.dir}" ext=".tmp"/> - <move file="${jnasm-assembler-gen.dir}/JNAsm.tmp" - tofile="${jnasm-assembler-gen.dir}/JNAsm.java" overwrite="yes"/> - </target> - <!-- Compile all subproject java files --> - <target name="compile" depends="native2ascii"> + <target name="compile" depends="prepare"> <jnode.compile> <src path="${my-src.dir}/builder"/> <src path="${my-gen.dir}"/> Deleted: classlib6/builder/src/builder/org/jnode/ant/taskdefs/Native2AsciiTask.java =================================================================== --- classlib6/builder/src/builder/org/jnode/ant/taskdefs/Native2AsciiTask.java 2009-04-11 11:08:25 UTC (rev 5244) +++ classlib6/builder/src/builder/org/jnode/ant/taskdefs/Native2AsciiTask.java 2009-04-11 13:57:39 UTC (rev 5245) @@ -1,88 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003-2009 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.jnode.ant.taskdefs; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.taskdefs.Execute; - -/** - * @author Ewout Prangsma (ep...@us...) - */ -public class Native2AsciiTask extends FileSetTask { - - private boolean update = false; - - public final boolean isUpdate() { - return update; - } - - @Override - protected void processFile(File file) throws IOException { - if (containsNonAscii(file)) { - final File tmp = File.createTempFile("jnode", "n2a"); - try { - final String[] cmd = {"native2ascii", file.getAbsolutePath(), - tmp.getAbsolutePath()}; - final Execute exe = new Execute(); - exe.setCommandline(cmd); - final int rc = exe.execute(); - if (rc != 0) { - throw new BuildException("native2ascii failed"); - } - if (file.length() != tmp.length()) { - // We have a changed file - if (update) { - getProject().copyFile(tmp, file); - log("Updated " + file); - } else { - log("Update needed " + file); - } - } - } finally { - tmp.delete(); - } - } - } - - private boolean containsNonAscii(File file) throws IOException { - final FileInputStream is = new FileInputStream(file); - try { - final BufferedInputStream bis = new BufferedInputStream(is); - int v; - while ((v = bis.read()) >= 0) { - if ((v & 0xFF) > 128) { - return true; - } - } - return false; - } finally { - is.close(); - } - } - - public final void setUpdate(boolean update) { - this.update = update; - } -} Deleted: classlib6/builder/src/builder/org/jnode/ant/taskdefs/NativeCheckTask.java =================================================================== --- classlib6/builder/src/builder/org/jnode/ant/taskdefs/NativeCheckTask.java 2009-04-11 11:08:25 UTC (rev 5244) +++ classlib6/builder/src/builder/org/jnode/ant/taskdefs/NativeCheckTask.java 2009-04-11 13:57:39 UTC (rev 5245) @@ -1,294 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003-2009 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.jnode.ant.taskdefs; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import org.apache.tools.ant.BuildException; -import org.jnode.vm.VmUtils; -import org.objectweb.asm.Attribute; -import org.objectweb.asm.ClassAdapter; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.CodeVisitor; -import org.objectweb.asm.attrs.Attributes; - -/** - * That ant task will check that native methods are properly implemented - * for JNode. - * - * @author Fabien DUMINY (fduminy at jnode.org) - */ -public class NativeCheckTask extends FileSetTask { - /** - * potential implementation of the native methods for JNode. - * key: className (String) - * value: native methods for the class (List<NativeMethod>) - */ - private Map<String, List<NativeMethod>> jnodeNativeMethods = new HashMap<String, List<NativeMethod>>(); - - /** - * native methods per class. - * key: className (String) - * value: native methods for the class (List<NativeMethod>) - */ - private Map<String, List<NativeMethod>> nativeMethods = new HashMap<String, List<NativeMethod>>(); - - private Set<String> missingClasses = new TreeSet<String>(); - private Map<String, List<NativeMethod>> missingMethods = new HashMap<String, List<NativeMethod>>(); - - protected void doExecute() throws BuildException { - // process all classes to find native methods - // and classes that could potentially implement native methods - // for JNode - processFiles(); - - // now, check all native methods are properly implemented - // for JNode - int nbNativeMethods = 0; - for (String className : nativeMethods.keySet()) { - List<NativeMethod> methods = nativeMethods.get(className); - for (NativeMethod method : methods) { - nbNativeMethods++; - checkNativeMethod(className, method); - } - } - - // report - final String INDENT = " "; - - int nbMissingClasses = missingClasses.size(); - if (!missingClasses.isEmpty()) { - System.err.println("Missing classes:"); - for (String missingClass : missingClasses) { - System.err.println(INDENT + missingClass); - } - } - - int nbMissingMethods = 0; - if (!missingMethods.isEmpty()) { - System.err.println("Missing methods:"); - for (String cls : missingMethods.keySet()) { - System.err.println(INDENT + " class " + cls); - for (NativeMethod m : missingMethods.get(cls)) { - System.err.println(INDENT + INDENT + m.getName()); - nbMissingMethods++; - } - } - } - - System.out.println("Found " + nbNativeMethods + " native methods in " + nativeMethods.size() + " classes"); - if ((nbMissingMethods != 0) || (nbMissingClasses != 0)) { - System.err.println(missingClasses.size() + " missing classes. " + nbMissingMethods + " missing methods"); - - String message = "Some native methods are not properly implemented (see errors above)"; - if (failOnError) { - throw new BuildException(message); - } else { - System.err.println("[FAILED] " + message); - } - } else { - System.out.println("[OK] All native methods are properly defined"); - } - } - - private boolean checkNativeMethod(String className, NativeMethod method) { - boolean hasError = false; - String jnodeNativeClass = VmUtils.getNativeClassName(className.replace('/', '.')); - - if (jnodeNativeMethods.containsKey(jnodeNativeClass)) { - List<NativeMethod> methods = jnodeNativeMethods.get(jnodeNativeClass); - boolean found = false; - for (NativeMethod nvMethod : methods) { - if (method.getName().equals(nvMethod.getName())) { - found = true; - break; - } - } - - if (!found) { - List<NativeMethod> methodList = missingMethods.get(jnodeNativeClass); - if (methodList == null) { - methodList = new ArrayList<NativeMethod>(); - missingMethods.put(jnodeNativeClass, methodList); - } - - methodList.add(method); - hasError = true; - } - } else { - missingClasses.add(jnodeNativeClass); - hasError = true; - } - - return hasError; - } - - @Override - protected void processFile(File file) throws IOException { - FileInputStream fis = null; - - try { - fis = new FileInputStream(file); - NativeMethodClassVisitor v = getNativeMethods(file, fis); - if ((v != null) && !v.getNativeMethods().isEmpty()) { - if (v.couldImplementNativeMethods()) { - jnodeNativeMethods.put(v.getClassName(), v.getNativeMethods()); - } else { - nativeMethods.put(v.getClassName(), v.getNativeMethods()); - } - } - } finally { - if (fis != null) { - fis.close(); - } - } - } - - private NativeMethodClassVisitor getNativeMethods(File file, InputStream inputClass) throws BuildException { - ClassWriter cw = new ClassWriter(false); - NativeMethodClassVisitor v = null; - try { - ClassReader cr = new ClassReader(inputClass); - v = new NativeMethodClassVisitor(file, cw); - cr.accept(v, Attributes.getDefaultAttributes(), true); - - if (v.allowNatives()) { - // if natives are allowed for that class, no need to check - // for a pure java implementation - v = null; - } - } catch (Exception ex) { - System.err.println("Unable to load class in file " + file.getAbsolutePath() + " : " + ex.getMessage()); - } - return v; - } - - private static class NativeMethodClassVisitor extends ClassAdapter { - private String className; - private boolean couldImplementNativeMethods; - private boolean allowNatives = false; - private List<NativeMethod> nativeMethods = new ArrayList<NativeMethod>(); - - public NativeMethodClassVisitor(File file, ClassVisitor cv) { - super(cv); - } - - @Override - public void visit(int version, - int access, - String name, - String superName, - String[] interfaces, - String sourceFile) { - this.className = name.replace('/', '.'); - this.allowNatives = VmUtils.allowNatives(className, "x86"); //TODO hard coded architecture: change that ! - this.couldImplementNativeMethods = VmUtils.couldImplementNativeMethods(className); - - super.visit(version, access, name, superName, interfaces, sourceFile); - } - - @Override - public CodeVisitor visitMethod(int access, - String name, - String desc, - String[] exceptions, - Attribute attrs) { - if (!allowNatives) { - // we don't allow native for that class => - // we must have a pure java implementation for that method - - if ((couldImplementNativeMethods && isStatic(access)) || - isNative(access)) { - nativeMethods.add(new NativeMethod(access, name, desc)); - } - } - - return null; // we don't to visit inside the method - } - - public String getClassName() { - return className; - } - - public List<NativeMethod> getNativeMethods() { - return nativeMethods; - } - - public boolean couldImplementNativeMethods() { - return couldImplementNativeMethods; - } - - public boolean allowNatives() { - return allowNatives; - } - } - - private static class NativeMethod { - private final int access; - private final String name; - private final String desc; - - public NativeMethod(int access, String name, String desc) { - super(); - this.access = access; - this.name = name; - this.desc = desc; - } - - public int getAccess() { - return access; - } - - public String getName() { - return name; - } - - public String getDesc() { - return desc; - } - - public String toString() { - return name + " " + desc; - } - } - - public static boolean isNative(int access) { - return isSet(access, org.objectweb.asm.Constants.ACC_NATIVE); - } - - public static boolean isStatic(int access) { - return isSet(access, org.objectweb.asm.Constants.ACC_STATIC); - } - - private static boolean isSet(int access, int flag) { - return ((access & flag) == flag); - } -} Deleted: classlib6/builder/src/builder/org/jnode/build/AbstractAsmConstBuilder.java =================================================================== --- classlib6/builder/src/builder/org/jnode/build/AbstractAsmConstBuilder.java 2009-04-11 11:08:25 UTC (rev 5244) +++ classlib6/builder/src/builder/org/jnode/build/AbstractAsmConstBuilder.java 2009-04-11 13:57:39 UTC (rev 5245) @@ -1,245 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003-2009 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.jnode.build; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Date; -import org.jnode.vm.Vm; -import org.jnode.vm.VmArchitecture; -import org.jnode.vm.VmSystemClassLoader; -import org.jnode.vm.classmgr.VmField; -import org.jnode.vm.classmgr.VmInstanceField; -import org.jnode.vm.classmgr.VmNormalClass; -import org.jnode.vm.classmgr.VmType; - -/** - * TODO describe the class. - * - * @author epr - */ -public abstract class AbstractAsmConstBuilder { - - private File destFile; - private URL classesURL; - private ArrayList<ClassName> classes = new ArrayList<ClassName>(); - - /** - * Execute this task. - * - * @throws BuildException - */ - public void execute() throws BuildException { - try { - doExecute(); - } catch (Throwable ex) { - ex.printStackTrace(); - throw new BuildException(ex); - } - } - - /** - * Execute this task. - * - * @throws BuildException - * @throws ClassNotFoundException - * @throws IllegalAccessException - * @throws IOException - * @throws InstantiationException - */ - private void doExecute() - throws BuildException, ClassNotFoundException, IllegalAccessException, IOException, InstantiationException { - - final VmArchitecture arch = getArchitecture(); - final int slotSize = arch.getReferenceSize(); - final VmSystemClassLoader cl = new VmSystemClassLoader(classesURL, arch); - final Vm vm = new Vm("?", arch, cl.getSharedStatics(), false, cl, null); - vm.toString(); // Just to avoid compiler warnings - VmType.initializeForBootImage(cl); - long lastModified = 0; - - FileWriter fw = new FileWriter(destFile); - PrintWriter out = new PrintWriter(fw); - out.println("; " + destFile.getPath()); - out.println("; THIS file has been generated automatically on " + new Date()); - out.println(); - - for (ClassName cn : classes) { - final URL classUrl = cn.getURL(classesURL); - lastModified = Math.max(lastModified, classUrl.openConnection().getLastModified()); - out.println("; Constants for " + cn.getClassName()); - - if (cn.isStatic()) { - Class<?> cls = Class.forName(cn.getClassName()); - Field fields[] = cls.getDeclaredFields(); - for (int i = 0; i < fields.length; i++) { - Field f = fields[i]; - if (Modifier.isStatic(f.getModifiers()) && Modifier.isPublic(f.getModifiers())) { - Object value = f.get(null); - if (value instanceof Number) { - String cname = cls.getName(); - int idx = cname.lastIndexOf('.'); - if (idx > 0) { - cname = cname.substring(idx + 1); - } - String name = cname + "_" + f.getName(); - out.println(name + " equ " + value); - } - } - } - out.println(); - } else { - - out.println("; VmClass: " + cn.getClassName()); - VmType vmClass = cl.loadClass(cn.getClassName(), true); - vmClass.link(); - String cname = vmClass.getName().replace('/', '.'); - int idx = cname.lastIndexOf('.'); - if (idx > 0) { - cname = cname.substring(idx + 1); - } - int cnt = vmClass.getNoDeclaredFields(); - for (int i = 0; i < cnt; i++) { - final VmField f = vmClass.getDeclaredField(i); - if (!f.isStatic()) { - final VmInstanceField instF = (VmInstanceField) f; - String name = cname + "_" + f.getName().toUpperCase(); - if (f.getTypeSize() < 4) { - name = name + "_S" + f.getTypeSize(); - } - name = name + "_OFS"; - out.println(name + " equ " + instF.getOffset()); - } - } - // The size - if (vmClass instanceof VmNormalClass) { - final VmNormalClass cls = (VmNormalClass) vmClass; - out.println(cname + "_SIZE equ " + cls.getObjectSize()); - } - // - out.println(); - } - } - - out.flush(); - fw.flush(); - out.close(); - fw.close(); - destFile.setLastModified(lastModified); - } - - public void addClass(ClassName cn) { - classes.add(cn); - } - - /** - * Returns the destFile. - * - * @return File - */ - public File getDestFile() { - return destFile; - } - - /** - * Sets the destFile. - * - * @param destFile The destFile to set - */ - public void setDestFile(File destFile) { - this.destFile = destFile; - } - - public static class ClassName { - private String className; - private boolean _static = false; - - public ClassName() { - } - - /** - * Returns the className. - * - * @return String - */ - public String getClassName() { - return className; - } - - /** - * Sets the className. - * - * @param className The className to set - */ - public void setClassName(String className) { - this.className = className; - } - - /** - * Returns the _static. - * - * @return boolean - */ - public boolean isStatic() { - return _static; - } - - /** - * Sets the _static. - * - * @param _static The _static to set - */ - public void setStatic(boolean _static) { - this._static = _static; - } - - public URL getURL(URL root) throws MalformedURLException { - return new URL(root.toExternalForm() + "/" + className.replace('.', '/') + ".class"); - } - } - - /** - * Returns the classesURL. - * - * @return URL - */ - public URL getClassesURL() { - return classesURL; - } - - /** - * Sets the classesURL. - * - * @param classesURL The classesURL to set - */ - public void setClassesURL(URL classesURL) { - this.classesURL = classesURL; - } - - protected abstract VmArchitecture getArchitecture(); -} Deleted: classlib6/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java =================================================================== --- classlib6/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2009-04-11 11:08:25 UTC (rev 5244) +++ classlib6/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2009-04-11 13:57:39 UTC (rev 5245) @@ -1,1685 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003-2009 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.jnode.build; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.lang.reflect.Field; -import java.net.URL; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.TreeMap; -import java.util.TreeSet; - -import org.apache.tools.ant.Project; -import org.jnode.assembler.Label; -import org.jnode.assembler.NativeStream; -import org.jnode.assembler.UnresolvedObjectRefException; -import org.jnode.assembler.NativeStream.ObjectRef; -import org.jnode.assembler.x86.X86BinaryAssembler; -import org.jnode.plugin.PluginDescriptor; -import org.jnode.plugin.PluginException; -import org.jnode.plugin.PluginRegistry; -import org.jnode.plugin.model.Factory; -import org.jnode.plugin.model.PluginDescriptorModel; -import org.jnode.plugin.model.PluginJar; -import org.jnode.plugin.model.PluginRegistryModel; -import org.jnode.util.BootableHashMap; -import org.jnode.util.NumberUtils; -import org.jnode.vm.JvmType; -import org.jnode.vm.Unsafe; -import org.jnode.vm.VirtualMemoryRegion; -import org.jnode.vm.Vm; -import org.jnode.vm.VmArchitecture; -import org.jnode.vm.VmSystemClassLoader; -import org.jnode.vm.VmSystemObject; -import org.jnode.vm.bytecode.BytecodeParser; -import org.jnode.vm.classmgr.Modifier; -import org.jnode.vm.classmgr.ObjectLayout; -import org.jnode.vm.classmgr.VmArray; -import org.jnode.vm.classmgr.VmArrayClass; -import org.jnode.vm.classmgr.VmClassType; -import org.jnode.vm.classmgr.VmCompiledCode; -import org.jnode.vm.classmgr.VmField; -import org.jnode.vm.classmgr.VmIsolatedStatics; -import org.jnode.vm.classmgr.VmMethodCode; -import org.jnode.vm.classmgr.VmNormalClass; -import org.jnode.vm.classmgr.VmSharedStatics; -import org.jnode.vm.classmgr.VmStaticField; -import org.jnode.vm.classmgr.VmStatics; -import org.jnode.vm.classmgr.VmType; -import org.jnode.vm.compiler.NativeCodeCompiler; -import org.jnode.vm.memmgr.HeapHelper; -import org.jnode.vm.memmgr.VmHeapManager; -import org.jnode.vm.scheduler.VmProcessor; -import org.vmmagic.unboxed.UnboxedObject; - -/** - * Build the boot image from an assembler compiled bootstrap (in ELF format) - * combined with the precompiled Java classes. - */ -public abstract class AbstractBootImageBuilder extends AbstractPluginsTask { - - protected static final Label bootHeapEnd = new Label("$$bootHeapEnd"); - - protected static final Label bootHeapStart = new Label("$$bootHeapStart"); - - /** - * System property set to indicate build time. - */ - public static final String BUILDTIME_PROPERTY = "org.jnode.buildtime"; - - protected static final Label imageEnd = new Label("$$image_end"); - - protected static final Label initialStack = new Label("$$initialStack"); - - protected static final Label initialStackPtr = new Label( - "$$initialStackPtr"); - - private static final String zero8 = "00000000"; - - private static final String zero16 = zero8 + zero8; - - /** - * Set of jbects that should not yet be emitted. - */ - private final Set<Object> blockedObjects = new HashSet<Object>(); - - private VmSystemClassLoader clsMgr; - - /** - * Classname/packagename of those classes/packages that need highly - * optimized compilation. - */ - private final HashSet<String> compileHighOptLevelPackages = new HashSet<String>(); - - private final HashSet<String> preloadPackages = new HashSet<String>(); - - protected boolean debug = true; - - private File debugFile; - - private File destFile; - - private String jnodeCompiler; - - private File kernelFile; - - private Set<String> legalInstanceClasses; - - private File listFile; - - private int totalHighMethods; - - private int totalHighMethodSize; - - private int totalLowMethods; - - private int totalLowMethodSize; - - private String version; - - /** - * Plugin id of the memory manager plugin. - */ - private String memMgrPluginId; - - /** - * Nano-kernel source information. - */ - private final AsmSourceInfo asmSourceInfo; - - /** - * Enable the compilation of the nano-kernel source via jnasm. - */ - private boolean enableJNasm = false; - - /** - * Construct a new BootImageBuilder. - */ - public AbstractBootImageBuilder() { - asmSourceInfo = new AsmSourceInfo(); - legalInstanceClasses = setupLegalInstanceClasses(); - } - - /** - * Create the kernel-sources element. - * - * @return - */ - public AsmSourceInfo createNanokernelsources() { - return asmSourceInfo; - } - - protected final void addCompileHighOptLevel(String name) { - compileHighOptLevelPackages.add(name); - } - - protected final void addPreloadPackage(String name) { - preloadPackages.add(name); - } - - protected void cleanup() { - clsMgr = null; - blockedObjects.clear(); - } - - /** - * Compile the methods in the given class to native code. - * - * @param os - * @throws ClassNotFoundException - */ - private final void compileClasses(NativeStream os, VmArchitecture arch) - throws ClassNotFoundException { - final NativeCodeCompiler[] compilers = arch.getCompilers(); - final int optLevel = compilers.length - 1; - // Use the most optimizing compiler here - final NativeCodeCompiler compiler = compilers[optLevel]; - - int oldCount; - int newCount; - boolean again; - do { - again = false; - oldCount = clsMgr.getLoadedClassCount(); - for (VmType<?> vmClass : clsMgr.getLoadedClasses()) { - vmClass.link(); - final boolean compHigh = isCompileHighOptLevel(vmClass); - try { - if (!vmClass.isCpRefsResolved() && compHigh) { - // log("Resolving CP of " + vmClass.getName(), - // Project.MSG_VERBOSE); - vmClass.resolveCpRefs(/*clsMgr*/); - again = true; - } - final int mcnt; - final int startLength = os.getLength(); - if (compHigh) { - log("Full Compile " + vmClass.getName(), - Project.MSG_VERBOSE); - mcnt = vmClass.compileBootstrap(compiler, os, optLevel); - totalHighMethods += mcnt; - totalHighMethodSize += (os.getLength() - startLength); - } else { - log("Min. Compile " + vmClass.getName(), - Project.MSG_VERBOSE); - mcnt = vmClass.compileBootstrap(compilers[0], os, 0); - totalLowMethods += mcnt; - totalLowMethodSize += (os.getLength() - startLength); - } - again |= (mcnt > 0); - } catch (Throwable ex) { - throw new BuildException("Compile of " + vmClass.getName() - + " failed", ex); - } - if (!vmClass.isCompiled()) { - throw new BuildException( - "Class should have been compiled by now"); - } - - } - newCount = clsMgr.getLoadedClassCount(); - if (false) { - log("oldCount " + oldCount + ", newCount " + newCount, - Project.MSG_INFO); - } - } while ((oldCount != newCount) || again); - log("End of compileClasses", Project.MSG_VERBOSE); - } - - /** - * Copy the jnode.jar file into a byte array that is added to the java - * image. - * - * @param blockedObjects - * @return The loaded resource names - * @throws BuildException - */ - protected final Collection<String> copyJarFile(Set<Object> blockedObjects, PluginRegistryModel piRegistry) - throws BuildException { - - final BootableHashMap<String, byte[]> resources = new BootableHashMap<String, byte[]>(); -// try { -// final JarFile jar = new JarFile(jarFile); -// for (Enumeration< ? > e = jar.entries(); e.hasMoreElements();) { -// final JarEntry entry = (JarEntry) e.nextElement(); -// final byte[] data = read(jar.getInputStream(entry)); -// resources.put(entry.getName().intern(), data); -// } -// } catch (IOException ex) { -// throw new BuildException(ex); -// } - - // Load all resources of all plugins - for (PluginDescriptor descr : piRegistry) { - if (!descr.isSystemPlugin()) { - throw new BuildException("Non system plugin found " + descr.getId()); - } - final PluginJar piJar = ((PluginDescriptorModel) descr).getJarFile(); - log("Plugin: " + descr.getId() + piJar.resourceNames().size()); - for (String name : piJar.resourceNames()) { - final ByteBuffer buf = piJar.getResourceAsBuffer(name); - final byte[] data = new byte[buf.limit()]; - buf.get(data); - resources.put(name.intern(), data); -// log(" " + name); - } - piJar.clearResources(); - } - - blockedObjects.add(resources); - clsMgr.setSystemRtJar(resources); - - return Collections.unmodifiableCollection(resources.keySet()); - } - - /** - * Copy the jnode.jar file into a byte array that is added to the java - * image. - * - * @param blockedObjects - * @return The loaded resource names - * @throws BuildException - */ - protected final Map<String, byte[]> loadSystemResource(PluginRegistryModel piRegistry) - throws BuildException { - - final BootableHashMap<String, byte[]> resources = new BootableHashMap<String, byte[]>(); - - // Load all resources of all plugins - for (PluginDescriptor descr : piRegistry) { - if (!descr.isSystemPlugin()) { - throw new BuildException("Non system plugin found " + descr.getId()); - } - final PluginJar piJar = ((PluginDescriptorModel) descr).getJarFile(); -// log("Plugin: " + descr.getId() + piJar.resourceNames().size()); - for (String name : piJar.resourceNames()) { - final ByteBuffer buf = piJar.getResourceAsBuffer(name); - final byte[] data = new byte[buf.limit()]; - buf.get(data); - resources.put(name.intern(), data); -// log(" " + name); - } - piJar.clearResources(); - } - return resources; - } - - /** - * Copy the kernel native code into the native stream. - * - * @param os - * @throws BuildException - */ - protected abstract void copyKernel(NativeStream os) throws BuildException; - - /** - * Compile the kernel native code into the native stream. - * - * @param os - * @throws BuildException - */ - protected void compileKernel(NativeStream os, AsmSourceInfo sourceInfo) throws BuildException { - // TODO be implemented by Levente - throw new BuildException("Not implemented"); - } - - /** - * Create the initial stack space. - * - * @param os - * @param stackLabel Label to the start of the stack space (low address) - * @param stackPtrLabel Label to the initial stack pointer (on x86 high address) - * @throws BuildException - * @throws ClassNotFoundException - * @throws UnresolvedObjectRefException - */ - protected abstract void createInitialStack(NativeStream os, - Label stackLabel, Label stackPtrLabel) throws BuildException, - ClassNotFoundException, UnresolvedObjectRefException; - - /** - * Create a platform specific native stream. - * - * @return NativeStream - */ - protected abstract NativeStream createNativeStream(); - - /** - * Create the default processor for this architecture. - * - * @return The processor - * @throws BuildException - */ - protected abstract VmProcessor createProcessor(Vm vm, VmSharedStatics statics, - VmIsolatedStatics isolatedStatics) throws BuildException; - - private final void doExecute() throws BuildException { - setupCompileHighOptLevelPackages(); - - debug = (getProject().getProperty("jnode.debug") != null); - - final long lmKernel = kernelFile.lastModified(); - final long lmDest = destFile.lastModified(); - final long lmPIL = getPluginListFile().lastModified(); - - if (version == null) { - throw new BuildException("Version property must be set"); - } - if (memMgrPluginId == null) { - throw new BuildException("Memory manager plugin Id must be set"); - } - - final PluginList piList; - final long lmPI; - final URL memMgrPluginURL; - try { - log("plugin-list: " + getPluginListFile(), Project.MSG_DEBUG); - piList = getPluginList(); - memMgrPluginURL = piList.createPluginURL(memMgrPluginId, version); - lmPI = Math.max(piList.lastModified(), memMgrPluginURL.openConnection().getLastModified()); - } catch (PluginException ex) { - throw new BuildException(ex); - } catch (IOException ex) { - throw new BuildException(ex); - } - - if ((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 PluginRegistryModel piRegistry; - piRegistry = Factory.createRegistry(piList.getPluginList()); - - // Load the memory management plugin - piRegistry.loadPlugin(memMgrPluginURL, true); - - // Test the set of system plugins - testPluginPrerequisites(piRegistry); - - // Load all resources - final Map<String, byte[]> resources = loadSystemResource(piRegistry); - - /* Now create the processor */ - final VmArchitecture arch = getArchitecture(); - final NativeStream os = createNativeStream(); - clsMgr = new VmSystemClassLoader(null/*classesURL*/, arch, - new BuildObjectResolver(os, this)); - blockedObjects.add(clsMgr); - blockedObjects.add(clsMgr.getSharedStatics()); - blockedObjects.add(clsMgr.getSharedStatics().getTable()); - blockedObjects.add(clsMgr.getIsolatedStatics()); - blockedObjects.add(clsMgr.getIsolatedStatics().getTable()); - blockedObjects.add(resources); - clsMgr.setSystemRtJar(resources); - - // Initialize the statics table. - initializeStatics(clsMgr.getSharedStatics()); - - if (debug) { - log("Building in DEBUG mode", Project.MSG_WARN); - } - - // Create the VM - final Vm vm = new Vm(version, arch, clsMgr.getSharedStatics(), debug, clsMgr, piRegistry); - blockedObjects.add(vm); - blockedObjects.add(Vm.getCompiledMethods()); - - final VmProcessor proc = createProcessor(vm, clsMgr.getSharedStatics(), - clsMgr.getIsolatedStatics()); - 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 - if (enableJNasm) { - compileKernel(os, asmSourceInfo); - } else { - 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(VirtualMemoryRegion.class).link(); - Vm.getHeapManager().loadClasses(clsMgr); - loadClass(VmHeapManager.class); - loadClass(VmSharedStatics.class); - loadClass(VmIsolatedStatics.class); - loadClass(Vm.getHeapManager().getClass()); - loadClass(HeapHelper.class); - loadClass("org.jnode.vm.HeapHelperImpl"); - loadClass(Vm.getCompiledMethods().getClass()); - loadClass(VmCompiledCode[].class); - loadSystemClasses(resources.keySet()); - - /* 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); - } - /* Let the test compilers load its native symbol offsets */ - final NativeCodeCompiler[] testCmps = arch.getTestCompilers(); - if (testCmps != null) { - for (int i = 0; i < testCmps.length; i++) { - final NativeCodeCompiler cmp = testCmps[i]; - cmp.initialize(clsMgr); - os.getObjectRef(cmp); - } - } - log("Compiling using " + cmps[0].getName() + " and " - + cmps[cmps.length - 1].getName() + " compilers"); - // Initialize the IMT compiler. - arch.getIMTCompiler().initialize(clsMgr); - - // Load the jarfile as byte-array -// copyJarFile(blockedObjects, piRegistry); - - // Now emit all object images to the actual image - emitObjects(os, arch, blockedObjects, false); - - // Disallow the loading of new classes - clsMgr.setFailOnNewLoad(true); - emitObjects(os, arch, blockedObjects, false); - - // Emit the vm - log("Emit vm", Project.MSG_VERBOSE); - blockedObjects.remove(vm); - emitObjects(os, arch, blockedObjects, false); - // Twice, this is intended! - emitObjects(os, arch, blockedObjects, false); - - // Emit the compiled method list - log("Emit compiled methods", Project.MSG_VERBOSE); - blockedObjects.remove(Vm.getCompiledMethods()); - final int compiledMethods = Vm.getCompiledMethods().size(); - emitObjects(os, arch, blockedObjects, false); - // Twice, this is intended! - emitObjects(os, arch, blockedObjects, false); - - /* Set the bootclasses */ - log("prepare bootClassArray", Project.MSG_VERBOSE); - final VmType bootClasses[] = clsMgr.prepareAfterBootstrap(); - os.getObjectRef(bootClasses); - emitObjects(os, arch, blockedObjects, false); - // Twice, this is intended! - emitObjects(os, arch, blockedObjects, false); - - // Emit the classmanager - log("Emit clsMgr", Project.MSG_VERBOSE); - // Turn auto-compilation on - clsMgr.setCompileRequired(); - blockedObjects.remove(clsMgr); - emitObjects(os, arch, blockedObjects, false); - // Twice, this is intended! - emitObjects(os, arch, blockedObjects, false); - - // Emit the statics table - log("Emit statics", Project.MSG_VERBOSE); - blockedObjects.remove(clsMgr.getSharedStatics()); - blockedObjects.remove(clsMgr.getIsolatedStatics()); - emitObjects(os, arch, blockedObjects, true); - // Twice, this is intended! - emitObjects(os, arch, blockedObjects, true); - - // Emit the remaining objects - log("Emit rest; blocked=" + blockedObjects, Project.MSG_VERBOSE); - emitObjects(os, arch, null, true); - - // Verify no methods have been compiled after we wrote the - // CompiledCodeList. - if (Vm.getCompiledMethods().size() != compiledMethods) { - throw new BuildException( - "Method have been compiled after CompiledCodeList was written."); - } - - /* Write static initializer code */ - emitStaticInitializerCalls(os, bootClasses, clInitCaller); - - // This is the end of the image - X86BinaryAssembler.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.getSharedStatics()); - logLargeClasses(bootClasses); - - // 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"); - log("Shared statics"); - PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); - clsMgr.getSharedStatics().dumpStatistics(out); - log("Isolated statics"); - clsMgr.getIsolatedStatics().dumpStatistics(out); - vm.dumpStatistics(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); - } - - } - - /** - * Emit all objects to the native stream that have not yet been emitted to - * this stream. - * - * @param os - * @param arch - * @param blockObjects - * @throws BuildException - */ - private final void emitObjects(NativeStream os, VmArchitecture arch, - Set<Object> blockObjects, boolean skipCopyStatics) - throws BuildException { - log("Emitting objects", Project.MSG_DEBUG); - PrintWriter debugOut = null; - final TreeSet<String> emittedClassNames = new TreeSet<String>(); - try { - if (debug) { - debugOut = new PrintWriter(new FileWriter(debugFile, true)); - } - final ObjectEmitter emitter = new ObjectEmitter(clsMgr, os, - debugOut, legalInstanceClasses); - final long start = System.currentTimeMillis(); - int cnt = 0; - int lastUnresolved = -1; - int loops = 0; - while (true) { - loops++; - compileClasses(os, arch); - if (!skipCopyStatics) { - copyStaticFields(clsMgr, clsMgr.getSharedStatics(), clsMgr - .getIsolatedStatics(), os, emitter); - } - final Collection<ObjectRef> objectRefs = new ArrayList<ObjectRef>( - os.getObjectRefs()); - int unresolvedFound = 0; // Number of unresolved references - // found in the following - // loop - int emitted = 0; // Number of emitted objects in the - // following - // loop - for (Iterator<ObjectRef> i = objectRefs.iterator(); i.hasNext();) { - X86BinaryAssembler.ObjectRef ref = i - .next(); - if (!ref.isResolved()) { - final Object obj = ref.getObject(); - if (!(obj instanceof Label)) { - unresolvedFound++; - if (obj instanceof VmType) { - final VmType<?> vmtObj = (VmType) obj; - vmtObj.link(); - if (!vmtObj.isCompiled()) { - compileClasses(os, arch); - } - } - - boolean skip; - if (blockObjects == null) { - skip = false; - } else { - skip = blockObjects.contains(obj); - } - /* - * if (obj instanceof VmMethod) { final VmMethod - * mObj = (VmMethod)obj; if (!mObj.hasNativeCode()) { - * compileClasses(os, arch); } if - * (!mObj.getDeclaringClass().isCompiled()) { - * log("Oops"); } - */ - - if (!skip) { - if (blockObjects == null) { - emittedClassNames.add(obj.getClass() - .getName()); - // log("emitObject " + - // obj.getClass().getName()); - } - // if (obj != skipMe) { - emitter.emitObject(obj); - emitted++; - X86BinaryAssembler.ObjectRef newRef = os - .getObjectRef(obj); - if (ref != newRef) { - throw new RuntimeException( - "Object has changed during emitObject! type=" - + obj.getClass().getName()); - } - if (!ref.isResolved()) { - throw new RuntimeException("Unresolved reference to object " + ((obj == null) ? - "null" : obj.getClass() .getName())); - } - } - } - } - } - if (unresolvedFound == lastUnresolved) { - if (unresolvedFound == 0) { - break; - } - if (blockedObjects != null) { - if (unresolvedFound == (emitted + blockObjects.size())) { - // log("UnresolvedFound " + unresolvedFound + ", - // emitted " + emitted + ",blocked " + - // blockObjects.size()); - break; - } - if ((emitted == 0) && !blockObjects.isEmpty()) { - break; - } - } - } - lastUnresolved = unresolvedFound; - cnt += emitted; - } - final long end = System.currentTimeMillis(); - log("Emitted " + cnt + " objects, took " + (end - start) + "ms in " - + loops + " loops"); - if (debugOut != null) { - debugOut.close(); - debugOut = null; - } - if (blockObjects == null) { - log("Emitted classes: " + emittedClassNames, Project.MSG_INFO); - } - } catch (ClassNotFoundException ex) { - throw new BuildException(ex); - } catch (IOException ex) { - throw new BuildException(ex); - } - } - - protected abstract void emitStaticInitializerCalls(NativeStream os, - VmType[] bootClasses, Object clInitCaller) - throws ClassNotFoundException; - - public final void execute() throws BuildException { - // Create the image - doExecute(); - // Remove all garbage objects - cleanup(); - System.gc(); - // Make sure that all finalizers are called, in order to remove tmp - // files. - Runtime.getRuntime().runFinalization(); - } - - /** - * Gets the target architecture. - * - * @return The target architecture - * @throws BuildException - */ - protected abstract VmArchitecture getArchitecture() throws BuildException; - - /** - * Gets the internal class loader. - * - * @return The class loader - */ - public VmSystemClassLoader getClsMgr() { - return clsMgr; - } - - /** - * Returns the debugFile. - * - * @return File - */ - public final File getDebugFile() { - return debugFile; - } - - /** - * Returns the destFile. - * - * @return File - */ - public final File getDestFile() { - return destFile; - } - - /** - * @return Returns the jnodeCompiler. - */ - public final String getJnodeCompiler() { - return jnodeCompiler; - } - - /** - * Returns the kernelFile. - * - * @return File - */ - public final File getKernelFile() { - return kernelFile; - } - - /** - * Returns the listFile. - * - * @return File - */ - public final File getListFile() { - return listFile; - } - - /** - * @return Returns the version. - */ - public final String getVersion() { - return this.version; - } - - /** - * Convert a given int to an hexidecimal representation of 8 characters - * long. - * - * @param v - * @return The hex string - */ - protected final String hex(int v) { - String s = Integer.toHexString(v); - return zero8.substring(s.length()) + s; - } - - /** - * Convert a given int to an hexidecimal representation of 16 characters - * long. - * - * @param v - * @return The hex string - */ - protected final String hex(long v) { - String s = Long.toHexString(v); - return zero16.substring(s.length()) + s; - } - - /** - * Emit code to bootstrap the java image. - * - * @param os - * @param clInitCaller - * @param vm - * @param pluginRegistry - * @throws BuildException - */ - protected abstract void initImageHeader(NativeStream os, - Label ... [truncated message content] |