You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(97) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(127) |
Feb
(34) |
Mar
(16) |
Apr
(26) |
May
(55) |
Jun
(107) |
Jul
(36) |
Aug
(72) |
Sep
(90) |
Oct
(41) |
Nov
(27) |
Dec
(13) |
2008 |
Jan
(37) |
Feb
(39) |
Mar
(98) |
Apr
(115) |
May
(134) |
Jun
(120) |
Jul
(86) |
Aug
(149) |
Sep
(68) |
Oct
(66) |
Nov
(104) |
Dec
(49) |
2009 |
Jan
(131) |
Feb
(132) |
Mar
(125) |
Apr
(172) |
May
(161) |
Jun
(43) |
Jul
(47) |
Aug
(38) |
Sep
(18) |
Oct
(6) |
Nov
(1) |
Dec
(15) |
2010 |
Jan
(21) |
Feb
(8) |
Mar
(10) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(4) |
2011 |
Jan
(23) |
Feb
(10) |
Mar
(13) |
Apr
(3) |
May
|
Jun
(19) |
Jul
(11) |
Aug
(22) |
Sep
|
Oct
(4) |
Nov
(2) |
Dec
(12) |
2012 |
Jan
(3) |
Feb
(4) |
Mar
(7) |
Apr
(3) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(30) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(8) |
2013 |
Jan
(3) |
Feb
(40) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(12) |
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: <fd...@us...> - 2010-05-16 16:50:14
|
Revision: 5751 http://jnode.svn.sourceforge.net/jnode/?rev=5751&view=rev Author: fduminy Date: 2010-05-16 16:50:07 +0000 (Sun, 16 May 2010) Log Message: ----------- - removed dependency cycle between org.jnode.naming and org.jnode.vm by moving DefaultNameSpace to org.jnode.vm - BootLogInstance is now using InitialNaming to store the instance Signed-off-by: Fabien DUMINY <fab...@we...> Modified Paths: -------------- trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java trunk/core/src/core/org/jnode/bootlog/BootLogInstance.java trunk/core/src/core/org/jnode/naming/InitialNaming.java trunk/core/src/core/org/jnode/vm/BootLogImpl.java trunk/core/src/core/org/jnode/vm/VmSystem.java trunk/core/src/emu/org/jnode/emu/naming/BasicNameSpace.java trunk/fs/src/test/org/jnode/test/fs/driver/stubs/StubNameSpace.java Added Paths: ----------- trunk/core/src/core/org/jnode/vm/DefaultNameSpace.java Removed Paths: ------------- trunk/core/src/core/org/jnode/naming/DefaultNameSpace.java Modified: trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java =================================================================== --- trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2010-05-16 16:48:59 UTC (rev 5750) +++ trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2010-05-16 16:50:07 UTC (rev 5751) @@ -50,6 +50,8 @@ import org.jnode.assembler.x86.X86BinaryAssembler; import org.jnode.bootlog.BootLog; import org.jnode.bootlog.BootLogInstance; +import org.jnode.emu.naming.BasicNameSpace; +import org.jnode.naming.InitialNaming; import org.jnode.plugin.PluginDescriptor; import org.jnode.plugin.PluginException; import org.jnode.plugin.PluginRegistry; @@ -795,7 +797,8 @@ public final void execute() throws BuildException { try { - BootLogInstance.set(new BootLog() { + InitialNaming.setNameSpace(new BasicNameSpace()); + BootLogInstance.set(new BootLog() { @Override public void warn(String msg) { System.out.println(msg); Modified: trunk/core/src/core/org/jnode/bootlog/BootLogInstance.java =================================================================== --- trunk/core/src/core/org/jnode/bootlog/BootLogInstance.java 2010-05-16 16:48:59 UTC (rev 5750) +++ trunk/core/src/core/org/jnode/bootlog/BootLogInstance.java 2010-05-16 16:50:07 UTC (rev 5751) @@ -1,19 +1,19 @@ package org.jnode.bootlog; +import javax.naming.NameAlreadyBoundException; +import javax.naming.NameNotFoundException; +import javax.naming.NamingException; +import org.jnode.naming.InitialNaming; + + /** - * Class holding the {@link BootLog} instance used by the system. - * <br/><h1>Implementation note :</h1> The reference to the actual instance of - * the BootLog can't be stored in the InitialNaming that use VmType, which is - * not fully initialized at build time (but BootLog is used). So, we are always - * holding the reference in that class. + * Class holding the {@link BootLog} instance used by the system. * * @author Fabien DUMINY * */ public final class BootLogInstance { - private static BootLog BOOT_LOG_INSTANCE; - private BootLogInstance () { } @@ -22,14 +22,20 @@ * @return the system's {@link BootLog}. */ public static BootLog get() { - return BOOT_LOG_INSTANCE; + try { + return InitialNaming.lookup(BootLog.class); + } catch (NameNotFoundException e) { + throw new Error("unable to find a BootLog instance", e); + } } /** * Set the system's {@link BootLog}. * @param bootLog the system's {@link BootLog}. + * @throws NamingException + * @throws NameAlreadyBoundException */ - public static void set(BootLog bootLog) { - BOOT_LOG_INSTANCE = bootLog; + public static void set(BootLog bootLog) throws NameAlreadyBoundException, NamingException { + InitialNaming.bind(BootLog.class, bootLog); } } Deleted: trunk/core/src/core/org/jnode/naming/DefaultNameSpace.java =================================================================== --- trunk/core/src/core/org/jnode/naming/DefaultNameSpace.java 2010-05-16 16:48:59 UTC (rev 5750) +++ trunk/core/src/core/org/jnode/naming/DefaultNameSpace.java 2010-05-16 16:50:07 UTC (rev 5751) @@ -1,118 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003-2010 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.naming; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import javax.naming.NameAlreadyBoundException; -import javax.naming.NameNotFoundException; -import javax.naming.NamingException; - -import org.jnode.annotation.PrivilegedActionPragma; -import org.jnode.vm.classmgr.VmType; - -public class DefaultNameSpace extends AbstractNameSpace { - - /** - * All bound names+services - */ - protected final Map<VmType<?>, Object> namespace = new HashMap<VmType<?>, Object>(); - - /** - * Bind a given service in the namespace under a given name. - * - * @param name - * @param service - * @throws NameAlreadyBoundException if the name already exists within this namespace - */ - @PrivilegedActionPragma - public <T> void bind(Class<T> name, T service) throws NamingException, - NameAlreadyBoundException { - if (name == null) { - throw new IllegalArgumentException("name == null"); - } - synchronized (namespace) { - if (namespace.containsKey(VmType.fromClass(name))) { - throw new NameAlreadyBoundException(name.getName()); - } - namespace.put(VmType.fromClass(name), service); - } - - // notify listeners - fireServiceBound(name, service); - } - - /** - * Unbind a service with a given name from the namespace. If the name does - * not exist in this namespace, this method returns without an error. - * - * @param name - */ - @PrivilegedActionPragma - public void unbind(Class<?> name) { - final Object service; - synchronized (namespace) { - service = namespace.remove(VmType.fromClass((Class<?>) name)); - } - - // notify listeners - fireServiceUnbound(name, service); - } - - /** - * Lookup a service with a given name. - * - * @param name - * @throws NameNotFoundException if the name was not found in this namespace - */ - @PrivilegedActionPragma - public <T> T lookup(Class<T> name) throws NameNotFoundException { - final Object result = namespace.get(VmType.fromClass(name)); - if (result == null) { -// if (!VmIsolate.isRoot()) { -// System.out.println("Looking for " + name.getVmClass().hashCode()); -// for (VmType<?> type : namespace.keySet()) { -// System.out.println(" found " + type.hashCode() + " " + (type == name.getVmClass())); -// } -// } - throw new NameNotFoundException(name.getName()); - } - return name.cast(result); - } - - /** - * Gets a set containing all names (Class) of the bound services. - */ - public Set<Class<?>> nameSet() { - final HashSet<VmType<?>> types; - synchronized (namespace) { - types = new HashSet<VmType<?>>(namespace.keySet()); - } - final Set<Class<?>> result = new HashSet<Class<?>>(types.size()); - for (VmType<?> type : types) { - result.add(type.asClass()); - } - return result; - } -} Modified: trunk/core/src/core/org/jnode/naming/InitialNaming.java =================================================================== --- trunk/core/src/core/org/jnode/naming/InitialNaming.java 2010-05-16 16:48:59 UTC (rev 5750) +++ trunk/core/src/core/org/jnode/naming/InitialNaming.java 2010-05-16 16:50:07 UTC (rev 5751) @@ -45,7 +45,7 @@ /** * All bound names+services */ - private static NameSpace namespace; + private static NameSpace NAME_SPACE; /** * Add a {@link NameSpaceListener} to the NameSpace @@ -54,7 +54,7 @@ * @param l */ public static <T> void addNameSpaceListener(Class<T> name, NameSpaceListener<T> l) { - getNameSpace().addNameSpaceListener(name, l); + NAME_SPACE.addNameSpaceListener(name, l); } /** @@ -64,7 +64,7 @@ * @param l */ public static <T> void removeNameSpaceListener(Class<T> name, NameSpaceListener<T> l) { - getNameSpace().removeNameSpaceListener(name, l); + NAME_SPACE.removeNameSpaceListener(name, l); } /** @@ -73,11 +73,11 @@ * @param namespace */ public static void setNameSpace(NameSpace namespace) { - if (InitialNaming.namespace != null) { + if (NAME_SPACE != null) { throw new SecurityException( "namespace can't be modified after first initialization"); } - InitialNaming.namespace = namespace; + NAME_SPACE = namespace; } /** @@ -89,7 +89,7 @@ */ public static <T, E extends T> void bind(Class<T> name, E service) throws NamingException, NameAlreadyBoundException { - getNameSpace().bind(name, service); + NAME_SPACE.bind(name, service); } /** @@ -99,7 +99,7 @@ * @param name */ public static void unbind(Class<?> name) { - getNameSpace().unbind(name); + NAME_SPACE.unbind(name); } /** @@ -109,25 +109,13 @@ * @throws NameNotFoundException if the name was not found in this namespace */ public static <T> T lookup(Class<T> name) throws NameNotFoundException { - return getNameSpace().lookup(name); + return NAME_SPACE.lookup(name); } /** * Gets a set containing all names (Class) of the bound services. */ public static Set<Class<?>> nameSet() { - return getNameSpace().nameSet(); + return NAME_SPACE.nameSet(); } - - /** - * Get the actual {@link NameSpace} and use a default one - * if none was yet defined. - * @return - */ - private static NameSpace getNameSpace() { - if (namespace == null) { - namespace = new DefaultNameSpace(); - } - return namespace; - } } Modified: trunk/core/src/core/org/jnode/vm/BootLogImpl.java =================================================================== --- trunk/core/src/core/org/jnode/vm/BootLogImpl.java 2010-05-16 16:48:59 UTC (rev 5750) +++ trunk/core/src/core/org/jnode/vm/BootLogImpl.java 2010-05-16 16:50:07 UTC (rev 5751) @@ -22,6 +22,9 @@ import java.io.PrintStream; +import javax.naming.NameAlreadyBoundException; +import javax.naming.NamingException; + import org.jnode.bootlog.BootLog; import org.jnode.bootlog.BootLogInstance; @@ -148,6 +151,14 @@ static void initialize() { Unsafe.debug("Initialize BootLog\n"); - BootLogInstance.set(new BootLogImpl()); + try { + BootLogInstance.set(new BootLogImpl()); + } catch (NameAlreadyBoundException e) { + Unsafe.debug(e.toString()); + Unsafe.debug("\n"); + } catch (NamingException e) { + Unsafe.debug(e.toString()); + Unsafe.debug("\n"); + } } } Copied: trunk/core/src/core/org/jnode/vm/DefaultNameSpace.java (from rev 5750, trunk/core/src/core/org/jnode/naming/DefaultNameSpace.java) =================================================================== --- trunk/core/src/core/org/jnode/vm/DefaultNameSpace.java (rev 0) +++ trunk/core/src/core/org/jnode/vm/DefaultNameSpace.java 2010-05-16 16:50:07 UTC (rev 5751) @@ -0,0 +1,119 @@ +/* + * $Id$ + * + * Copyright (C) 2003-2010 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.vm; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import javax.naming.NameAlreadyBoundException; +import javax.naming.NameNotFoundException; +import javax.naming.NamingException; + +import org.jnode.annotation.PrivilegedActionPragma; +import org.jnode.naming.AbstractNameSpace; +import org.jnode.vm.classmgr.VmType; + +class DefaultNameSpace extends AbstractNameSpace { + + /** + * All bound names+services + */ + protected final Map<VmType<?>, Object> namespace = new HashMap<VmType<?>, Object>(); + + /** + * Bind a given service in the namespace under a given name. + * + * @param name + * @param service + * @throws NameAlreadyBoundException if the name already exists within this namespace + */ + @PrivilegedActionPragma + public <T> void bind(Class<T> name, T service) throws NamingException, + NameAlreadyBoundException { + if (name == null) { + throw new IllegalArgumentException("name == null"); + } + synchronized (namespace) { + if (namespace.containsKey(VmType.fromClass(name))) { + throw new NameAlreadyBoundException(name.getName()); + } + namespace.put(VmType.fromClass(name), service); + } + + // notify listeners + fireServiceBound(name, service); + } + + /** + * Unbind a service with a given name from the namespace. If the name does + * not exist in this namespace, this method returns without an error. + * + * @param name + */ + @PrivilegedActionPragma + public void unbind(Class<?> name) { + final Object service; + synchronized (namespace) { + service = namespace.remove(VmType.fromClass((Class<?>) name)); + } + + // notify listeners + fireServiceUnbound(name, service); + } + + /** + * Lookup a service with a given name. + * + * @param name + * @throws NameNotFoundException if the name was not found in this namespace + */ + @PrivilegedActionPragma + public <T> T lookup(Class<T> name) throws NameNotFoundException { + final Object result = namespace.get(VmType.fromClass(name)); + if (result == null) { +// if (!VmIsolate.isRoot()) { +// System.out.println("Looking for " + name.getVmClass().hashCode()); +// for (VmType<?> type : namespace.keySet()) { +// System.out.println(" found " + type.hashCode() + " " + (type == name.getVmClass())); +// } +// } + throw new NameNotFoundException(name.getName()); + } + return name.cast(result); + } + + /** + * Gets a set containing all names (Class) of the bound services. + */ + public Set<Class<?>> nameSet() { + final HashSet<VmType<?>> types; + synchronized (namespace) { + types = new HashSet<VmType<?>>(namespace.keySet()); + } + final Set<Class<?>> result = new HashSet<Class<?>>(types.size()); + for (VmType<?> type : types) { + result.add(type.asClass()); + } + return result; + } +} Modified: trunk/core/src/core/org/jnode/vm/VmSystem.java =================================================================== --- trunk/core/src/core/org/jnode/vm/VmSystem.java 2010-05-16 16:48:59 UTC (rev 5750) +++ trunk/core/src/core/org/jnode/vm/VmSystem.java 2010-05-16 16:50:07 UTC (rev 5751) @@ -119,7 +119,10 @@ */ public static void initialize() { if (!inited) { - // Initialize BootLog + // Initialize Naming + InitialNaming.setNameSpace(new DefaultNameSpace()); + + // Initialize BootLog BootLogImpl.initialize(); // Initialize resource manager Modified: trunk/core/src/emu/org/jnode/emu/naming/BasicNameSpace.java =================================================================== --- trunk/core/src/emu/org/jnode/emu/naming/BasicNameSpace.java 2010-05-16 16:48:59 UTC (rev 5750) +++ trunk/core/src/emu/org/jnode/emu/naming/BasicNameSpace.java 2010-05-16 16:50:07 UTC (rev 5751) @@ -36,7 +36,7 @@ * * @author cr...@jn... */ -public final class BasicNameSpace extends AbstractNameSpace { +public class BasicNameSpace extends AbstractNameSpace { protected final Map<Class<?>, Object> namespace = new HashMap<Class<?>, Object>(); public <T> void bind(Class<T> name, T service) Modified: trunk/fs/src/test/org/jnode/test/fs/driver/stubs/StubNameSpace.java =================================================================== --- trunk/fs/src/test/org/jnode/test/fs/driver/stubs/StubNameSpace.java 2010-05-16 16:48:59 UTC (rev 5750) +++ trunk/fs/src/test/org/jnode/test/fs/driver/stubs/StubNameSpace.java 2010-05-16 16:50:07 UTC (rev 5751) @@ -24,10 +24,10 @@ import javax.naming.NameNotFoundException; import javax.naming.NamingException; import org.apache.log4j.Logger; -import org.jnode.naming.DefaultNameSpace; +import org.jnode.emu.naming.BasicNameSpace; import org.jnode.test.support.MockUtils; -public class StubNameSpace extends DefaultNameSpace { +public class StubNameSpace extends BasicNameSpace { private static final Logger log = Logger.getLogger(StubNameSpace.class); public StubNameSpace() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fd...@us...> - 2010-05-16 16:49:09
|
Revision: 5750 http://jnode.svn.sourceforge.net/jnode/?rev=5750&view=rev Author: fduminy Date: 2010-05-16 16:48:59 +0000 (Sun, 16 May 2010) Log Message: ----------- removed package/plugin dependency cycle org.jnode.vm <-> org.jnode.system by refactoring BootLog : - become an interface in its own plugin and doesn't depend on the (org.jnode.vm.)Unsafe class Signed-off-by: Fabien DUMINY <fab...@we...> Modified Paths: -------------- trunk/all/conf/system-plugin-list.xml trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java trunk/builder/src/builder/org/jnode/build/ObjectEmitter.java trunk/core/src/core/org/jnode/boot/InitJarProcessor.java trunk/core/src/core/org/jnode/boot/Main.java trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java trunk/core/src/core/org/jnode/plugin/Plugin.java trunk/core/src/core/org/jnode/plugin/PluginManager.java trunk/core/src/core/org/jnode/plugin/PluginUtils.java trunk/core/src/core/org/jnode/plugin/manager/DefaultPluginManager.java trunk/core/src/core/org/jnode/plugin/model/FragmentDescriptorModel.java trunk/core/src/core/org/jnode/plugin/model/PluginClassLoaderImpl.java trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java trunk/core/src/core/org/jnode/protocol/ProtocolHandlerFactoryPlugin.java trunk/core/src/core/org/jnode/security/JNodePolicy.java trunk/core/src/core/org/jnode/util/ByteQueueProcessorThread.java trunk/core/src/core/org/jnode/util/QueueProcessorThread.java trunk/core/src/core/org/jnode/vm/MemoryBlockManager.java trunk/core/src/core/org/jnode/vm/VmSystem.java trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java trunk/core/src/core/org/jnode/vm/bytecode/BasicBlockFinder.java trunk/core/src/core/org/jnode/vm/bytecode/DeadBlockFinder.java trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java trunk/core/src/core/org/jnode/vm/classmgr/VmType.java trunk/core/src/core/org/jnode/vm/memmgr/def/FinalizerThread.java trunk/core/src/core/org/jnode/vm/x86/MPConfigTable.java trunk/core/src/core/org/jnode/vm/x86/MPFloatingPointerStructure.java trunk/core/src/core/org/jnode/vm/x86/VmX86Architecture.java trunk/core/src/core/org/jnode/vm/x86/VmX86Processor.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompilerFPU.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1b/FPCompilerFPU.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java trunk/core/src/core/org/jnode/work/WorkUtils.java trunk/core/src/driver/org/jnode/driver/AbstractDeviceManager.java trunk/core/src/driver/org/jnode/driver/DefaultDeviceManager.java trunk/core/src/driver/org/jnode/driver/Device.java trunk/core/src/driver/org/jnode/driver/Driver.java trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java trunk/core/src/driver/org/jnode/driver/console/textscreen/DefaultKeyboardHandler.java trunk/core/src/driver/org/jnode/driver/textscreen/x86/PcTextScreen.java trunk/core/src/mmtk-vm/org/jnode/vm/memmgr/mmtk/BaseMmtkHeapManager.java trunk/core/src/mmtk-vm/org/mmtk/vm/Assert.java trunk/core/src/mmtk-vm/org/mmtk/vm/Options.java trunk/core/src/test/org/jnode/test/framework/TestRunnerPlugin.java trunk/fs/src/driver/org/jnode/driver/block/ide/disk/IDEDiskDriver.java trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660Volume.java trunk/fs/src/fs/org/jnode/fs/iso9660/SupplementaryVolumeDescriptor.java trunk/fs/src/test/org/jnode/test/support/MockObjectFactory.java trunk/net/src/net/org/jnode/net/util/AbstractDatagramSocketImpl.java Added Paths: ----------- trunk/core/descriptors/org.jnode.runtime.core.bootlog.xml trunk/core/src/core/org/jnode/bootlog/ trunk/core/src/core/org/jnode/bootlog/BootLog.java trunk/core/src/core/org/jnode/bootlog/BootLogInstance.java trunk/core/src/core/org/jnode/bootlog/package.html trunk/core/src/core/org/jnode/vm/BootLogImpl.java Removed Paths: ------------- trunk/core/src/core/org/jnode/system/BootLog.java Property Changed: ---------------- trunk/core/src/test/org/jnode/test/framework/TestRunnerPlugin.java Modified: trunk/all/conf/system-plugin-list.xml =================================================================== --- trunk/all/conf/system-plugin-list.xml 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/all/conf/system-plugin-list.xml 2010-05-16 16:48:59 UTC (rev 5750) @@ -13,6 +13,7 @@ <plugin id="org.jnode.runtime"/> <plugin id="org.jnode.runtime.core"/> + <plugin id="org.jnode.runtime.core.bootlog"/> <plugin id="org.jnode.security"/> <plugin id="org.jnode.util"/> <plugin id="org.jnode.vm"/> Modified: trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java =================================================================== --- trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -25,6 +25,7 @@ import java.io.FileWriter; import java.io.IOException; import java.io.OutputStreamWriter; +import java.io.PrintStream; import java.io.PrintWriter; import java.lang.reflect.Field; import java.net.URL; @@ -47,6 +48,8 @@ import org.jnode.assembler.UnresolvedObjectRefException; import org.jnode.assembler.NativeStream.ObjectRef; import org.jnode.assembler.x86.X86BinaryAssembler; +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; import org.jnode.plugin.PluginDescriptor; import org.jnode.plugin.PluginException; import org.jnode.plugin.PluginRegistry; @@ -791,14 +794,84 @@ 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(); + try { + BootLogInstance.set(new BootLog() { + @Override + public void warn(String msg) { + System.out.println(msg); + } + + @Override + public void warn(String msg, Throwable ex) { + System.out.println(msg); + ex.printStackTrace(System.out); + } + + @Override + public void setDebugOut(PrintStream out) { + // ignore + } + + @Override + public void info(String msg, Throwable ex) { + System.out.println(msg); + ex.printStackTrace(System.out); + } + + @Override + public void info(String msg) { + System.out.println(msg); + } + + @Override + public void fatal(String msg, Throwable ex) { + System.out.println(msg); + ex.printStackTrace(System.out); + } + + @Override + public void fatal(String msg) { + System.out.println(msg); + } + + @Override + public void error(String msg, Throwable ex) { + System.out.println(msg); + ex.printStackTrace(System.out); + } + + @Override + public void error(String msg) { + System.out.println(msg); + } + + @Override + public void debug(String msg, Throwable ex) { + System.out.println(msg); + ex.printStackTrace(System.out); + } + + @Override + public void debug(String msg) { + System.out.println(msg); + } + }); + + // 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(); + } catch (BuildException be) { + be.printStackTrace(); + throw be; + } catch (Throwable t) { + t.printStackTrace(); + throw new BuildException(t); + } } /** @@ -1368,6 +1441,7 @@ addCompileHighOptLevel("org.jnode.assembler"); addCompileHighOptLevel("org.jnode.boot"); + addCompileHighOptLevel("org.jnode.bootlog"); addCompileHighOptLevel("org.jnode.naming"); addCompileHighOptLevel("org.jnode.plugin"); addCompileHighOptLevel("org.jnode.plugin.manager"); Modified: trunk/builder/src/builder/org/jnode/build/ObjectEmitter.java =================================================================== --- trunk/builder/src/builder/org/jnode/build/ObjectEmitter.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/builder/src/builder/org/jnode/build/ObjectEmitter.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -26,11 +26,12 @@ import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.Set; + import org.jnode.assembler.BootImageNativeStream; import org.jnode.assembler.Label; import org.jnode.assembler.NativeStream; import org.jnode.assembler.x86.X86BinaryAssembler; -import org.jnode.system.BootLog; +import org.jnode.bootlog.BootLogInstance; import org.jnode.vm.BootableObject; import org.jnode.vm.VmSystemObject; import org.jnode.vm.classmgr.VmArrayClass; @@ -191,7 +192,7 @@ throw new BuildException(ex); } if (!fieldInfo.isExact()) { - BootLog.warn("Use of in-exact matching class (" + clsName + BootLogInstance.get().warn("Use of in-exact matching class (" + clsName + ") in bootimage at " + location); } legalInstanceClasses.add(clsName); @@ -460,7 +461,7 @@ + jdkField.getName() + " of class " + cls.getName(), ex); } catch (JNodeClassNotFoundException ex) { - BootLog + BootLogInstance.get() .warn("JNode class not found " + ex.getMessage()); value = null; Added: trunk/core/descriptors/org.jnode.runtime.core.bootlog.xml =================================================================== --- trunk/core/descriptors/org.jnode.runtime.core.bootlog.xml (rev 0) +++ trunk/core/descriptors/org.jnode.runtime.core.bootlog.xml 2010-05-16 16:48:59 UTC (rev 5750) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plugin SYSTEM "jnode.dtd"> + +<plugin id="org.jnode.runtime.core.bootlog" + name="JNode boot log interface" + version="@VERSION@" + system="true" + license-name="lgpl" + provider-name="JNode.org"> + + <runtime> + <library name="jnode-core.jar"> + <export name="org.jnode.bootlog.*"/> + </library> + </runtime> + +</plugin> \ No newline at end of file Modified: trunk/core/src/core/org/jnode/boot/InitJarProcessor.java =================================================================== --- trunk/core/src/core/org/jnode/boot/InitJarProcessor.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/boot/InitJarProcessor.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -30,11 +30,12 @@ import java.util.jar.Attributes; import java.util.jar.Manifest; +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; import org.jnode.plugin.PluginDescriptor; import org.jnode.plugin.PluginException; import org.jnode.plugin.PluginLoader; import org.jnode.plugin.PluginRegistry; -import org.jnode.system.BootLog; import org.jnode.system.MemoryResource; import org.jnode.util.JarBuffer; @@ -60,7 +61,7 @@ jbuf = new JarBuffer(initJarRes.asByteBuffer()); mf = jbuf.getManifest(); } catch (IOException ex) { - BootLog.error("Cannot instantiate initjar", ex); + BootLogInstance.get().error("Cannot instantiate initjar", ex); } } this.jbuf = jbuf; @@ -89,7 +90,7 @@ loader, "", "", false); //resolve=false descriptors.add(descr); } catch (PluginException ex) { - BootLog.error("Cannot load " + name, ex); + BootLogInstance.get().error("Cannot load " + name, ex); } } } Modified: trunk/core/src/core/org/jnode/boot/Main.java =================================================================== --- trunk/core/src/core/org/jnode/boot/Main.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/boot/Main.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -26,11 +26,11 @@ import org.jnode.annotation.LoadStatics; import org.jnode.annotation.SharedStatics; import org.jnode.annotation.Uninterruptible; +import org.jnode.bootlog.BootLogInstance; import org.jnode.plugin.PluginDescriptor; import org.jnode.plugin.PluginManager; import org.jnode.plugin.PluginRegistry; import org.jnode.plugin.manager.DefaultPluginManager; -import org.jnode.system.BootLog; import org.jnode.vm.Unsafe; import org.jnode.vm.VmSystem; @@ -66,13 +66,13 @@ Unsafe.debug("VmSystem.initialize\n"); VmSystem.initialize(); - + // Load the plugins from the initjar - BootLog.info("Loading initjar plugins"); + BootLogInstance.get().info("Loading initjar plugins"); final InitJarProcessor proc = new InitJarProcessor(VmSystem.getInitJar()); List<PluginDescriptor> descriptors = proc.loadPlugins(pluginRegistry); - BootLog.info("Starting PluginManager"); + BootLogInstance.get().info("Starting PluginManager"); final PluginManager piMgr = new DefaultPluginManager(pluginRegistry); piMgr.startSystemPlugins(descriptors); @@ -82,7 +82,7 @@ if (mainClassName != null) { mainClass = loader.loadClass(mainClassName); } else { - BootLog.warn("No Main-Class found"); + BootLogInstance.get().warn("No Main-Class found"); mainClass = null; } final long end = VmSystem.currentKernelMillis(); @@ -98,12 +98,12 @@ if (insatnce instanceof Runnable) { ((Runnable) insatnce).run(); } else { - BootLog.warn("No valid Main-Class found"); + BootLogInstance.get().warn("No valid Main-Class found"); } } } } catch (Throwable ex) { - BootLog.error("Error in bootstrap", ex); + BootLogInstance.get().error("Error in bootstrap", ex); Unsafe.debugStackTrace(ex); sleepForever(); return -2; Added: trunk/core/src/core/org/jnode/bootlog/BootLog.java =================================================================== --- trunk/core/src/core/org/jnode/bootlog/BootLog.java (rev 0) +++ trunk/core/src/core/org/jnode/bootlog/BootLog.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -0,0 +1,119 @@ +/* + * $Id$ + * + * Copyright (C) 2003-2010 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.bootlog; + +import java.io.PrintStream; + +/** + * Logging class used during bootstrap. + * + * @author Ewout Prangsma (ep...@us...) + * + */ +public interface BootLog { + public static final int DEBUG = 1; + public static final int INFO = 2; + public static final int WARN = 3; + public static final int ERROR = 4; + public static final int FATAL = 5; + + /** + * Log a debug message + * + * @param msg + */ + void debug(String msg); + + /** + * Log a debug message + * + * @param msg + * @param ex + */ + void debug(String msg, Throwable ex); + + /** + * Log an error message + * + * @param msg + */ + void error(String msg); + + /** + * Log an error message + * + * @param msg + * @param ex + */ + void error(String msg, Throwable ex); + + /** + * Log an fatal message + * + * @param msg + */ + void fatal(String msg); + + /** + * Log an fatal message + * + * @param msg + * @param ex + */ + void fatal(String msg, Throwable ex); + + /** + * Log an info message + * + * @param msg + */ + void info(String msg); + + /** + * Log an info message + * + * @param msg + * @param ex + */ + void info(String msg, Throwable ex); + + /** + * Log an warning message + * + * @param msg + * @param ex + */ + void warn(String msg, Throwable ex); + + /** + * Log an warning message + * + * @param msg + */ + void warn(String msg); + + /** + * Set the stream to use for debug logs. + * + * @param out + */ + void setDebugOut(PrintStream out); +} Added: trunk/core/src/core/org/jnode/bootlog/BootLogInstance.java =================================================================== --- trunk/core/src/core/org/jnode/bootlog/BootLogInstance.java (rev 0) +++ trunk/core/src/core/org/jnode/bootlog/BootLogInstance.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -0,0 +1,35 @@ +package org.jnode.bootlog; + + +/** + * Class holding the {@link BootLog} instance used by the system. + * <br/><h1>Implementation note :</h1> The reference to the actual instance of + * the BootLog can't be stored in the InitialNaming that use VmType, which is + * not fully initialized at build time (but BootLog is used). So, we are always + * holding the reference in that class. + * + * @author Fabien DUMINY + * + */ +public final class BootLogInstance { + private static BootLog BOOT_LOG_INSTANCE; + + private BootLogInstance () { + } + + /** + * Get the system's {@link BootLog}. + * @return the system's {@link BootLog}. + */ + public static BootLog get() { + return BOOT_LOG_INSTANCE; + } + + /** + * Set the system's {@link BootLog}. + * @param bootLog the system's {@link BootLog}. + */ + public static void set(BootLog bootLog) { + BOOT_LOG_INSTANCE = bootLog; + } +} Added: trunk/core/src/core/org/jnode/bootlog/package.html =================================================================== --- trunk/core/src/core/org/jnode/bootlog/package.html (rev 0) +++ trunk/core/src/core/org/jnode/bootlog/package.html 2010-05-16 16:48:59 UTC (rev 5750) @@ -0,0 +1,11 @@ +<html> +<head> + <title>org.jnode.plugin</title> +</head> +<body> + +This package contains the interface with boot time log. +It also contains the singleton instance implementing that interface. + +</body> +</html> \ No newline at end of file Modified: trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java =================================================================== --- trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -30,6 +30,7 @@ import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; +import org.jnode.bootlog.BootLogInstance; import org.jnode.driver.console.ActiveTextConsole; import org.jnode.driver.console.ConsoleManager; import org.jnode.driver.console.TextConsole; @@ -37,7 +38,6 @@ import org.jnode.plugin.Plugin; import org.jnode.plugin.PluginDescriptor; import org.jnode.plugin.PluginException; -import org.jnode.system.BootLog; import org.jnode.util.WriterOutputStream; /** @@ -79,7 +79,7 @@ final VirtualConsoleAppender debugApp = new VirtualConsoleAppender(new PatternLayout(LAYOUT), console, false); debugApp.setThreshold(Level.DEBUG); - BootLog.setDebugOut(new PrintStream(new WriterOutputStream(console.getOut(), false), true)); + BootLogInstance.get().setDebugOut(new PrintStream(new WriterOutputStream(console.getOut(), false), true)); TextConsole atc = new ActiveTextConsole(conMgr); final VirtualConsoleAppender infoApp = new VirtualConsoleAppender( Modified: trunk/core/src/core/org/jnode/plugin/Plugin.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/Plugin.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/plugin/Plugin.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -24,7 +24,8 @@ import java.security.PrivilegedAction; import java.util.prefs.Preferences; -import org.jnode.system.BootLog; +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; /** @@ -101,7 +102,7 @@ } if (!started) { if (descriptor.hasCustomPluginClass()) { - BootLog.debug("Starting plugin: " + descriptor.getId()); + BootLogInstance.get().debug("Starting plugin: " + descriptor.getId()); } started = true; try { Modified: trunk/core/src/core/org/jnode/plugin/PluginManager.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/PluginManager.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/plugin/PluginManager.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -22,7 +22,8 @@ import java.util.List; -import org.jnode.system.BootLog; +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; /** * Interface of manager of all plugins in the system. @@ -75,10 +76,10 @@ try { plugin.start(); } catch (PluginException ex) { - BootLog.error("Error starting " + plugin.getDescriptor().getId()); + BootLogInstance.get().error("Error starting " + plugin.getDescriptor().getId()); throw ex; } catch (Throwable ex) { - BootLog.error("Error starting " + plugin.getDescriptor().getId()); + BootLogInstance.get().error("Error starting " + plugin.getDescriptor().getId()); throw new PluginException(ex); } } @@ -93,14 +94,14 @@ protected final void stopSinglePlugin(Plugin plugin) throws PluginException { try { if (plugin.isActive()) { - BootLog.info("Stopping " + plugin.getDescriptor().getId()); + BootLogInstance.get().info("Stopping " + plugin.getDescriptor().getId()); plugin.stop(); } } catch (PluginException ex) { - BootLog.error("Error stopping " + plugin.getDescriptor().getId()); + BootLogInstance.get().error("Error stopping " + plugin.getDescriptor().getId()); throw ex; } catch (Throwable ex) { - BootLog.error("Error stopping " + plugin.getDescriptor().getId()); + BootLogInstance.get().error("Error stopping " + plugin.getDescriptor().getId()); throw new PluginException(ex); } } Modified: trunk/core/src/core/org/jnode/plugin/PluginUtils.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/PluginUtils.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/plugin/PluginUtils.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -24,7 +24,8 @@ import java.util.MissingResourceException; import java.util.ResourceBundle; -import org.jnode.system.BootLog; +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; /** * Plugin utility methods. @@ -72,22 +73,22 @@ String message = null; try { - BootLog.debug("messageKey=" + messageKey + ", trying with " + Locale.getDefault()); + BootLogInstance.get().debug("messageKey=" + messageKey + ", trying with " + Locale.getDefault()); bundle = ResourceBundle.getBundle(fullName, Locale.getDefault(), loader); } catch (MissingResourceException e) { try { - BootLog.debug("trying with " + Locale.ENGLISH); + BootLogInstance.get().debug("trying with " + Locale.ENGLISH); bundle = ResourceBundle.getBundle(fullName, Locale.ENGLISH, loader); } catch (MissingResourceException mre) { if (!cleanFallback) - BootLog.error("can't get message", mre); + BootLogInstance.get().error("can't get message", mre); } } - BootLog.debug("bundle=" + bundle); + BootLogInstance.get().debug("bundle=" + bundle); if (bundle != null) { try { - BootLog.debug("got bundle " + bundleName); + BootLogInstance.get().debug("got bundle " + bundleName); message = bundle.getString(messageKey); } catch (MissingResourceException mre) { if (!cleanFallback) @@ -96,7 +97,7 @@ } if (message == null && !cleanFallback) { - BootLog.error("can't get message from bundle " + bundleName + " with key " + messageKey); + BootLogInstance.get().error("can't get message from bundle " + bundleName + " with key " + messageKey); } return (message == null) ? (cleanFallback ? messageKey : ('?' + messageKey + '?')) : message; Modified: trunk/core/src/core/org/jnode/plugin/manager/DefaultPluginManager.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/manager/DefaultPluginManager.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/plugin/manager/DefaultPluginManager.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -35,6 +35,8 @@ import javax.naming.NamingException; +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; import org.jnode.naming.InitialNaming; import org.jnode.plugin.Plugin; import org.jnode.plugin.PluginDescriptor; @@ -45,7 +47,6 @@ import org.jnode.plugin.PluginRegistry; import org.jnode.plugin.model.PluginRegistryModel; import org.jnode.security.JNodePermission; -import org.jnode.system.BootLog; /** * @author epr @@ -128,7 +129,7 @@ // 2 loops, first start all system plugins, // then start all auto-start plugins for (int type = 0; type < 2; type++) { - BootLog.info("Starting " + ((type == 0) ? "system" : "auto-start") + " plugins"); + BootLogInstance.get().info("Starting " + ((type == 0) ? "system" : "auto-start") + " plugins"); for (PluginDescriptor descr : descrList) { try { final boolean start; @@ -145,7 +146,7 @@ startSinglePlugin(descr.getPlugin()); } } catch (Throwable ex) { - BootLog.error("Cannot start " + descr.getId(), ex); + BootLogInstance.get().error("Cannot start " + descr.getId(), ex); if (debug) { try { Thread.sleep(5000); @@ -159,7 +160,7 @@ // Wait a while until all plugins have finished their startup process if (!isStartPluginsFinished()) { - BootLog.info("Waiting for plugins to finished their startprocess"); + BootLogInstance.get().info("Waiting for plugins to finished their startprocess"); final long start = System.currentTimeMillis(); long now = start; int loop = 0; @@ -202,9 +203,9 @@ //empty } } - BootLog.info("Stopped all plugins"); + BootLogInstance.get().info("Stopped all plugins"); } catch (PluginException ex) { - BootLog.error("Cannot stop plugins", ex); + BootLogInstance.get().error("Cannot stop plugins", ex); } } @@ -216,7 +217,7 @@ */ public final void stopPlugin(PluginDescriptor d) throws PluginException { final String id = d.getId(); - //BootLog.info("__Stopping " + id); + //BootLogInstance.get().info("__Stopping " + id); for (PluginDescriptor descr : registry) { if (descr.depends(id)) { stopPlugin(descr); @@ -245,7 +246,7 @@ for (Iterator<PluginDescriptor> i = all.values().iterator(); i.hasNext();) { final PluginDescriptor descr = (PluginDescriptor) i.next(); if (!prerequisitesExist(descr, all)) { - BootLog.info("Skipping plugin " + descr.getId()); + BootLogInstance.get().info("Skipping plugin " + descr.getId()); all.remove(descr.getId()); systemSet.remove(descr.getId()); i = all.values().iterator(); @@ -351,7 +352,7 @@ final Plugin pi = descr.getPlugin(); if (pi.isActive()) { if (!pi.isStartFinished()) { - BootLog.error("Plugin " + descr.getId() + BootLogInstance.get().error("Plugin " + descr.getId() + " has not yet finished"); } } Modified: trunk/core/src/core/org/jnode/plugin/model/FragmentDescriptorModel.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/model/FragmentDescriptorModel.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/plugin/model/FragmentDescriptorModel.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -24,10 +24,11 @@ import java.nio.ByteBuffer; import java.util.List; +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; import org.jnode.nanoxml.XMLElement; import org.jnode.plugin.FragmentDescriptor; import org.jnode.plugin.PluginException; -import org.jnode.system.BootLog; import org.jnode.vm.ResourceLoader; /** @@ -143,7 +144,7 @@ if (plugin == null) { throw new PluginException("Plugin " + getPluginId() + " not found"); } - BootLog.info("Resolve " + getId()); + BootLogInstance.get().info("Resolve " + getId()); plugin.add(this); } @@ -155,7 +156,7 @@ plugin.remove(this); plugin = null; } - BootLog.info("Unresolve " + getId()); + BootLogInstance.get().info("Unresolve " + getId()); super.unresolve(registry); } Modified: trunk/core/src/core/org/jnode/plugin/model/PluginClassLoaderImpl.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/model/PluginClassLoaderImpl.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/plugin/model/PluginClassLoaderImpl.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -37,10 +37,11 @@ import java.util.List; import java.util.Set; +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; import org.jnode.plugin.PluginClassLoader; import org.jnode.plugin.PluginDescriptor; import org.jnode.plugin.PluginException; -import org.jnode.system.BootLog; import org.jnode.vm.ResourceLoader; import org.jnode.vm.classmgr.VmClassLoader; @@ -198,7 +199,7 @@ fragment.startPlugin(registry); } } catch (PluginException ex) { - BootLog.error("Error starting plugin", ex); + BootLogInstance.get().error("Error starting plugin", ex); } // Define package (if needed) @@ -297,7 +298,7 @@ fragment.startPlugin(registry); } } catch (PluginException ex) { - BootLog.error("Cannot start plugin", ex); + BootLogInstance.get().error("Cannot start plugin", ex); } } return url; @@ -331,7 +332,7 @@ startPlugin(); fragment.startPlugin(registry); } catch (PluginException ex) { - BootLog.error("Cannot start plugin", ex); + BootLogInstance.get().error("Cannot start plugin", ex); } System.err.println("adding " + url); if (!urls.contains(url)) @@ -347,7 +348,7 @@ try { startPlugin(); } catch (PluginException ex) { - BootLog.error("Cannot start plugin", ex); + BootLogInstance.get().error("Cannot start plugin", ex); } System.err.println("adding " + url); if (!urls.contains(url)) Modified: trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -30,6 +30,8 @@ import java.util.Iterator; import java.util.List; +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; import org.jnode.nanoxml.XMLElement; import org.jnode.plugin.Extension; import org.jnode.plugin.ExtensionPoint; @@ -40,7 +42,6 @@ import org.jnode.plugin.PluginPrerequisite; import org.jnode.plugin.PluginReference; import org.jnode.plugin.Runtime; -import org.jnode.system.BootLog; import org.jnode.vm.VmSystem; import org.jnode.vm.classmgr.VmClassLoader; import org.jnode.vm.isolate.VmIsolateLocal; @@ -629,7 +630,7 @@ throw new SecurityException("Cannot overwrite the registry"); } if (!resolved) { - // BootLog.info("Resolve " + id); + // BootLogInstance.get().info("Resolve " + id); this.registry = registry; registry.registerPlugin(this); for (int i = 0; i < extensionPoints.length; i++) { @@ -664,7 +665,7 @@ } starting = true; } - // BootLog.info("Resolve on plugin " + getId()); + // BootLogInstance.get().info("Resolve on plugin " + getId()); try { AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { public Object run() throws PluginException { @@ -672,20 +673,20 @@ final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); - // BootLog.info("Start dependency " + reqId); + // BootLogInstance.get().info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel) registry .getPluginDescriptor(reqId); reqDescr.startPlugin(registry); // Make sure that it is really started reqDescr.waitUntilStarted(); } - // BootLog.info("Start myself " + getId()); + // BootLogInstance.get().info("Start myself " + getId()); getPlugin().start(); return null; } }); } catch (PrivilegedActionException ex) { - BootLog.error("Error starting plugin", ex); + BootLogInstance.get().error("Error starting plugin", ex); /*try { Thread.sleep(10000); } catch (InterruptedException ex1) { Modified: trunk/core/src/core/org/jnode/protocol/ProtocolHandlerFactoryPlugin.java =================================================================== --- trunk/core/src/core/org/jnode/protocol/ProtocolHandlerFactoryPlugin.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/protocol/ProtocolHandlerFactoryPlugin.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -27,6 +27,8 @@ import java.security.PrivilegedAction; import java.util.HashMap; +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; import org.jnode.plugin.ConfigurationElement; import org.jnode.plugin.Extension; import org.jnode.plugin.ExtensionPoint; @@ -34,7 +36,6 @@ import org.jnode.plugin.Plugin; import org.jnode.plugin.PluginDescriptor; import org.jnode.plugin.PluginException; -import org.jnode.system.BootLog; /** * Plugin that installs itself as an URL Handler Factory. @@ -68,7 +69,7 @@ try { setHandlerFactory(this); } catch (SecurityException ex) { - BootLog.error("Cannot set URL Handler Factory"); + BootLogInstance.get().error("Cannot set URL Handler Factory"); } } @@ -80,7 +81,7 @@ try { setHandlerFactory(null); } catch (SecurityException ex) { - BootLog.error("Cannot reset URL Handler Factory"); + BootLogInstance.get().error("Cannot reset URL Handler Factory"); } } @@ -93,9 +94,9 @@ try { return (URLStreamHandler) cls.newInstance(); } catch (InstantiationException ex) { - BootLog.error("Cannot instantiate " + cls.getName()); + BootLogInstance.get().error("Cannot instantiate " + cls.getName()); } catch (IllegalAccessException ex) { - BootLog.error("Illegal access to " + cls.getName()); + BootLogInstance.get().error("Illegal access to " + cls.getName()); } } return null; @@ -150,7 +151,7 @@ final Class<? extends URLStreamHandler> cls = cl.loadClass(className); handlerClasses.put(protocol, cls); } catch (ClassNotFoundException ex) { - BootLog.error("Cannot load protocol handler class " + className); + BootLogInstance.get().error("Cannot load protocol handler class " + className); } } } Modified: trunk/core/src/core/org/jnode/security/JNodePolicy.java =================================================================== --- trunk/core/src/core/org/jnode/security/JNodePolicy.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/security/JNodePolicy.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -36,10 +36,11 @@ import java.util.HashMap; import java.util.Map; +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; import org.jnode.plugin.ConfigurationElement; import org.jnode.plugin.Extension; import org.jnode.plugin.ExtensionPoint; -import org.jnode.system.BootLog; /** * Default policy implementation for JNode. @@ -99,7 +100,7 @@ .entrySet()) { final CodeSource cs = e.getKey(); if (cs.implies(codeSource)) { - // BootLog.info(cs + " -> " + codeSource); + // BootLogInstance.get().info(cs + " -> " + codeSource); final PermissionCollection pc = e.getValue(); for (Enumeration<?> ee = pc.elements(); ee.hasMoreElements();) { perms.add((Permission) ee.nextElement()); @@ -147,7 +148,7 @@ final CodeSource cs = new CodeSource(url, (Certificate[]) null); final Permissions perms = new Permissions(); codeSource2Permissions.put(cs, perms); - // BootLog.debug("Adding permissions for " + cs); + // BootLogInstance.get().debug("Adding permissions for " + cs); final ConfigurationElement[] elems = ext.getConfigurationElements(); final int count = elems.length; for (int i = 0; i < count; i++) { @@ -175,30 +176,30 @@ final Permission p = (Permission) perm; perms.add(p); } catch (ClassNotFoundException ex) { - BootLog + BootLogInstance.get() .error("Permission class " + type + " not found"); } catch (InstantiationException ex) { - BootLog.error("Cannot instantiate permission class " + BootLogInstance.get().error("Cannot instantiate permission class " + type); } catch (IllegalAccessException ex) { - BootLog.error("Illegal access to permission class " + BootLogInstance.get().error("Illegal access to permission class " + type); } catch (NoSuchMethodException ex) { - BootLog + BootLogInstance.get() .error("Constructor not found on permission class " + type + " in plugin " + id); } catch (InvocationTargetException ex) { - BootLog.error("Error constructing permission class " + BootLogInstance.get().error("Error constructing permission class " + type, ex); } catch (ClassCastException ex) { - BootLog.error("Permission class " + type + BootLogInstance.get().error("Permission class " + type + " not instance of Permission"); } } } } catch (MalformedURLException ex) { - BootLog.error("Cannot create plugin codesource", ex); + BootLogInstance.get().error("Cannot create plugin codesource", ex); } } } Deleted: trunk/core/src/core/org/jnode/system/BootLog.java =================================================================== --- trunk/core/src/core/org/jnode/system/BootLog.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/system/BootLog.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -1,180 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003-2010 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.system; - -import java.io.PrintStream; - -import org.jnode.vm.Unsafe; - -/** - * Logging class used during bootstrap. - * - * @author Ewout Prangsma (ep...@us...) - */ -public class BootLog { - - public static final int DEBUG = 1; - public static final int INFO = 2; - public static final int WARN = 3; - public static final int ERROR = 4; - public static final int FATAL = 5; - - private static PrintStream debugOut; - - /** - * Log a debug message - * - * @param msg - */ - public static void debug(String msg) { - final PrintStream out = (debugOut != null) ? debugOut : System.out; - log(DEBUG, out, msg, null); - } - - /** - * Log a debug message - * - * @param msg - * @param ex - */ - public static void debug(String msg, Throwable ex) { - final PrintStream out = (debugOut != null) ? debugOut : System.out; - log(DEBUG, out, msg, ex); - } - - /** - * Log an error message - * - * @param msg - */ - public static void error(String msg) { - log(ERROR, System.err, msg, null); - } - - /** - * Log an error message - * - * @param msg - * @param ex - */ - public static void error(String msg, Throwable ex) { - log(ERROR, System.err, msg, ex); - /*try { - Thread.sleep(2500); - } catch (InterruptedException ex2) { - // Ignore - }*/ - } - - /** - * Log an fatal message - * - * @param msg - */ - public static void fatal(String msg) { - log(FATAL, System.err, msg, null); - } - - /** - * Log an fatal message - * - * @param msg - * @param ex - */ - public static void fatal(String msg, Throwable ex) { - log(FATAL, System.err, msg, ex); - } - - /** - * Log an info message - * - * @param msg - */ - public static void info(String msg) { - log(INFO, System.out, msg, null); - } - - /** - * Log an info message - * - * @param msg - * @param ex - */ - public static void info(String msg, Throwable ex) { - log(INFO, System.out, msg, ex); - } - - /** - * Log an warning message - * - * @param msg - * @param ex - */ - public static void warn(String msg, Throwable ex) { - log(WARN, System.out, msg, ex); - } - - /** - * Log an warning message - * - * @param msg - */ - public static void warn(String msg) { - log(WARN, System.out, msg, null); - } - - /** - * Set the stream to use for debug logs. - * - * @param out - */ - public static void setDebugOut(PrintStream out) { - debugOut = out; - } - - /** - * Log an error message - * - * @param level - * @param ps - * @param msg - * @param ex - */ - private static void log(int level, PrintStream ps, String msg, Throwable ex) { - if (ps != null) { - if (msg != null) { - ps.println(msg); - } - if (ex != null) { - ex.printStackTrace(ps); - } - } else { - if (msg != null) { - Unsafe.debug(msg); - Unsafe.debug("\n"); - } - if (ex != null) { - Unsafe.debug(ex.toString()); - Unsafe.debug("\n"); - } - } - } -} Modified: trunk/core/src/core/org/jnode/util/ByteQueueProcessorThread.java =================================================================== --- trunk/core/src/core/org/jnode/util/ByteQueueProcessorThread.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/util/ByteQueueProcessorThread.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -20,7 +20,8 @@ package org.jnode.util; -import org.jnode.system.BootLog; +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; /** * @author Ewout Prangsma (ep...@us...) @@ -76,7 +77,7 @@ * @param ex */ protected void handleException(Exception ex) { - BootLog.error("Exception in ByteQueueProcessor: " + getName(), ex); + BootLogInstance.get().error("Exception in ByteQueueProcessor: " + getName(), ex); } /** @@ -85,7 +86,7 @@ * @param ex */ protected void handleError(Error ex) { - BootLog.error("Error in ByteQueueProcessor: " + getName(), ex); + BootLogInstance.get().error("Error in ByteQueueProcessor: " + getName(), ex); } /** Modified: trunk/core/src/core/org/jnode/util/QueueProcessorThread.java =================================================================== --- trunk/core/src/core/org/jnode/util/QueueProcessorThread.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/util/QueueProcessorThread.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -20,7 +20,8 @@ package org.jnode.util; -import org.jnode.system.BootLog; +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; /** * @author epr @@ -80,7 +81,7 @@ * @param ex */ protected void handleException(Exception ex) { - BootLog.error("Exception in QueueProcessor: " + getName(), ex); + BootLogInstance.get().error("Exception in QueueProcessor: " + getName(), ex); } /** @@ -89,7 +90,7 @@ * @param ex */ protected void handleError(Error ex) { - BootLog.error("Error in QueueProcessor: " + getName(), ex); + BootLogInstance.get().error("Error in QueueProcessor: " + getName(), ex); } /** Copied: trunk/core/src/core/org/jnode/vm/BootLogImpl.java (from rev 5749, trunk/core/src/core/org/jnode/system/BootLog.java) =================================================================== --- trunk/core/src/core/org/jnode/vm/BootLogImpl.java (rev 0) +++ trunk/core/src/core/org/jnode/vm/BootLogImpl.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -0,0 +1,153 @@ +/* + * $Id$ + * + * Copyright (C) 2003-2010 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.vm; + +import java.io.PrintStream; + +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; + +/** + * Logging class used during bootstrap. + * + * @author Ewout Prangsma (ep...@us...) + */ +class BootLogImpl implements BootLog, BootableObject { + + private PrintStream debugOut; + + /** + * {@inheritDoc} + */ + public void debug(String msg) { + final PrintStream out = (debugOut != null) ? debugOut : System.out; + log(DEBUG, out, msg, null); + } + + /** + * {@inheritDoc} + */ + public void debug(String msg, Throwable ex) { + final PrintStream out = (debugOut != null) ? debugOut : System.out; + log(DEBUG, out, msg, ex); + } + + /** + * {@inheritDoc} + */ + public void error(String msg) { + log(ERROR, System.err, msg, null); + } + + /** + * {@inheritDoc} + */ + public void error(String msg, Throwable ex) { + log(ERROR, System.err, msg, ex); + /*try { + Thread.sleep(2500); + } catch (InterruptedException ex2) { + // Ignore + }*/ + } + + /** + * {@inheritDoc} + */ + public void fatal(String msg) { + log(FATAL, System.err, msg, null); + } + + /** + * {@inheritDoc} + */ + public void fatal(String msg, Throwable ex) { + log(FATAL, System.err, msg, ex); + } + + /** + * {@inheritDoc} + */ + public void info(String msg) { + log(INFO, System.out, msg, null); + } + + /** + * {@inheritDoc} + */ + public void info(String msg, Throwable ex) { + log(INFO, System.out, msg, ex); + } + + /** + * {@inheritDoc} + */ + public void warn(String msg, Throwable ex) { + log(WARN, System.out, msg, ex); + } + + /** + * {@inheritDoc} + */ + public void warn(String msg) { + log(WARN, System.out, msg, null); + } + + /** + * {@inheritDoc} + */ + public void setDebugOut(PrintStream out) { + debugOut = out; + } + + /** + * Log an error message + * + * @param level + * @param ps + * @param msg + * @param ex + */ + private void log(int level, PrintStream ps, String msg, Throwable ex) { + if (ps != null) { + if (msg != null) { + ps.println(msg); + } + if (ex != null) { + ex.printStackTrace(ps); + } + } else { + if (msg != null) { + Unsafe.debug(msg); + Unsafe.debug("\n"); + } + if (ex != null) { + Unsafe.debug(ex.toString()); + Unsafe.debug("\n"); + } + } + } + + static void initialize() { + Unsafe.debug("Initialize BootLog\n"); + BootLogInstance.set(new BootLogImpl()); + } +} Modified: trunk/core/src/core/org/jnode/vm/MemoryBlockManager.java =================================================================== --- trunk/core/src/core/org/jnode/vm/MemoryBlockManager.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/vm/MemoryBlockManager.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -23,6 +23,7 @@ import org.jnode.annotation.MagicPermission; import org.jnode.annotation.SharedStatics; import org.jnode.annotation.Uninterruptible; +import org.jnode.bootlog.BootLogInstance; import org.jnode.vm.scheduler.VmProcessor; import org.jnode.vm.scheduler.VmThread; import org.vmmagic.unboxed.Address; @@ -244,9 +245,8 @@ /** * Initialize this manager. */ - private static void initialize() { + private static void initialize() { Unsafe.debug("Initialize MemoryBlockManager\n"); - startPtr = blockAlign(Unsafe.getMemoryStart().toWord(), true).toAddress(); endPtr = blockAlign(Unsafe.getMemoryEnd().toWord(), false).toAddress(); Modified: trunk/core/src/core/org/jnode/vm/VmSystem.java =================================================================== --- trunk/core/src/core/org/jnode/vm/VmSystem.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/vm/VmSystem.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -33,21 +33,21 @@ import org.apache.log4j.ConsoleAppender; import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; +import org.jnode.annotation.Internal; +import org.jnode.annotation.KernelSpace; +import org.jnode.annotation.MagicPermission; +import org.jnode.annotation.PrivilegedActionPragma; +import org.jnode.annotation.SharedStatics; +import org.jnode.annotation.Uninterruptible; +import org.jnode.bootlog.BootLogInstance; import org.jnode.naming.InitialNaming; import org.jnode.plugin.PluginManager; import org.jnode.security.JNodePermission; -import org.jnode.system.BootLog; import org.jnode.system.MemoryResource; import org.jnode.system.ResourceManager; import org.jnode.system.ResourceNotFreeException; import org.jnode.system.ResourceOwner; import org.jnode.system.SimpleResourceOwner; -import org.jnode.annotation.Internal; -import org.jnode.annotation.KernelSpace; -import org.jnode.annotation.MagicPermission; -import org.jnode.annotation.PrivilegedActionPragma; -import org.jnode.annotation.SharedStatics; -import org.jnode.annotation.Uninterruptible; import org.jnode.vm.classmgr.AbstractExceptionHandler; import org.jnode.vm.classmgr.VmArray; import org.jnode.vm.classmgr.VmByteCode; @@ -118,11 +118,13 @@ * Initialize the Virtual Machine */ public static void initialize() { - if (!inited) { - + if (!inited) { + // Initialize BootLog + BootLogImpl.initialize(); + // Initialize resource manager final ResourceManager rm = ResourceManagerImpl.initialize(); - + /* Initialize the system classloader */ VmSystemClassLoader loader = (VmSystemClassLoader) (getVmClass(VmProcessor.current()).getLoader()); systemLoader = loader; @@ -249,16 +251,16 @@ final Extent size = end.toWord().sub(start.toWord()).toExtent(); if (size.toWord().isZero()) { // No initial jarfile - BootLog.info("No initial jarfile found"); + BootLogInstance.get().info("No initial jarfile found"); return null; } else { - BootLog.info("Found initial jarfile of " + size.toInt() + "b"); + BootLogInstance.get().info("Found initial jarfile of " + size.toInt() + "b"); try { final ResourceOwner owner = new SimpleResourceOwner("System"); return rm.claimMemoryResource(owner, start, size, ResourceManager.MEMMODE_NORMAL); } catch (ResourceNotFreeException ex) { - BootLog.error("Cannot claim initjar resource", ex); + BootLogInstance.get().error("Cannot claim initjar resource", ex); return null; } } @@ -566,7 +568,7 @@ final VmType exClass = VmMagic.getObjectType(ex); final VmMethod method = reader.getMethod(frame); if (method == null) { - Unsafe.debug("Unknown method"); + Unsafe.debug("Unknown method in class " + ex.getClass().getName()); return null; } @@ -831,7 +833,7 @@ } } } catch (Exception ex) { - BootLog.error("Error getting rtcIncrement ", ex); + BootLogInstance.get().error("Error getting rtcIncrement ", ex); rtcIncrement = 1; } } Modified: trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java =================================================================== --- trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -323,7 +323,7 @@ throw new ClassNotFoundException(name); } - // BootLog.debug("load class" + name); + // BootLogInstance.get().debug("load class" + name); if (name.indexOf('/') >= 0) { //throw new IllegalArgumentException("name contains '/'"); Modified: trunk/core/src/core/org/jnode/vm/bytecode/BasicBlockFinder.java =================================================================== --- trunk/core/src/core/org/jnode/vm/bytecode/BasicBlockFinder.java 2010-05-12 10:31:48 UTC (rev 5749) +++ trunk/core/src/core/org/jnode/vm/bytecode/BasicBlockFinder.java 2010-05-16 16:48:59 UTC (rev 5750) @@ -23,7 +23,8 @@ import java.util.Comparator; import java.util.TreeMap; -import org.jnode.system.BootLog; +import org.jnode.bootlog.BootLog; +import org.jnode.bootlog.BootLogInstance; import org.jnode.vm.JvmType; import org.jnode.vm.classmgr.VmByteCode; import org.jnode.vm.classmgr.VmConstClass; @@ -380,7 +381,7 @@ */ public void visit_ireturn() { if (debug) { - BootLog.debug("ireturn at " + curAddress + "; " + tstack); + BootLogInstance.get().debug("ireturn at " + curAddress + "; " + tstack); } tstack.pop(JvmType.INT); endBB(false); @@ -435,34 +436,34 @@ */ public void startInstruction(int address) { if (debug) { - BootLog.debug("#" + address + "\t" + tstack); + BootLogInstance.get().debug("#" + address + "\t" + tstack); } curAddress = address; super.startInstruction(address); opcodeFlags[address] |= F_START_OF_INSTRUCTION; if (nextIsStartOfBB) { - if (debug) BootLog.debug("\tnextIsStartOfBB\t" + nextFollowsTypeStack); + if (debug) BootLogInstance.get().debug("\tnextIsStartOfBB\t" + nextFollowsTypeStack); startBB(address, nextFollowsTypeStack, this.tstack); nextIsStartOfBB =... [truncated message content] |
From: <fd...@us...> - 2010-05-12 10:31:57
|
Revision: 5749 http://jnode.svn.sourceforge.net/jnode/?rev=5749&view=rev Author: fduminy Date: 2010-05-12 10:31:48 +0000 (Wed, 12 May 2010) Log Message: ----------- removed dependency cycle between org.jnode.vm <-> org.jnode.util by : - moving Statistic, Statistics, BootableHashMap, BootableArrayList, SynchronizedCounter, CounterGroup, Counter classes from org.jnode.util to org.jnode.vm.objects - moving method loop(ms) from org.jnode.util.TimeUtils to org.jnode.vm.VmSystem Signed-off-by: Fabien DUMINY <fab...@we...> Modified Paths: -------------- trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java trunk/core/descriptors/org.jnode.vm.core.xml trunk/core/src/core/org/jnode/assembler/x86/X86Register.java trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java trunk/core/src/core/org/jnode/plugin/model/PluginJar.java trunk/core/src/core/org/jnode/plugin/model/PluginRegistryModel.java trunk/core/src/core/org/jnode/util/TimeUtils.java trunk/core/src/core/org/jnode/vm/InternString.java trunk/core/src/core/org/jnode/vm/Vm.java trunk/core/src/core/org/jnode/vm/VmSystem.java trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java trunk/core/src/core/org/jnode/vm/bytecode/BasicBlock.java trunk/core/src/core/org/jnode/vm/classmgr/SelectorMap.java trunk/core/src/core/org/jnode/vm/compiler/BaseMagicHelper.java trunk/core/src/core/org/jnode/vm/compiler/OptimizingBytecodeVisitor.java trunk/core/src/core/org/jnode/vm/compiler/ir/IRBasicBlock.java trunk/core/src/core/org/jnode/vm/compiler/ir/IRControlFlowGraph.java trunk/core/src/core/org/jnode/vm/compiler/ir/IRTest.java trunk/core/src/core/org/jnode/vm/compiler/ir/LinearScanAllocator.java trunk/core/src/core/org/jnode/vm/compiler/ir/PhiOperand.java trunk/core/src/core/org/jnode/vm/compiler/ir/SSAStack.java trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java trunk/core/src/core/org/jnode/vm/x86/LocalAPIC.java trunk/core/src/core/org/jnode/vm/x86/VmX86Processor.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java trunk/core/src/core/org/jnode/vm/x86/compiler/l2/X86RegisterPool.java trunk/core/src/openjdk/vm/java/lang/NativeString.java trunk/core/src/test/org/jnode/test/IRTest.java trunk/net/src/driver/org/jnode/driver/net/eepro100/EEPRO100Core.java trunk/net/src/net/org/jnode/net/NetworkLayer.java trunk/net/src/net/org/jnode/net/TransportLayer.java trunk/net/src/net/org/jnode/net/arp/ARPNetworkLayer.java trunk/net/src/net/org/jnode/net/arp/ARPStatistics.java trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPProtocol.java trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPStatistics.java trunk/net/src/net/org/jnode/net/ipv4/layer/IPv4NetworkLayer.java trunk/net/src/net/org/jnode/net/ipv4/layer/IPv4Statistics.java trunk/net/src/net/org/jnode/net/ipv4/raw/RAWProtocol.java trunk/net/src/net/org/jnode/net/ipv4/raw/RAWStatistics.java trunk/net/src/net/org/jnode/net/ipv4/tcp/TCPProtocol.java trunk/net/src/net/org/jnode/net/ipv4/tcp/TCPStatistics.java trunk/net/src/net/org/jnode/net/ipv4/udp/UDPProtocol.java trunk/net/src/net/org/jnode/net/ipv4/udp/UDPStatistics.java Added Paths: ----------- trunk/core/src/core/org/jnode/vm/objects/ trunk/core/src/core/org/jnode/vm/objects/BootableArrayList.java trunk/core/src/core/org/jnode/vm/objects/BootableHashMap.java trunk/core/src/core/org/jnode/vm/objects/Counter.java trunk/core/src/core/org/jnode/vm/objects/CounterGroup.java trunk/core/src/core/org/jnode/vm/objects/Statistic.java trunk/core/src/core/org/jnode/vm/objects/Statistics.java trunk/core/src/core/org/jnode/vm/objects/SynchronizedCounter.java Removed Paths: ------------- trunk/core/src/core/org/jnode/util/BootableArrayList.java trunk/core/src/core/org/jnode/util/BootableHashMap.java trunk/core/src/core/org/jnode/util/Counter.java trunk/core/src/core/org/jnode/util/CounterGroup.java trunk/core/src/core/org/jnode/util/Statistic.java trunk/core/src/core/org/jnode/util/Statistics.java trunk/core/src/core/org/jnode/util/SynchronizedCounter.java Modified: trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java =================================================================== --- trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -54,7 +54,6 @@ 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; @@ -81,6 +80,7 @@ import org.jnode.vm.compiler.NativeCodeCompiler; import org.jnode.vm.memmgr.HeapHelper; import org.jnode.vm.memmgr.VmHeapManager; +import org.jnode.vm.objects.BootableHashMap; import org.jnode.vm.scheduler.VmProcessor; import org.vmmagic.unboxed.UnboxedObject; @@ -1381,6 +1381,7 @@ addCompileHighOptLevel("org.jnode.vm.classmgr"); addCompileHighOptLevel("org.jnode.vm.compiler"); addCompileHighOptLevel("org.jnode.vm.isolate"); + addCompileHighOptLevel("org.jnode.vm.objects"); addCompileHighOptLevel("org.jnode.vm.scheduler"); for (NativeCodeCompiler compiler : getArchitecture().getCompilers()) { for (String packageName : compiler.getCompilerPackages()) { Modified: trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java =================================================================== --- trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -28,8 +28,8 @@ import org.jnode.net.TransportLayer; import org.jnode.net.util.NetUtils; import org.jnode.shell.AbstractCommand; -import org.jnode.util.Statistic; -import org.jnode.util.Statistics; +import org.jnode.vm.objects.Statistic; +import org.jnode.vm.objects.Statistics; /** * @author epr Modified: trunk/core/descriptors/org.jnode.vm.core.xml =================================================================== --- trunk/core/descriptors/org.jnode.vm.core.xml 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/descriptors/org.jnode.vm.core.xml 2010-05-12 10:31:48 UTC (rev 5749) @@ -25,6 +25,7 @@ <export name="org.jnode.vm.compiler.*"/> <export name="org.jnode.vm.isolate.*"/> <export name="org.jnode.vm.memmgr.*"/> + <export name="org.jnode.vm.objects.*"/> <export name="org.jnode.vm.performance.*"/> <export name="org.jnode.vm.scheduler.*"/> </library> Modified: trunk/core/src/core/org/jnode/assembler/x86/X86Register.java =================================================================== --- trunk/core/src/core/org/jnode/assembler/x86/X86Register.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/assembler/x86/X86Register.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -20,8 +20,8 @@ package org.jnode.assembler.x86; -import org.jnode.util.BootableHashMap; import org.jnode.vm.VmSystemObject; +import org.jnode.vm.objects.BootableHashMap; /** * Registers of the x86 architecture. Modified: trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -41,10 +41,10 @@ import org.jnode.plugin.PluginReference; import org.jnode.plugin.Runtime; import org.jnode.system.BootLog; -import org.jnode.util.BootableArrayList; import org.jnode.vm.VmSystem; import org.jnode.vm.classmgr.VmClassLoader; import org.jnode.vm.isolate.VmIsolateLocal; +import org.jnode.vm.objects.BootableArrayList; /** * Implementation of {@link org.jnode.plugin.PluginDescriptor}. Modified: trunk/core/src/core/org/jnode/plugin/model/PluginJar.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/model/PluginJar.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/plugin/model/PluginJar.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -33,13 +33,13 @@ import org.jnode.nanoxml.XMLElement; import org.jnode.plugin.PluginDescriptor; import org.jnode.plugin.PluginException; -import org.jnode.util.BootableHashMap; import org.jnode.util.ByteBufferInputStream; import org.jnode.util.FileUtils; import org.jnode.util.JarBuffer; import org.jnode.vm.BootableObject; import org.jnode.vm.ResourceLoader; import org.jnode.vm.Vm; +import org.jnode.vm.objects.BootableHashMap; /** * @author Ewout Prangsma (ep...@us...) Modified: trunk/core/src/core/org/jnode/plugin/model/PluginRegistryModel.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/model/PluginRegistryModel.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/plugin/model/PluginRegistryModel.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -43,9 +43,9 @@ import org.jnode.plugin.PluginReference; import org.jnode.plugin.PluginRegistry; import org.jnode.plugin.PluginSecurityConstants; -import org.jnode.util.BootableHashMap; import org.jnode.vm.VmSystemObject; import org.jnode.vm.isolate.VmIsolateLocal; +import org.jnode.vm.objects.BootableHashMap; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; Deleted: trunk/core/src/core/org/jnode/util/BootableArrayList.java =================================================================== --- trunk/core/src/core/org/jnode/util/BootableArrayList.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/util/BootableArrayList.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -1,358 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003-2010 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.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.RandomAccess; - -import org.jnode.vm.VmSystemObject; - -/** - * A BootableList is a List implementation that can be used in the - * build process of JNode. - * Using this class, instead of e.g. ArrayList, will avoid class incompatibilities - * between the JNode java.util implementation and Sun's implementation. - * - * @author epr - */ -public class BootableArrayList<T> extends VmSystemObject implements List<T>, RandomAccess { - - private ArrayList<T> listCache; - private T[] array; - private int hashCode; - private transient boolean locked; - - /** - * Constructs an empty list with an initial capacity of ten. - */ - public BootableArrayList() { - hashCode = super.hashCode(); - } - - /** - * Constructs a list containing the elements of the specified collection, - * in the order they are returned by the collection's iterator. - * - * @param c - */ - public BootableArrayList(Collection<? extends T> c) { - addAll(c); - } - - /** - * Constructs an empty list with an initial capacity of ten. - * - * @param initialCapacity - */ - public BootableArrayList(int initialCapacity) { - listCache = new ArrayList<T>(initialCapacity); - hashCode = listCache.hashCode(); - } - - /** - * Gets (an if needed reload) the arraylist. - * - * @return - */ - private final ArrayList<T> getListCache() { - if (locked) { - throw new RuntimeException("Cannot change a locked BootableArrayList"); - } - if (listCache == null) { - listCache = new ArrayList<T>(); - if (array != null) { - listCache.addAll(Arrays.asList(array)); - } - array = null; - } - return listCache; - } - - /** - * @param index - * @param o - * @see java.util.AbstractList#add(int, java.lang.Object) - */ - public void add(int index, T o) { - getListCache().add(index, o); - } - - /** - * @param o - * @return boolean - * @see java.util.AbstractList#add(java.lang.Object) - */ - public boolean add(T o) { - return getListCache().add(o); - } - - /** - * @param c - * @return boolean - * @see java.util.AbstractCollection#addAll(java.util.Collection) - */ - public boolean addAll(Collection<? extends T> c) { - return getListCache().addAll(c); - } - - /** - * @param index - * @param c - * @return boolean - * @see java.util.AbstractList#addAll(int, java.util.Collection) - */ - public boolean addAll(int index, Collection<? extends T> c) { - return getListCache().addAll(index, c); - } - - /** - * @see java.util.AbstractList#clear() - */ - public void clear() { - getListCache().clear(); - } - - /** - * @param o - * @return boolean - * @see java.util.AbstractCollection#contains(java.lang.Object) - */ - public boolean contains(Object o) { - return getListCache().contains(o); - } - - /** - * @param c - * @return boolean - * @see java.util.AbstractCollection#containsAll(java.util.Collection) - */ - public boolean containsAll(Collection c) { - return getListCache().containsAll(c); - } - - /** - * @param minCapacity - */ - public void ensureCapacity(int minCapacity) { - getListCache().ensureCapacity(minCapacity); - } - - /** - * @param obj - * @return boolean - * @see java.util.AbstractList#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - return getListCache().equals(obj); - } - - /** - * @return int - * @see java.util.AbstractList#hashCode() - */ - public int hashCode() { - if (listCache != null) { - return getListCache().hashCode(); - } else { - return hashCode; - } - } - - /** - * @param o - * @return int - * @see java.util.AbstractList#indexOf(java.lang.Object) - */ - public int indexOf(Object o) { - return getListCache().indexOf(o); - } - - /** - * @return boolean - * @see java.util.AbstractCollection#isEmpty() - */ - public boolean isEmpty() { - return getListCache().isEmpty(); - } - - /** - * @return the iterator - * @see java.util.AbstractList#iterator() - */ - public Iterator<T> iterator() { - return getListCache().iterator(); - } - - /** - * @param o - * @return int - * @see java.util.AbstractList#lastIndexOf(java.lang.Object) - */ - public int lastIndexOf(Object o) { - return getListCache().lastIndexOf(o); - } - - /** - * @return the iterator - * @see java.util.AbstractList#listIterator() - */ - public ListIterator<T> listIterator() { - return getListCache().listIterator(); - } - - /** - * @param index - * @return the iterator - * @see java.util.AbstractList#listIterator(int) - */ - public ListIterator<T> listIterator(int index) { - return getListCache().listIterator(index); - } - - /** - * @param index - * @return object - * @see java.util.AbstractList#remove(int) - */ - public T remove(int index) { - return getListCache().remove(index); - } - - /** - * @param o - * @return boolean - * @see java.util.AbstractCollection#remove(java.lang.Object) - */ - public boolean remove(Object o) { - return getListCache().remove(o); - } - - /** - * @param c - * @return boolean - * @see java.util.AbstractCollection#removeAll(java.util.Collection) - */ - public boolean removeAll(Collection<?> c) { - return getListCache().removeAll(c); - } - - /** - * @param c - * @return boolean - * @see java.util.AbstractCollection#retainAll(java.util.Collection) - */ - public boolean retainAll(Collection c) { - return getListCache().retainAll(c); - } - - /** - * @param index - * @param o - * @return object - * @see java.util.AbstractList#set(int, java.lang.Object) - */ - public T set(int index, T o) { - return getListCache().set(index, o); - } - - /** - * @param fromIndex - * @param toIndex - * @return the sub list - * @see java.util.AbstractList#subList(int, int) - */ - public List<T> subList(int fromIndex, int toIndex) { - return getListCache().subList(fromIndex, toIndex); - } - - /** - * @return the array - * @see java.util.AbstractCollection#toArray() - */ - public Object[] toArray() { - return getListCache().toArray(); - } - - /** - * @param a - * @return the array - * @see java.util.AbstractCollection#toArray(java.lang.Object[]) - */ - public <E> E[] toArray(E[] a) { - return getListCache().toArray(a); - } - - /** - * @return String - * @see java.util.AbstractCollection#toString() - */ - public String toString() { - if (listCache != null) { - return getListCache().toString(); - } else { - return super.toString(); - } - } - - /** - * - */ - public void trimToSize() { - getListCache().trimToSize(); - } - - /** - * @param index - * @return The element at the given index - */ - public T get(int index) { - return getListCache().get(index); - } - - /** - * @return The number of elements in this list - */ - public int size() { - return getListCache().size(); - } - - /** - * @see org.jnode.vm.VmSystemObject#verifyBeforeEmit() - */ - @SuppressWarnings("unchecked") - public void verifyBeforeEmit() { - super.verifyBeforeEmit(); - if (listCache != null) { - array = (T[]) listCache.toArray(); - hashCode = listCache.hashCode(); - } else { - array = null; - } - listCache = null; - locked = true; - } - -} Deleted: trunk/core/src/core/org/jnode/util/BootableHashMap.java =================================================================== --- trunk/core/src/core/org/jnode/util/BootableHashMap.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/util/BootableHashMap.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -1,260 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003-2010 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.util; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.jnode.vm.VmSystemObject; - -/** - * @author epr - */ -public class BootableHashMap<K, V> extends VmSystemObject implements Map<K, V> { - - private HashMap<K, V> mapCache; - private Entry<K, V>[] entryArray; - private int hashCode; - private transient boolean locked; - - /** - * Constructs an empty HashMap. - * @see java.util.HashMap#HashMap() - */ - public BootableHashMap() { - this.hashCode = super.hashCode(); - } - - /** - * Constructs an empty HashMap. - * @see java.util.HashMap#HashMap(int) - * - * @param initialCapacity - */ - public BootableHashMap(int initialCapacity) { - mapCache = new HashMap<K, V>(initialCapacity); - this.hashCode = mapCache.hashCode(); - } - - /** - * @return int - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - if (mapCache != null) { - return getMapCache().hashCode(); - } else { - return hashCode; - } - } - - /** - * @return String - * @see java.lang.Object#toString() - */ - public String toString() { - if (mapCache != null) { - return getMapCache().toString(); - } else { - return super.toString(); - } - } - - /** - * @return The collection of values - */ - public Collection<V> values() { - return getMapCache().values(); - } - - /** - * @return The set of keys - */ - public Set<K> keySet() { - return getMapCache().keySet(); - } - - /** - * @param key - * @return The object for the given key, or null if the given key is not found. - */ - public V get(Object key) { - return getMapCache().get(key); - } - - /** - * - */ - public void clear() { - getMapCache().clear(); - } - - /** - * @return The number of elements - */ - public int size() { - return getMapCache().size(); - } - - /** - * @param key - * @param value - * @return Object - */ - public V put(K key, V value) { - return getMapCache().put(key, value); - } - - /** - * @param m - */ - public void putAll(Map<? extends K, ? extends V> m) { - getMapCache().putAll(m); - } - - /** - * @return The set of entries - */ - public Set<Map.Entry<K, V>> entrySet() { - return getMapCache().entrySet(); - } - - /** - * @param key - * @return True if the key is contained, false otherwise - */ - public boolean containsKey(Object key) { - return getMapCache().containsKey(key); - } - - /** - * @return True if this map is empty, false otherwise - */ - public boolean isEmpty() { - return getMapCache().isEmpty(); - } - - /** - * @param obj - * @return boolean - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - return getMapCache().equals(obj); - } - - /** - * @param o - * @return Object - */ - public V remove(Object o) { - return getMapCache().remove(o); - } - - /** - * @param value - * @return True if the given value is contained, false otherwise - */ - public boolean containsValue(Object value) { - return getMapCache().containsValue(value); - } - - - static final class Entry<eK, eV> extends VmSystemObject { - private final eK key; - private final eV value; - - public Entry(Map.Entry<eK, eV> entry) { - this.key = entry.getKey(); - this.value = entry.getValue(); - } - - /** - * Gets the key - * - * @return Object - */ - public eK getKey() { - return key; - } - - /** - * Gets the value - * - * @return Object - */ - public eV getValue() { - return value; - } - } - - /** - * Gets the hashmap - * - * @return - */ - private final HashMap<K, V> getMapCache() { - if (locked) { - throw new RuntimeException("Cannot change a locked BootableHashMap"); - } - if (mapCache == null) { - if (entryArray != null) { - final int max = entryArray.length; - - mapCache = new HashMap<K, V>(max); - for (int i = 0; i < max; i++) { - final Entry<K, V> e = entryArray[i]; - mapCache.put(e.getKey(), e.getValue()); - } - - entryArray = null; - } else { - mapCache = new HashMap<K, V>(); - } - } - return mapCache; - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public void verifyBeforeEmit() { - super.verifyBeforeEmit(); - - if (mapCache != null) { - entryArray = new Entry[mapCache.size()]; - int index = 0; - for (Map.Entry<K, V> entry : mapCache.entrySet()) { - entryArray[index++] = new Entry<K, V>(entry); - } - hashCode = mapCache.hashCode(); - mapCache = null; - } - locked = true; - } - - public boolean isLocked() { - return locked; - } -} Deleted: trunk/core/src/core/org/jnode/util/Counter.java =================================================================== --- trunk/core/src/core/org/jnode/util/Counter.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/util/Counter.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -1,108 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003-2010 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.util; - -/** - * @author Ewout Prangsma (ep...@us...) - */ -public final class Counter extends Statistic implements Comparable<Counter> { - - private static final String is = "="; - - private int counter = 0; - - public Counter(String name) { - this(name, null, 0); - } - - public Counter(String name, String description) { - this(name, description, 0); - } - - public Counter(String name, int value) { - this(name, null, value); - } - - public Counter(String name, String description, int value) { - super(name, description); - this.counter = value; - } - - /** - * Gets the counter of this statistic - * - * @return the counter - */ - public int get() { - return counter; - } - - public Object getValue() { - return counter; - } - - /** - * Increment the counter of this statistic by 1. - */ - public void inc() { - counter++; - } - - /** - * Reset the counter to 0. - */ - public void reset() { - counter = 0; - } - - /** - * Add <i>increment</i> to the counter of this statistic. - */ - public void add(int increment) { - counter += increment; - } - - /** - * @see java.lang.Comparable#compareTo(java.lang.Object) - */ - public int compareTo(Counter o) { - if (o.counter < this.counter) { - return 1; - } else if (o.counter > this.counter) { - return -1; - } - return 0; - } - - /** - * Convert to a String representation - * - * @return String - * @see java.lang.Object#toString() - */ - public String toString() { - StringBuilder sb = new StringBuilder(getName()); - sb.append(is); - sb.append(counter); - - return sb.toString(); - } -} Deleted: trunk/core/src/core/org/jnode/util/CounterGroup.java =================================================================== --- trunk/core/src/core/org/jnode/util/CounterGroup.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/util/CounterGroup.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -1,129 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003-2010 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.util; - -import java.util.Map; -import java.util.TreeMap; - -public class CounterGroup extends Statistic { - - /** - * All statistics - */ - private transient Map<String, Statistic> statistics; - - /** - * @param name - * @param description - */ - public CounterGroup(String name, String description) { - super(name, description); - } - - /** - * @param name - */ - public CounterGroup(String name) { - super(name); - } - - /** - * @see org.jnode.util.Statistic#getValue() - */ - @Override - public Object getValue() { - return statistics; - } - - /** - * @see org.jnode.util.Statistic#toString() - */ - @Override - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append(getName()); - sb.append(" {"); - if (statistics != null) { - for (Statistic s : statistics.values()) { - sb.append('\n'); - sb.append(s); - } - } - sb.append("}"); - return sb.toString(); - } - - /** - * Gets of create a counter with a given name. - * - * @param name - * @return The counter - */ - public final Counter getCounter(String name) { - Counter cnt = (Counter) getStatistic(name); - if (cnt == null) { - synchronized (this) { - cnt = (Counter) getStatistic(name); - if (cnt == null) { - cnt = new Counter(name, name); - addStatistic(name, cnt); - } - } - } - return cnt; - } - - /** - * Gets of create a counter group with a given name. - * - * @param name - * @return The counter group - */ - public final CounterGroup getCounterGroup(String name) { - CounterGroup cnt = (CounterGroup) getStatistic(name); - if (cnt == null) { - synchronized (this) { - cnt = (CounterGroup) getStatistic(name); - if (cnt == null) { - cnt = new CounterGroup(name, name); - addStatistic(name, cnt); - } - } - } - return cnt; - } - - private Statistic getStatistic(String name) { - if (statistics != null) { - return statistics.get(name); - } else { - return null; - } - } - - private void addStatistic(String name, Statistic stat) { - if (statistics == null) { - statistics = new TreeMap<String, Statistic>(); - } - statistics.put(name, stat); - } - -} Deleted: trunk/core/src/core/org/jnode/util/Statistic.java =================================================================== --- trunk/core/src/core/org/jnode/util/Statistic.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/util/Statistic.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -1,71 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003-2010 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.util; - -import org.jnode.vm.VmSystemObject; - -/** - * @author epr - */ -public abstract class Statistic extends VmSystemObject { - - private final String name; - private final String description; - - public Statistic(String name) { - this(name, null); - } - - public Statistic(String name, String description) { - this.name = name; - this.description = description; - } - - public abstract Object getValue(); - - /** - * Gets the name of this statistic - * - * @return The name - */ - public String getName() { - return name; - } - - /** - * Convert to a String representation - * - * @return String - * @see java.lang.Object#toString() - */ - public String toString() { - return name; - } - - /** - * Gets the description of this statistic - * - * @return The description - */ - public String getDescription() { - return description; - } -} Deleted: trunk/core/src/core/org/jnode/util/Statistics.java =================================================================== --- trunk/core/src/core/org/jnode/util/Statistics.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/util/Statistics.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -1,36 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003-2010 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.util; - - -/** - * @author epr - */ -public interface Statistics { - - /** - * Gets all statistics - * - * @return All statistics - */ - public Statistic[] getStatistics(); - -} Deleted: trunk/core/src/core/org/jnode/util/SynchronizedCounter.java =================================================================== --- trunk/core/src/core/org/jnode/util/SynchronizedCounter.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/util/SynchronizedCounter.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -1,66 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003-2010 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.util; - -/** - * @author Ewout Prangsma (ep...@us...) - */ -public final class SynchronizedCounter extends Statistic { - private int counter; - - public SynchronizedCounter(String name) { - super(name, null); - } - - public SynchronizedCounter(String name, String description) { - super(name, description); - } - - /** - * Gets the counter of this statistic - * - * @return the counter - */ - public int get() { - return counter; - } - - public Object getValue() { - return counter; - } - - /** - * Increment the counter of this statistic by 1. - */ - public synchronized void inc() { - counter++; - } - - /** - * Convert to a String representation - * - * @return String - * @see java.lang.Object#toString() - */ - public String toString() { - return getName() + "=" + counter; - } -} Modified: trunk/core/src/core/org/jnode/util/TimeUtils.java =================================================================== --- trunk/core/src/core/org/jnode/util/TimeUtils.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/util/TimeUtils.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -20,7 +20,6 @@ package org.jnode.util; -import org.jnode.vm.VmSystem; /** @@ -43,21 +42,6 @@ } /** - * Wait for ms milliseconds in a busy waiting loop. - * This method is very CPU intensive, so be carefull. - * - * @param ms - */ - public static void loop(long ms) { - final long start = VmSystem.currentKernelMillis(); - while (true) { - if ((start + ms) <= VmSystem.currentKernelMillis()) { - break; - } - } - } - - /** * Converts Gregorian date to milliseconds since 1970-01-01 00:00:00 . * * @param year the year Modified: trunk/core/src/core/org/jnode/vm/InternString.java =================================================================== --- trunk/core/src/core/org/jnode/vm/InternString.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/InternString.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -20,7 +20,7 @@ package org.jnode.vm; -import org.jnode.util.BootableHashMap; +import org.jnode.vm.objects.BootableHashMap; /** * Modified: trunk/core/src/core/org/jnode/vm/Vm.java =================================================================== --- trunk/core/src/core/org/jnode/vm/Vm.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/Vm.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -31,11 +31,6 @@ import org.jnode.plugin.PluginDescriptor; import org.jnode.plugin.PluginRegistry; import org.jnode.system.ResourceManager; -import org.jnode.util.BootableArrayList; -import org.jnode.util.Counter; -import org.jnode.util.CounterGroup; -import org.jnode.util.Statistic; -import org.jnode.util.Statistics; import org.jnode.annotation.Inline; import org.jnode.annotation.Internal; import org.jnode.annotation.KernelSpace; @@ -48,6 +43,11 @@ import org.jnode.vm.classmgr.VmType; import org.jnode.vm.memmgr.HeapHelper; import org.jnode.vm.memmgr.VmHeapManager; +import org.jnode.vm.objects.BootableArrayList; +import org.jnode.vm.objects.Counter; +import org.jnode.vm.objects.CounterGroup; +import org.jnode.vm.objects.Statistic; +import org.jnode.vm.objects.Statistics; import org.jnode.vm.scheduler.VmProcessor; import org.jnode.vm.scheduler.VmScheduler; @@ -399,7 +399,7 @@ } /** - * @see org.jnode.util.Statistics#getStatistics() + * @see org.jnode.vm.objects.Statistics#getStatistics() */ public synchronized Statistic[] getStatistics() { if (statistics != null) { Modified: trunk/core/src/core/org/jnode/vm/VmSystem.java =================================================================== --- trunk/core/src/core/org/jnode/vm/VmSystem.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/VmSystem.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -1189,4 +1189,19 @@ throw new RuntimeException("IO Context cannot be reset"); } } + + /** + * Wait for ms milliseconds in a busy waiting loop. + * This method is very CPU intensive, so be carefull. + * + * @param ms + */ + public static void loop(long ms) { + final long start = currentKernelMillis(); + while (true) { + if ((start + ms) <= currentKernelMillis()) { + break; + } + } + } } Modified: trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java =================================================================== --- trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -36,7 +36,6 @@ import java.util.TreeMap; import org.jnode.assembler.ObjectResolver; -import org.jnode.util.BootableArrayList; import org.jnode.util.ByteBufferInputStream; import org.jnode.annotation.PrivilegedActionPragma; import org.jnode.vm.classmgr.ClassDecoder; @@ -50,6 +49,7 @@ import org.jnode.vm.compiler.IMTCompiler; import org.jnode.vm.compiler.NativeCodeCompiler; import org.jnode.vm.isolate.VmIsolate; +import org.jnode.vm.objects.BootableArrayList; import org.jnode.vm.scheduler.VmProcessor; /** Modified: trunk/core/src/core/org/jnode/vm/bytecode/BasicBlock.java =================================================================== --- trunk/core/src/core/org/jnode/vm/bytecode/BasicBlock.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/bytecode/BasicBlock.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -20,8 +20,9 @@ package org.jnode.vm.bytecode; -import org.jnode.util.BootableArrayList; import org.jnode.vm.VmSystemObject; +import org.jnode.vm.objects.BootableArrayList; + import java.util.Set; import java.util.HashSet; Modified: trunk/core/src/core/org/jnode/vm/classmgr/SelectorMap.java =================================================================== --- trunk/core/src/core/org/jnode/vm/classmgr/SelectorMap.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/classmgr/SelectorMap.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -20,9 +20,9 @@ package org.jnode.vm.classmgr; -import org.jnode.util.BootableHashMap; import org.jnode.vm.VmSystemObject; import org.jnode.vm.InternString; +import org.jnode.vm.objects.BootableHashMap; /** * This class is used to maintain a mapping between a method signature (name+type) Modified: trunk/core/src/core/org/jnode/vm/compiler/BaseMagicHelper.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/BaseMagicHelper.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/compiler/BaseMagicHelper.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -21,8 +21,8 @@ package org.jnode.vm.compiler; import org.jnode.annotation.SharedStatics; -import org.jnode.util.BootableHashMap; import org.jnode.vm.classmgr.VmMethod; +import org.jnode.vm.objects.BootableHashMap; /** * @author Ewout Prangsma (ep...@us...) Modified: trunk/core/src/core/org/jnode/vm/compiler/OptimizingBytecodeVisitor.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/OptimizingBytecodeVisitor.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/compiler/OptimizingBytecodeVisitor.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -20,7 +20,6 @@ package org.jnode.vm.compiler; -import org.jnode.util.Counter; import org.jnode.vm.JvmType; import org.jnode.vm.Vm; import org.jnode.vm.bytecode.BasicBlock; @@ -32,6 +31,7 @@ import org.jnode.vm.classmgr.VmMethod; import org.jnode.vm.classmgr.VmPrimitiveClass; import org.jnode.vm.classmgr.VmType; +import org.jnode.vm.objects.Counter; /** * @author Ewout Prangsma (ep...@us...) Modified: trunk/core/src/core/org/jnode/vm/compiler/ir/IRBasicBlock.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/ir/IRBasicBlock.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/compiler/ir/IRBasicBlock.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -22,10 +22,10 @@ import java.util.List; -import org.jnode.util.BootableArrayList; import org.jnode.vm.compiler.ir.quad.BranchQuad; import org.jnode.vm.compiler.ir.quad.PhiAssignQuad; import org.jnode.vm.compiler.ir.quad.Quad; +import org.jnode.vm.objects.BootableArrayList; /** * @author Madhu Siddalingaiah Modified: trunk/core/src/core/org/jnode/vm/compiler/ir/IRControlFlowGraph.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/ir/IRControlFlowGraph.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/compiler/ir/IRControlFlowGraph.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -23,7 +23,6 @@ import java.util.Iterator; import java.util.List; -import org.jnode.util.BootableArrayList; import org.jnode.util.ObjectArrayIterator; import org.jnode.vm.bytecode.BytecodeParser; import org.jnode.vm.classmgr.VmByteCode; @@ -31,6 +30,7 @@ import org.jnode.vm.compiler.ir.quad.PhiAssignQuad; import org.jnode.vm.compiler.ir.quad.Quad; import org.jnode.vm.compiler.ir.quad.VariableRefAssignQuad; +import org.jnode.vm.objects.BootableArrayList; /** * @author Madhu Siddalingaiah Modified: trunk/core/src/core/org/jnode/vm/compiler/ir/IRTest.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/ir/IRTest.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/compiler/ir/IRTest.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -33,13 +33,13 @@ import org.jnode.assembler.x86.X86Constants; import org.jnode.assembler.x86.X86Register; import org.jnode.assembler.x86.X86TextAssembler; -import org.jnode.util.BootableHashMap; import org.jnode.vm.VmSystemClassLoader; import org.jnode.vm.bytecode.BytecodeParser; import org.jnode.vm.classmgr.VmByteCode; import org.jnode.vm.classmgr.VmMethod; import org.jnode.vm.classmgr.VmType; import org.jnode.vm.compiler.ir.quad.Quad; +import org.jnode.vm.objects.BootableHashMap; import org.jnode.vm.x86.VmX86Architecture32; import org.jnode.vm.x86.X86CpuID; import org.jnode.vm.x86.compiler.l2.GenericX86CodeGenerator; Modified: trunk/core/src/core/org/jnode/vm/compiler/ir/LinearScanAllocator.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/ir/LinearScanAllocator.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/compiler/ir/LinearScanAllocator.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -25,7 +25,7 @@ import java.util.Comparator; import java.util.List; -import org.jnode.util.BootableArrayList; +import org.jnode.vm.objects.BootableArrayList; /** * @author Madhu Siddalingaiah Modified: trunk/core/src/core/org/jnode/vm/compiler/ir/PhiOperand.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/ir/PhiOperand.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/compiler/ir/PhiOperand.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -22,7 +22,7 @@ import java.util.List; -import org.jnode.util.BootableArrayList; +import org.jnode.vm.objects.BootableArrayList; /** * @author Madhu Siddalingaiah Modified: trunk/core/src/core/org/jnode/vm/compiler/ir/SSAStack.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/ir/SSAStack.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/compiler/ir/SSAStack.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -22,7 +22,7 @@ import java.util.List; -import org.jnode.util.BootableArrayList; +import org.jnode.vm.objects.BootableArrayList; /** * @author Madhu Siddalingaiah Modified: trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java =================================================================== --- trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2010-05-12 10:29:02 UTC (rev 5748) +++ trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -42,7 +42,6 @@ import javax.naming.NameNotFoundException; import org.jnode.naming.InitialNaming; import org.jnode.plugin.PluginManager; -import org.jnode.util.BootableHashMap; import org.jnode.vm.IOContext; import org.jnode.vm.ObjectVisitor; import org.jnode.vm.Unsafe; @@ -56,6 +55,7 @@ import org.jnode.annotation.SharedStatics; import org.jnode.vm.classmgr.VmIsolatedStatics; import org.jnode.vm.classmgr.VmType; +import org.jnode.vm.objects.BootableHashMap; import org.jnode.vm.scheduler.VmThread; /** Copied: trunk/core/src/core/org/jnode/vm/objects/BootableArrayList.java (from rev 5748, trunk/core/src/core/org/jnode/util/BootableArrayList.java) =================================================================== --- trunk/core/src/core/org/jnode/vm/objects/BootableArrayList.java (rev 0) +++ trunk/core/src/core/org/jnode/vm/objects/BootableArrayList.java 2010-05-12 10:31:48 UTC (rev 5749) @@ -0,0 +1,358 @@ +/* + * $Id$ + * + * Copyright (C) 2003-2010 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.vm.objects; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import java.util.RandomAccess; + +import org.jnode.vm.VmSystemObject; + +/** + * A BootableList is a List implementation that can be used in the + * build process of JNode. + * Using this class, instead of e.g. ArrayList, will avoid class incompatibilities + * between the JNode java.util implementation and Sun's implementation. + * + * @author epr + */ +public class BootableArrayList<T> extends VmSystemObject implements List<T>, RandomAccess { + + private ArrayList<T> listCache; + private T[] array; + private int hashCode; + private transient boolean locked; + + /** + * Constructs an empty list with an initial capacity of ten. + */ + public BootableArrayList() { + hashCode = super.hashCode(); + } + + /** + * Constructs a list containing the elements of the specified collection, + * in the order they are returned by the collection's iterator. + * + * @param c + */ + public BootableArrayList(Collection<? extends T> c) { + addAll(c); + } + + /** + * Constructs an empty list with an initial capacity of ten. + * + * @param initialCapacity + */ + public BootableArrayList(int initialCapacity) { + listCache = new ArrayList<T>(initialCapacity); + hashCode = listCache.hashCode(); + } + + /** + * Gets (an if needed reload) the arraylist. + * + * @return + */ + private final ArrayList<T> getListCache() { + if (locked) { + throw new RuntimeException("Cannot change a locked BootableArrayList"); + } + if (listCache == null) { + listCache = new ArrayList<T>(); + if (array != null) { + listCache.addAll(Arrays.asList(array)); + } + array = null; + } + return listCache; + } + + /** + * @param index + * @param o + * @see java.util.AbstractList#add(int, java.lang.Object) + */ + public void add(int index, T o) { + getListCache().add(index, o); + } + + /** + * @param o + * @return boolean + * @see java.util.AbstractList#add(java.lang.Object) + */ + public boolean add(T o) { + return getListCache().add(o); + } + + /** + * @param c + * @return boolean + * @see java.util.AbstractCollection#addAll(java.util.Collection) + */ + public boolean addAll(Collection<? extends T> c) { + return getListCache().addAll(c); + } + + /** + * @param index + * @param c + * @return boolean + * @see java.util.AbstractList#addAll(int, java.util.Collection) + */ + public boolean addAll(int index, Collection<? extends T> c) { + return getListCache().addAll(index, c); + } + + /** + * @see java.util.AbstractList#clear() + */ + public void clear() { + getListCache().clear(); + } + + /** + * @param o + * @return boolean + * @see java.util.AbstractCollection#contains(java.lang.Object) + */ + public boolean contains(Object o) { + return getListCache().contains(o); + } + + /** + * @param c + * @return boolean + * @see java.util.AbstractCollection#containsAll(java.util.Collection) + */ + public boolean containsAll(Collection c) { + return getListCache().containsAll(c); + } + + /** + * @param minCapacity + */ + public void ensureCapacity(int minCapacity) { + getListCache().ensureCapacity(minCapacity); + } + + /** + * @param obj + * @return boolean + * @see java.util.AbstractList#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + return getListCache().equals(obj); + } + + /** + * @return int + * @see java.util.AbstractList#hashCode() + */ + public int hashCode() { + if (listCache != null) { + return getListCache().hashCode(); + } else { + return hashCode; + } + } + + /** + * @param o + * @return int + * @see java.util.AbstractList#indexOf(java.lang.Object) + */ + public int indexOf(Object o) { + return getListCache().indexOf(o); + } + + /** + * @return boolean + * @see java.util.AbstractCollection#isEmpty() + */ + public boolean isEmpty() { + return getListCache().isEmpty(); + } + + /** + * @return the iterator + * @see java.util.AbstractList#iterator() + */ + public Iterator<T> iterator() { + return getListCache().iterator(); + } + + /** + * @param o + * @return int + * @see java.util.AbstractList#lastIndexOf(java.lang.Object) + */ + public int lastIndexOf(Object o) { + return getListCache().lastIndexOf(o); + } + + /** + * @return the iterator + * @see java.util.AbstractList#listIterator() + */ + public ListIterator<T> listIterator() { + return getListCache().listIterator(); + } + + /** + * @param index + * @return the iterator + * @see java.util.AbstractList#listIterator(int) + */ + public ListIterator<T> listIterator(int index) { + return getListCache().listIterator(index); + } + + /** + * @param index + * @return object + * @see java.util.AbstractList#remove(int) + */ + public T remove(int index) { + return getListCache().remove(index); + } + + /** + * @param o + * @return boolean + * @see java.util.AbstractCollection#remove(java.lang.Object) + */ + public boolean remove(Object o) { + return getListCache().remove(o); + } + + /** + * @param c + * @return boolean + * @see java.util.AbstractCollection#removeAll(java.util.Collection) + */ + public boolean removeAll(Collection<?> c) { + return getListCache().removeAll(c); + } + + /** + * @param c + * @return boolean + * @see java.util.AbstractCollection#retainAll(java.util.Collection) + */ + public boolean retainAll(Collection c) { + return getListCache().retainAll(c); + } + + /** + * @param index + * @param o + * @return object + * @see java.util.AbstractList#set(int, java.lang.Object) + */ + public T set(int index, T o) { + return getListCache().set(index, o); + } + + /** + * @param fromIndex + * @param toIndex + * @return the sub list + * @see java.util.AbstractList#subList(int, int) + */ + public List<T> subList(int fromIndex, int toIndex) { + return getListCache().subList(fromIndex, toIndex); + } + + /** + * @return the array + * @see java.util.AbstractCollection#toArray() + */ + public Object[] toArray() { + return getListCache().toArray(); + } + + /** + * @param a + * @return the array + * @see java.util.AbstractCollection#toArray(java.lang.Object[]) + */ + public <E> E[] toArray(E[] a) { + return getListCache().toArray(a); + } + + /** + * @return String + * @see java.util.AbstractCollection#toString() + */ + public String toString() { + if (listCache != null) { + return getListCache().toString(); + } else { + return super.toString(); + } + } + + /** + * + */ + public void trimToSize() { + getListCache().trimToSize(); + } + + /** + * @param index + * @return The element at the given index + */ + public T get(int index) { + return getListCache().get(index); + } + + /** + * @return The number of elements in this list + */ + public int size() { + return getListCache().size(); + } + + /** + * @see org.jnode.vm.VmSystemObject#verifyBeforeEmit() + */ + @SuppressWarnings("unchecked") + public void verifyBeforeEmit() { + super.verifyBeforeEmit(); + if (listCache != null) { + array = (T[]) listCache.toArray(); + hashCode = listCache.hashCode(); + } else { + array = null; + } + listCache = null; + locked = true; + } + +} Copied: trunk/core/src/core/org/jnode/vm/objects/BootableHashMap.java (from rev 5748, trunk/core/src/core/org/jnode/util/BootableHashMap.java) =================================================================== --- trunk/core/src/core/org/jnode/vm/objects/BootableHashMap.java (rev 0) +++ trunk/core/sr... [truncated message content] |
From: <fd...@us...> - 2010-05-12 10:29:08
|
Revision: 5748 http://jnode.svn.sourceforge.net/jnode/?rev=5748&view=rev Author: fduminy Date: 2010-05-12 10:29:02 +0000 (Wed, 12 May 2010) Log Message: ----------- removed depencency between Plugin and PluginDescriptorModel by using PluginDescriptor interface instead Signed-off-by: Fabien DUMINY <fab...@we...> Modified Paths: -------------- trunk/core/src/core/org/jnode/plugin/Plugin.java trunk/core/src/core/org/jnode/plugin/PluginDescriptor.java trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java trunk/core/src/emu/org/jnode/emu/plugin/model/DummyPluginDescriptor.java Modified: trunk/core/src/core/org/jnode/plugin/Plugin.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/Plugin.java 2010-05-12 10:28:24 UTC (rev 5747) +++ trunk/core/src/core/org/jnode/plugin/Plugin.java 2010-05-12 10:29:02 UTC (rev 5748) @@ -24,7 +24,6 @@ import java.security.PrivilegedAction; import java.util.prefs.Preferences; -import org.jnode.plugin.model.PluginDescriptorModel; import org.jnode.system.BootLog; @@ -109,7 +108,7 @@ try { startPlugin(); } finally { - ((PluginDescriptorModel) descriptor).firePluginStarted(); + descriptor.firePluginStarted(); } } catch (PluginException ex) { throw ex; @@ -134,7 +133,7 @@ started = false; try { try { - ((PluginDescriptorModel) descriptor).firePluginStop(); + descriptor.firePluginStopped(); } finally { stopPlugin(); } Modified: trunk/core/src/core/org/jnode/plugin/PluginDescriptor.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/PluginDescriptor.java 2010-05-12 10:28:24 UTC (rev 5747) +++ trunk/core/src/core/org/jnode/plugin/PluginDescriptor.java 2010-05-12 10:29:02 UTC (rev 5748) @@ -20,7 +20,10 @@ package org.jnode.plugin; +import java.util.ArrayList; +import java.util.List; + /** * Descriptor of a Plugin. * @@ -212,4 +215,14 @@ * @param listener */ public void removeListener(PluginDescriptorListener listener); + + /** + * Fire the pluginStarted event to this descriptor's listeners. + */ + public void firePluginStarted(); + + /** + * Fire the pluginStopped event to this descriptor's listeners. + */ + public void firePluginStopped(); } Modified: trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java 2010-05-12 10:28:24 UTC (rev 5747) +++ trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java 2010-05-12 10:29:02 UTC (rev 5748) @@ -294,7 +294,7 @@ } /** - * Fire the pluginStarted event to my listeners. + * {@inheritDoc} */ public final void firePluginStarted() { final List<PluginDescriptorListener> listeners; @@ -312,9 +312,9 @@ } /** - * Fire the pluginStop event to my listeners. + * {@inheritDoc} */ - public final void firePluginStop() { + public final void firePluginStopped() { final List<PluginDescriptorListener> listeners; synchronized (listenerLock) { if (this.listeners != null) { Modified: trunk/core/src/emu/org/jnode/emu/plugin/model/DummyPluginDescriptor.java =================================================================== --- trunk/core/src/emu/org/jnode/emu/plugin/model/DummyPluginDescriptor.java 2010-05-12 10:28:24 UTC (rev 5747) +++ trunk/core/src/emu/org/jnode/emu/plugin/model/DummyPluginDescriptor.java 2010-05-12 10:29:02 UTC (rev 5748) @@ -163,4 +163,12 @@ public PluginReference getPluginReference() { return null; } + + @Override + public void firePluginStarted() { + } + + @Override + public void firePluginStopped() { + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fd...@us...> - 2010-05-12 10:28:30
|
Revision: 5747 http://jnode.svn.sourceforge.net/jnode/?rev=5747&view=rev Author: fduminy Date: 2010-05-12 10:28:24 +0000 (Wed, 12 May 2010) Log Message: ----------- removed dependencies on PluginRegistryModel by using PluginRegistry interface instead Signed-off-by: Fabien DUMINY <fab...@we...> Modified Paths: -------------- trunk/cli/src/commands/org/jnode/command/system/PluginCommand.java trunk/core/src/core/org/jnode/boot/InitJarProcessor.java trunk/core/src/core/org/jnode/boot/Main.java trunk/core/src/core/org/jnode/plugin/PluginRegistry.java trunk/core/src/core/org/jnode/plugin/model/PluginRegistryModel.java trunk/shell/src/test/org/jnode/test/shell/harness/TestRunnerBase.java Modified: trunk/cli/src/commands/org/jnode/command/system/PluginCommand.java =================================================================== --- trunk/cli/src/commands/org/jnode/command/system/PluginCommand.java 2010-04-03 19:17:29 UTC (rev 5746) +++ trunk/cli/src/commands/org/jnode/command/system/PluginCommand.java 2010-05-12 10:28:24 UTC (rev 5747) @@ -147,7 +147,7 @@ } private void loadPlugin(String id, String version) throws PluginException { - mgr.getRegistry().loadPlugin(mgr.getLoaderManager(), id, version); + mgr.getRegistry().loadPlugin(mgr.getLoaderManager(), id, version, true); //resolve=true out.format(fmt_load, id, version); } @@ -156,11 +156,11 @@ final List<PluginReference> refs = reg.unloadPlugin(id); for (PluginReference ref : refs) { if (reg.getPluginDescriptor(ref.getId()) == null) { - reg.loadPlugin(mgr.getLoaderManager(), ref.getId(), ref.getVersion()); + reg.loadPlugin(mgr.getLoaderManager(), ref.getId(), ref.getVersion(), true); //resolve=true } } if (reg.getPluginDescriptor(id) == null) { - reg.loadPlugin(mgr.getLoaderManager(), id, version); + reg.loadPlugin(mgr.getLoaderManager(), id, version, true); //resolve=true } out.format(fmt_reload, id, version); } Modified: trunk/core/src/core/org/jnode/boot/InitJarProcessor.java =================================================================== --- trunk/core/src/core/org/jnode/boot/InitJarProcessor.java 2010-04-03 19:17:29 UTC (rev 5746) +++ trunk/core/src/core/org/jnode/boot/InitJarProcessor.java 2010-05-12 10:28:24 UTC (rev 5747) @@ -33,7 +33,7 @@ import org.jnode.plugin.PluginDescriptor; import org.jnode.plugin.PluginException; import org.jnode.plugin.PluginLoader; -import org.jnode.plugin.model.PluginRegistryModel; +import org.jnode.plugin.PluginRegistry; import org.jnode.system.BootLog; import org.jnode.system.MemoryResource; import org.jnode.util.JarBuffer; @@ -72,7 +72,7 @@ * * @param piRegistry */ - public List<PluginDescriptor> loadPlugins(PluginRegistryModel piRegistry) { + public List<PluginDescriptor> loadPlugins(PluginRegistry piRegistry) { if (jbuf == null) { return null; } @@ -86,7 +86,7 @@ // Load it loader.setBuffer(entry.getValue()); final PluginDescriptor descr = piRegistry.loadPlugin( - loader, "", "", false); + loader, "", "", false); //resolve=false descriptors.add(descr); } catch (PluginException ex) { BootLog.error("Cannot load " + name, ex); Modified: trunk/core/src/core/org/jnode/boot/Main.java =================================================================== --- trunk/core/src/core/org/jnode/boot/Main.java 2010-04-03 19:17:29 UTC (rev 5746) +++ trunk/core/src/core/org/jnode/boot/Main.java 2010-05-12 10:28:24 UTC (rev 5747) @@ -23,16 +23,16 @@ import java.lang.reflect.Method; import java.util.List; +import org.jnode.annotation.LoadStatics; +import org.jnode.annotation.SharedStatics; +import org.jnode.annotation.Uninterruptible; import org.jnode.plugin.PluginDescriptor; import org.jnode.plugin.PluginManager; +import org.jnode.plugin.PluginRegistry; import org.jnode.plugin.manager.DefaultPluginManager; -import org.jnode.plugin.model.PluginRegistryModel; import org.jnode.system.BootLog; import org.jnode.vm.Unsafe; import org.jnode.vm.VmSystem; -import org.jnode.annotation.LoadStatics; -import org.jnode.annotation.SharedStatics; -import org.jnode.annotation.Uninterruptible; /** * First class that is executed when JNode boots. @@ -49,7 +49,7 @@ /** * Initialized in org.jnode.build.x86.BootImageBuilder.initMain(). */ - private static PluginRegistryModel pluginRegistry; + private static PluginRegistry pluginRegistry; /** * First java entry point after the assembler kernel has booted. Modified: trunk/core/src/core/org/jnode/plugin/PluginRegistry.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/PluginRegistry.java 2010-04-03 19:17:29 UTC (rev 5746) +++ trunk/core/src/core/org/jnode/plugin/PluginRegistry.java 2010-05-12 10:28:24 UTC (rev 5747) @@ -59,10 +59,11 @@ * @param loader * @param pluginId * @param pluginVersion + * @param resolve true to resolve the plugin dependencies, false otherwise * @return The descriptor of the loaded plugin. * @throws PluginException */ - public PluginDescriptor loadPlugin(PluginLoader loader, String pluginId, String pluginVersion) + public PluginDescriptor loadPlugin(PluginLoader loader, String pluginId, String pluginVersion, boolean resolve) throws PluginException; /** Modified: trunk/core/src/core/org/jnode/plugin/model/PluginRegistryModel.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/model/PluginRegistryModel.java 2010-04-03 19:17:29 UTC (rev 5746) +++ trunk/core/src/core/org/jnode/plugin/model/PluginRegistryModel.java 2010-05-12 10:28:24 UTC (rev 5747) @@ -288,29 +288,27 @@ } /** - * Load a plugin from a given loader. - * - * @param loader - * @param pluginId - * @param pluginVersion - * @return The descriptor of the loaded plugin. - * @throws PluginException + * {@inheritDoc} */ - public PluginDescriptor loadPlugin(final PluginLoader loader, final String pluginId, final String pluginVersion) + public PluginDescriptor loadPlugin(final PluginLoader loader, final String pluginId, final String pluginVersion, boolean resolve) throws PluginException { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(PluginSecurityConstants.LOAD_PERM); } // Load the requested plugin - final HashMap<String, PluginDescriptorModel> descriptors = new HashMap<String, PluginDescriptorModel>(); - final PluginDescriptorModel descr = loadPlugin(loader, pluginId, pluginVersion, false); - descriptors.put(descr.getId(), descr); - // Load the dependent plugins - loadDependencies(loader, descr, descriptors); - - // Resolve the loaded descriptors. - resolveDescriptors(descriptors.values()); + final PluginDescriptorModel descr = loadPluginImpl(loader, pluginId, pluginVersion); + + if (resolve) { + final HashMap<String, PluginDescriptorModel> descriptors = new HashMap<String, PluginDescriptorModel>(); + descriptors.put(descr.getId(), descr); + // Load the dependent plugins + loadDependencies(loader, descr, descriptors); + + // Resolve the loaded descriptors. + resolveDescriptors(descriptors.values()); + } + return descr; } @@ -343,13 +341,13 @@ if (descriptors.containsKey(id)) { return; } - final PluginDescriptorModel descr = loadPlugin(loader, id, version, false); + final PluginDescriptorModel descr = loadPluginImpl(loader, id, version); descriptors.put(descr.getId(), descr); loadDependencies(loader, descr, descriptors); } /** - * Load a plugin from a given loader. + * Load a plugin from a given loader but doesn't resolve its dependencies. * * @param loader * @param pluginId @@ -357,12 +355,8 @@ * @return The descriptor of the loaded plugin. * @throws PluginException */ - public PluginDescriptorModel loadPlugin(final PluginLoader loader, final String pluginId, - final String pluginVersion, boolean resolve) throws PluginException { - final SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(PluginSecurityConstants.LOAD_PERM); - } + private final PluginDescriptorModel loadPluginImpl(final PluginLoader loader, final String pluginId, + final String pluginVersion) throws PluginException { final PluginRegistryModel registry = this; final PluginJar pluginJar; try { @@ -386,11 +380,7 @@ throw new PluginException(ex); } } - final PluginDescriptorModel descr = pluginJar.getDescriptorModel(); - if (resolve) { - descr.resolve(this); - } - return descr; + return pluginJar.getDescriptorModel(); } /** Modified: trunk/shell/src/test/org/jnode/test/shell/harness/TestRunnerBase.java =================================================================== --- trunk/shell/src/test/org/jnode/test/shell/harness/TestRunnerBase.java 2010-04-03 19:17:29 UTC (rev 5746) +++ trunk/shell/src/test/org/jnode/test/shell/harness/TestRunnerBase.java 2010-05-12 10:28:24 UTC (rev 5747) @@ -225,7 +225,7 @@ PluginManager mgr = InitialNaming.lookup(PluginManager.NAME); PluginRegistry reg = mgr.getRegistry(); if (reg.getPluginDescriptor(id) == null) { - reg.loadPlugin(mgr.getLoaderManager(), id, ver); + reg.loadPlugin(mgr.getLoaderManager(), id, ver, true); //resolve=true } } catch (Exception ex) { System.out.println(ex.getMessage()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fd...@us...> - 2010-04-03 19:17:35
|
Revision: 5746 http://jnode.svn.sourceforge.net/jnode/?rev=5746&view=rev Author: fduminy Date: 2010-04-03 19:17:29 +0000 (Sat, 03 Apr 2010) Log Message: ----------- removed unused BaseMagicHelper.MagicClass and updated javadoc pointing to it Modified Paths: -------------- trunk/core/src/core/org/jnode/vm/VmMagic.java trunk/core/src/core/org/jnode/vm/compiler/BaseMagicHelper.java trunk/core/src/vmmagic/org/vmmagic/unboxed/Address.java trunk/core/src/vmmagic/org/vmmagic/unboxed/AddressArray.java trunk/core/src/vmmagic/org/vmmagic/unboxed/Extent.java trunk/core/src/vmmagic/org/vmmagic/unboxed/ExtentArray.java trunk/core/src/vmmagic/org/vmmagic/unboxed/ObjectReference.java trunk/core/src/vmmagic/org/vmmagic/unboxed/ObjectReferenceArray.java trunk/core/src/vmmagic/org/vmmagic/unboxed/Offset.java trunk/core/src/vmmagic/org/vmmagic/unboxed/OffsetArray.java trunk/core/src/vmmagic/org/vmmagic/unboxed/Word.java trunk/core/src/vmmagic/org/vmmagic/unboxed/WordArray.java Modified: trunk/core/src/core/org/jnode/vm/VmMagic.java =================================================================== --- trunk/core/src/core/org/jnode/vm/VmMagic.java 2010-04-03 18:01:32 UTC (rev 5745) +++ trunk/core/src/core/org/jnode/vm/VmMagic.java 2010-04-03 19:17:29 UTC (rev 5746) @@ -36,9 +36,9 @@ * Methods in this class can also be called from inside JNode. * * @author Ewout Prangsma (ep...@us...) - * @see {@link org.jnode.vm.compiler.BaseMagicHelper.MagicClass} to get the list of "magic" classes - * (including this class). - * @see {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod} to get the list of "magic" methods. + * @see {@link org.jnode.classmgr.VmType VmType} to get the list of "magic" classes + * @see {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod MagicMethod} + * to get the list of "magic" methods */ @MagicPermission public final class VmMagic { Modified: trunk/core/src/core/org/jnode/vm/compiler/BaseMagicHelper.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/BaseMagicHelper.java 2010-04-03 18:01:32 UTC (rev 5745) +++ trunk/core/src/core/org/jnode/vm/compiler/BaseMagicHelper.java 2010-04-03 19:17:29 UTC (rev 5746) @@ -20,12 +20,9 @@ package org.jnode.vm.compiler; -import java.util.Map; - +import org.jnode.annotation.SharedStatics; import org.jnode.util.BootableHashMap; import org.jnode.vm.classmgr.VmMethod; -import org.jnode.vm.classmgr.VmType; -import org.jnode.annotation.SharedStatics; /** * @author Ewout Prangsma (ep...@us...) @@ -33,71 +30,6 @@ public class BaseMagicHelper { /** - * Enum of all magic classes. - * - * @author Ewout Prangsma (ep...@us...) - */ - @SharedStatics - public enum MagicClass { - ADDRESS("org.vmmagic.unboxed.Address"), - EXTENT("org.vmmagic.unboxed.Extent"), - OBJECTREFERENCE("org.vmmagic.unboxed.ObjectReference"), - OFFSET("org.vmmagic.unboxed.Offset"), - WORD("org.vmmagic.unboxed.Word"), - ADDRESSARRAY("org.vmmagic.unboxed.AddressArray"), - EXTENTARRAY("org.vmmagic.unboxed.ExtentArray"), - OBJECTREFERENCEARRAY("org.vmmagic.unboxed.ObjectReferenceArray"), - OFFSETARRAY("org.vmmagic.unboxed.OffsetArray"), - WORDARRAY("org.vmmagic.unboxed.WordArray"), - VMMAGIC("org.jnode.vm.VmMagic"); - - /** - * Name of the class - */ - private final String name; - - /** - * Lookup table - */ - private static final Map<String, MagicClass> nameToClass; - - /** - * Initialize this instance. - * - * @param name - */ - private MagicClass(String name) { - this.name = name; - } - - /** - * Initialize the lookup table - */ - static { - nameToClass = new BootableHashMap<String, MagicClass>(); - for (MagicClass mc : values()) { - nameToClass.put(mc.name, mc); - } - } - - /** - * Gets the MagicClass instance for the given type. - * - * @param type - * @return a MagicClass instance - * @throws InternalError When type is no magic type. - */ - public static MagicClass get(VmType<?> type) { - MagicClass mc = nameToClass.get(type.getName()); - if (mc == null) { - throw new InternalError("Unknown magic type " + type.getName()); - } else { - return mc; - } - } - } - - /** * Enum of all methods in all magic classes. * * @author Ewout Prangsma (ep...@us...) Modified: trunk/core/src/vmmagic/org/vmmagic/unboxed/Address.java =================================================================== --- trunk/core/src/vmmagic/org/vmmagic/unboxed/Address.java 2010-04-03 18:01:32 UTC (rev 5745) +++ trunk/core/src/vmmagic/org/vmmagic/unboxed/Address.java 2010-04-03 19:17:29 UTC (rev 5746) @@ -14,6 +14,7 @@ package org.vmmagic.unboxed; import org.jnode.vm.VmAddress; +import org.jnode.vm.classmgr.VmType; import org.jnode.annotation.KernelSpace; import org.jnode.annotation.Uninterruptible; @@ -22,12 +23,10 @@ * <p/> * <u>JNode specific notes</u> : This class contains some "magic" * methods that are interpreted by the VM itself, instead of being executed - * as normal java methods. The actual method bodies are not used. <br/> - * For further details, see the - * {@link org.jnode.vm.compiler.BaseMagicHelper.MagicClass list of "magic" classes} - * and the - * {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod list of "magic" methods}. - * + * as normal java methods. <b>The actual method bodies are never used</b>. + * @see {@link org.jnode.classmgr.VmType VmType} to get the list of "magic" classes + * @see {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod MagicMethod} + * to get the list of "magic" methods * @author Daniel Frampton */ public final class Address implements UnboxedObject { Modified: trunk/core/src/vmmagic/org/vmmagic/unboxed/AddressArray.java =================================================================== --- trunk/core/src/vmmagic/org/vmmagic/unboxed/AddressArray.java 2010-04-03 18:01:32 UTC (rev 5745) +++ trunk/core/src/vmmagic/org/vmmagic/unboxed/AddressArray.java 2010-04-03 19:17:29 UTC (rev 5746) @@ -14,8 +14,12 @@ package org.vmmagic.unboxed; /** - * Commenting required - * + * <u>JNode specific notes</u> : This class contains some "magic" + * methods that are interpreted by the VM itself, instead of being executed + * as normal java methods. <b>The actual method bodies are never used</b>. + * @see {@link org.jnode.classmgr.VmType VmType} to get the list of "magic" classes + * @see {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod MagicMethod} + * to get the list of "magic" methods * @author Daniel Frampton */ final public class AddressArray { Modified: trunk/core/src/vmmagic/org/vmmagic/unboxed/Extent.java =================================================================== --- trunk/core/src/vmmagic/org/vmmagic/unboxed/Extent.java 2010-04-03 18:01:32 UTC (rev 5745) +++ trunk/core/src/vmmagic/org/vmmagic/unboxed/Extent.java 2010-04-03 19:17:29 UTC (rev 5746) @@ -16,12 +16,10 @@ /** * <u>JNode specific notes</u> : This class contains some "magic" * methods that are interpreted by the VM itself, instead of being executed - * as normal java methods. The actual method bodies are not used. <br/> - * For further details, see the - * {@link org.jnode.vm.compiler.BaseMagicHelper.MagicClass list of "magic" classes} - * and the - * {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod list of "magic" methods}. - * + * as normal java methods. <b>The actual method bodies are never used</b>. + * @see {@link org.jnode.classmgr.VmType VmType} to get the list of "magic" classes + * @see {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod MagicMethod} + * to get the list of "magic" methods * @author Daniel Frampton */ public final class Extent implements UnboxedObject { Modified: trunk/core/src/vmmagic/org/vmmagic/unboxed/ExtentArray.java =================================================================== --- trunk/core/src/vmmagic/org/vmmagic/unboxed/ExtentArray.java 2010-04-03 18:01:32 UTC (rev 5745) +++ trunk/core/src/vmmagic/org/vmmagic/unboxed/ExtentArray.java 2010-04-03 19:17:29 UTC (rev 5746) @@ -14,8 +14,12 @@ package org.vmmagic.unboxed; /** - * Commenting required - * + * <u>JNode specific notes</u> : This class contains some "magic" + * methods that are interpreted by the VM itself, instead of being executed + * as normal java methods. <b>The actual method bodies are never used</b>. + * @see {@link org.jnode.classmgr.VmType VmType} to get the list of "magic" classes + * @see {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod MagicMethod} + * to get the list of "magic" methods * @author Daniel Frampton */ final public class ExtentArray { Modified: trunk/core/src/vmmagic/org/vmmagic/unboxed/ObjectReference.java =================================================================== --- trunk/core/src/vmmagic/org/vmmagic/unboxed/ObjectReference.java 2010-04-03 18:01:32 UTC (rev 5745) +++ trunk/core/src/vmmagic/org/vmmagic/unboxed/ObjectReference.java 2010-04-03 19:17:29 UTC (rev 5746) @@ -23,7 +23,13 @@ * distinction between objects the VM is written in, and objects that the VM is * managing. No operations that can not be completed in pure Java should be * allowed on Object. - * + * <br/><br/> + * <u>JNode specific notes</u> : This class contains some "magic" + * methods that are interpreted by the VM itself, instead of being executed + * as normal java methods. <b>The actual method bodies are never used</b>. + * @see {@link org.jnode.classmgr.VmType VmType} to get the list of "magic" classes + * @see {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod MagicMethod} + * to get the list of "magic" methods * @author Daniel Frampton */ public final class ObjectReference implements Uninterruptible { Modified: trunk/core/src/vmmagic/org/vmmagic/unboxed/ObjectReferenceArray.java =================================================================== --- trunk/core/src/vmmagic/org/vmmagic/unboxed/ObjectReferenceArray.java 2010-04-03 18:01:32 UTC (rev 5745) +++ trunk/core/src/vmmagic/org/vmmagic/unboxed/ObjectReferenceArray.java 2010-04-03 19:17:29 UTC (rev 5746) @@ -14,8 +14,12 @@ package org.vmmagic.unboxed; /** - * Commenting required - * + * <u>JNode specific notes</u> : This class contains some "magic" + * methods that are interpreted by the VM itself, instead of being executed + * as normal java methods. <b>The actual method bodies are never used</b>. + * @see {@link org.jnode.classmgr.VmType VmType} to get the list of "magic" classes + * @see {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod MagicMethod} + * to get the list of "magic" methods * @author Daniel Frampton */ final public class ObjectReferenceArray { Modified: trunk/core/src/vmmagic/org/vmmagic/unboxed/Offset.java =================================================================== --- trunk/core/src/vmmagic/org/vmmagic/unboxed/Offset.java 2010-04-03 18:01:32 UTC (rev 5745) +++ trunk/core/src/vmmagic/org/vmmagic/unboxed/Offset.java 2010-04-03 19:17:29 UTC (rev 5746) @@ -17,12 +17,10 @@ * <p/> * <u>JNode specific notes</u> : This class contains some "magic" * methods that are interpreted by the VM itself, instead of being executed - * as normal java methods. The actual method bodies are not used. <br/> - * For further details, see the - * {@link org.jnode.vm.compiler.BaseMagicHelper.MagicClass list of "magic" classes} - * and the - * {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod list of "magic" methods}. - * + * as normal java methods. <b>The actual method bodies are never used</b>. + * @see {@link org.jnode.classmgr.VmType VmType} to get the list of "magic" classes + * @see {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod MagicMethod} + * to get the list of "magic" methods * @author Ewout Prangsma (ep...@us...) * @author Daniel Frampton */ Modified: trunk/core/src/vmmagic/org/vmmagic/unboxed/OffsetArray.java =================================================================== --- trunk/core/src/vmmagic/org/vmmagic/unboxed/OffsetArray.java 2010-04-03 18:01:32 UTC (rev 5745) +++ trunk/core/src/vmmagic/org/vmmagic/unboxed/OffsetArray.java 2010-04-03 19:17:29 UTC (rev 5746) @@ -14,8 +14,12 @@ package org.vmmagic.unboxed; /** - * Commenting required - * + * <u>JNode specific notes</u> : This class contains some "magic" + * methods that are interpreted by the VM itself, instead of being executed + * as normal java methods. <b>The actual method bodies are never used</b>. + * @see {@link org.jnode.classmgr.VmType VmType} to get the list of "magic" classes + * @see {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod MagicMethod} + * to get the list of "magic" methods * @author Daniel Frampton */ final public class OffsetArray { Modified: trunk/core/src/vmmagic/org/vmmagic/unboxed/Word.java =================================================================== --- trunk/core/src/vmmagic/org/vmmagic/unboxed/Word.java 2010-04-03 18:01:32 UTC (rev 5745) +++ trunk/core/src/vmmagic/org/vmmagic/unboxed/Word.java 2010-04-03 19:17:29 UTC (rev 5746) @@ -20,12 +20,10 @@ * <p/> * <u>JNode specific notes</u> : This class contains some "magic" * methods that are interpreted by the VM itself, instead of being executed - * as normal java methods. The actual method bodies are not used. <br/> - * For further details, see the - * {@link org.jnode.vm.compiler.BaseMagicHelper.MagicClass list of "magic" classes} - * and the - * {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod list of "magic" methods}. - * + * as normal java methods. <b>The actual method bodies are never used</b>. + * @see {@link org.jnode.classmgr.VmType VmType} to get the list of "magic" classes + * @see {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod MagicMethod} + * to get the list of "magic" methods * @author Ewout Prangsma (ep...@us...) * @author Daniel Frampton * @see Address Modified: trunk/core/src/vmmagic/org/vmmagic/unboxed/WordArray.java =================================================================== --- trunk/core/src/vmmagic/org/vmmagic/unboxed/WordArray.java 2010-04-03 18:01:32 UTC (rev 5745) +++ trunk/core/src/vmmagic/org/vmmagic/unboxed/WordArray.java 2010-04-03 19:17:29 UTC (rev 5746) @@ -14,8 +14,12 @@ package org.vmmagic.unboxed; /** - * Commenting required - * + * <u>JNode specific notes</u> : This class contains some "magic" + * methods that are interpreted by the VM itself, instead of being executed + * as normal java methods. <b>The actual method bodies are never used</b>. + * @see {@link org.jnode.classmgr.VmType VmType} to get the list of "magic" classes + * @see {@link org.jnode.vm.compiler.BaseMagicHelper.MagicMethod MagicMethod} + * to get the list of "magic" methods * @author Daniel Frampton */ final public class WordArray { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fd...@us...> - 2010-04-03 18:01:38
|
Revision: 5745 http://jnode.svn.sourceforge.net/jnode/?rev=5745&view=rev Author: fduminy Date: 2010-04-03 18:01:32 +0000 (Sat, 03 Apr 2010) Log Message: ----------- fixed comment Modified Paths: -------------- trunk/core/src/native/x86/vm.asm Modified: trunk/core/src/native/x86/vm.asm =================================================================== --- trunk/core/src/native/x86/vm.asm 2010-04-03 17:52:23 UTC (rev 5744) +++ trunk/core/src/native/x86/vm.asm 2010-04-03 18:01:32 UTC (rev 5745) @@ -113,7 +113,7 @@ ret ; ----------------------------------------------- -; Print a char array who's reference is in EAX +; Print a char array whose reference is in EAX ; ----------------------------------------------- vm_print_chararray: SPINLOCK_ENTER console_lock This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fd...@us...> - 2010-04-03 17:52:29
|
Revision: 5744 http://jnode.svn.sourceforge.net/jnode/?rev=5744&view=rev Author: fduminy Date: 2010-04-03 17:52:23 +0000 (Sat, 03 Apr 2010) Log Message: ----------- formatted comment Modified Paths: -------------- trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java Modified: trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java =================================================================== --- trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java 2010-04-03 17:50:32 UTC (rev 5743) +++ trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java 2010-04-03 17:52:23 UTC (rev 5744) @@ -17,7 +17,7 @@ * 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.partitions.command; import java.io.IOException; @@ -51,11 +51,9 @@ * @author cr...@jn... */ public class FdiskCommand extends AbstractCommand { - // FIXME ... this is a dangerous command and it needs some extra checking to - // help - // avoid catastrophic errors. At the very least, it needs a mode that shows - // the - // user what would happen but does nothing. + // FIXME ... this is a dangerous command and it needs some extra checking to help + // avoid catastrophic errors. At the very least, it needs a mode that shows the + // user what would happen but does nothing. private final FlagArgument FLAG_INIT_MBR = new FlagArgument("initMBR", Argument.OPTIONAL, "if set, init the device's Master Boot Record"); @@ -88,130 +86,130 @@ private final DeviceArgument ARG_DEVICE = new DeviceArgument("deviceId", Argument.OPTIONAL, "Target device", BlockDeviceAPI.class); - public FdiskCommand() { - super("perform disk partition management tasks"); + public FdiskCommand() { + super("perform disk partition management tasks"); registerArguments(FLAG_BOOTABLE, FLAG_DELETE, FLAG_INIT_MBR, FLAG_MODIFY, ARG_DEVICE, ARG_PARTITION, ARG_START, ARG_SECTORS, ARG_BYTES, ARG_TYPE); - } + } - public static void main(String[] args) throws Exception { - new FdiskCommand().execute(args); - } + public static void main(String[] args) throws Exception { + new FdiskCommand().execute(args); + } - public void execute() throws Exception { - final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME); - PrintWriter out = getOutput().getPrintWriter(); - PrintWriter err = getError().getPrintWriter(); - if (!ARG_DEVICE.isSet()) { - // Show all devices. - listAvailableDevices(dm, out); - return; - } + public void execute() throws Exception { + final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME); + PrintWriter out = getOutput().getPrintWriter(); + PrintWriter err = getError().getPrintWriter(); + if (!ARG_DEVICE.isSet()) { + // Show all devices. + listAvailableDevices(dm, out); + return; + } - Device dev = ARG_DEVICE.getValue(); - // FIXME PartitionHelper assumes that the device is an IDE device !?! - if (!(dev instanceof IDEDevice)) { - err.println(dev.getId() + " is not an IDE device"); - exit(1); - } - final PartitionHelper helper = new PartitionHelper(dev.getId(), out); - try { - helper.checkMBR(); - } catch (IOException ioex) { - out.println(ioex.getMessage()); - out.println("Create a new MBR with a valid partition table."); - helper.initMbr(); - helper.write(); - } + Device dev = ARG_DEVICE.getValue(); + // FIXME PartitionHelper assumes that the device is an IDE device !?! + if (!(dev instanceof IDEDevice)) { + err.println(dev.getId() + " is not an IDE device"); + exit(1); + } + final PartitionHelper helper = new PartitionHelper(dev.getId(), out); + try{ + helper.checkMBR(); + } catch (IOException ioex){ + out.println(ioex.getMessage()); + out.println("Create a new MBR with a valid partition table."); + helper.initMbr(); + helper.write(); + } - if (FLAG_BOOTABLE.isSet()) { - helper.toggleBootable(getPartitionNumber(helper)); - helper.write(); - } else if (FLAG_DELETE.isSet()) { - helper.deletePartition(getPartitionNumber(helper)); - helper.write(); - } else if (FLAG_MODIFY.isSet()) { - modifyPartition(helper, getPartitionNumber(helper), out); - helper.write(); - } else if (FLAG_INIT_MBR.isSet()) { - helper.initMbr(); - helper.write(); - } else { - printPartitionTable(helper, out); - } - } + if (FLAG_BOOTABLE.isSet()) { + helper.toggleBootable(getPartitionNumber(helper)); + helper.write(); + } else if (FLAG_DELETE.isSet()) { + helper.deletePartition(getPartitionNumber(helper)); + helper.write(); + } else if (FLAG_MODIFY.isSet()) { + modifyPartition(helper, getPartitionNumber(helper), out); + helper.write(); + } else if (FLAG_INIT_MBR.isSet()) { + helper.initMbr(); + helper.write(); + } else { + printPartitionTable(helper, out); + } + } - private int getPartitionNumber(PartitionHelper helper) { - int partNumber = ARG_PARTITION.getValue(); - if (partNumber >= helper.getNbPartitions() || partNumber < 0) { - throw new IllegalArgumentException("Partition number is invalid"); - } - return partNumber; - } + private int getPartitionNumber(PartitionHelper helper) { + int partNumber = ARG_PARTITION.getValue(); + if (partNumber >= helper.getNbPartitions() || partNumber < 0) { + throw new IllegalArgumentException("Partition number is invalid"); + } + return partNumber; + } private void modifyPartition(PartitionHelper helper, int id, PrintWriter out) throws IOException { - long start = ARG_START.getValue(); - long size = ARG_SECTORS.isSet() ? ARG_SECTORS.getValue() : ARG_BYTES.getValue(); - IBMPartitionTypes type = ARG_TYPE.getValue(); + long start = ARG_START.getValue(); + long size = ARG_SECTORS.isSet() ? ARG_SECTORS.getValue() : ARG_BYTES.getValue(); + IBMPartitionTypes type = ARG_TYPE.getValue(); out.println("Init " + id + " with start = " + start + ", size = " + size + ", fs = " + Integer.toHexString(type.getCode())); boolean sizeUnit = ARG_BYTES.isSet() ? PartitionHelper.BYTES : PartitionHelper.SECTORS; - helper.modifyPartition(id, false, start, size, sizeUnit, type); - } + helper.modifyPartition(id, false, start, size, sizeUnit, type); + } - private void printPartitionTable(PartitionHelper helper, PrintWriter out) - throws DeviceNotFoundException, ApiNotFoundException, IOException { - IDEDevice ideDev = helper.getDevice(); - IDEDriveDescriptor descriptor = ideDev.getDescriptor(); - int sectorSize = IDEConstants.SECTOR_SIZE; - if (ideDev != null) { - out.println("IDE Disk : " + ideDev.getId() + ": " + - descriptor.getSectorsIn28bitAddressing() * 512 + " bytes"); - } - out.println("Device Boot Start End Blocks System"); - IBMPartitionTable partitionTable = helper.getPartitionTable(); - int i = 0; - for (IBMPartitionTableEntry entry : partitionTable) { - IBMPartitionTypes si = entry.getSystemIndicator(); - if (!entry.isEmpty()) { - long sectors = entry.getNrSectors(); + private void printPartitionTable(PartitionHelper helper, PrintWriter out) + throws DeviceNotFoundException, ApiNotFoundException, IOException { + IDEDevice ideDev = helper.getDevice(); + IDEDriveDescriptor descriptor = ideDev.getDescriptor(); + int sectorSize = IDEConstants.SECTOR_SIZE; + if (ideDev != null) { + out.println("IDE Disk : " + ideDev.getId() + ": " + + descriptor.getSectorsIn28bitAddressing() * 512 + " bytes"); + } + out.println("Device Boot Start End Blocks System"); + IBMPartitionTable partitionTable = helper.getPartitionTable(); + int i = 0; + for(IBMPartitionTableEntry entry : partitionTable){ + IBMPartitionTypes si = entry.getSystemIndicator(); + if (!entry.isEmpty()) { + long sectors = entry.getNrSectors(); out.println("ID " + i + " " + (entry.getBootIndicator() ? "Boot" : "No") + " " + entry.getStartLba() + " " + (entry.getStartLba() + sectors) + " " + - entry.getNbrBlocks(sectorSize) + (entry.isOdd() ? "" : "+") + " " + si); - } - if (entry.isExtended()) { + entry.getNbrBlocks(sectorSize) + (entry.isOdd()?"":"+") + " " + si); + } + if (entry.isExtended()) { final List<IBMPartitionTableEntry> exPartitions = partitionTable.getExtendedPartitions(); - int j = 0; - for (IBMPartitionTableEntry exEntry : exPartitions) { - si = exEntry.getSystemIndicator(); - // FIXME ... this needs work + int j = 0; + for (IBMPartitionTableEntry exEntry : exPartitions) { + si = exEntry.getSystemIndicator(); + // FIXME ... this needs work out.println("ID " + i + " " + (exEntry.getBootIndicator() ? "Boot" : "No") + " " + exEntry.getStartLba() + " " + "-----" + " " + "-----" + " " + si); - j++; - } - } - i++; - } - } + j++; + } + } + i++; + } + } - private void listAvailableDevices(DeviceManager dm, PrintWriter out) { - final Collection<Device> allDevices = dm.getDevicesByAPI(BlockDeviceAPI.class); - for (Device dev : allDevices) { - out.println("Found device : " + dev.getId() + "[" + dev.getClass() + "]"); - if (dev instanceof IDEDevice) { - IDEDevice ideDevice = (IDEDevice) dev; - IDEDriveDescriptor desc = ideDevice.getDescriptor(); - if (desc.isDisk()) { + private void listAvailableDevices(DeviceManager dm, PrintWriter out) { + final Collection<Device> allDevices = dm.getDevicesByAPI(BlockDeviceAPI.class); + for (Device dev : allDevices) { + out.println("Found device : " + dev.getId() + "[" + dev.getClass() + "]"); + if (dev instanceof IDEDevice) { + IDEDevice ideDevice = (IDEDevice) dev; + IDEDriveDescriptor desc = ideDevice.getDescriptor(); + if (desc.isDisk()) { out.println(" IDE Disk : " + ideDevice.getId() + "(" + desc.getModel() + " " + desc.getSectorsIn28bitAddressing() * IDEConstants.SECTOR_SIZE + ")"); - } - } - } - } + } + } + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fd...@us...> - 2010-04-03 17:50:38
|
Revision: 5743 http://jnode.svn.sourceforge.net/jnode/?rev=5743&view=rev Author: fduminy Date: 2010-04-03 17:50:32 +0000 (Sat, 03 Apr 2010) Log Message: ----------- added javadoc Modified Paths: -------------- trunk/distr/src/apps/org/jnode/apps/jpartition/consoleview/components/Labelizer.java Modified: trunk/distr/src/apps/org/jnode/apps/jpartition/consoleview/components/Labelizer.java =================================================================== --- trunk/distr/src/apps/org/jnode/apps/jpartition/consoleview/components/Labelizer.java 2010-03-28 19:30:08 UTC (rev 5742) +++ trunk/distr/src/apps/org/jnode/apps/jpartition/consoleview/components/Labelizer.java 2010-04-03 17:50:32 UTC (rev 5743) @@ -20,6 +20,17 @@ package org.jnode.apps.jpartition.consoleview.components; +/** + * Interface used to transform an object into a displayable String. + * @author Fabien DUMINY (fd...@jn...) + * + * @param <T> + */ public interface Labelizer<T> { + /** + * Get a displayable String representing the given value. + * @param value The value to transform. + * @return + */ String getLabel(T value); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2010-03-28 19:30:14
|
Revision: 5742 http://jnode.svn.sourceforge.net/jnode/?rev=5742&view=rev Author: lsantha Date: 2010-03-28 19:30:08 +0000 (Sun, 28 Mar 2010) Log Message: ----------- Added javadoc. Modified Paths: -------------- trunk/core/src/core/org/jnode/vm/compiler/NativeCodeCompiler.java Modified: trunk/core/src/core/org/jnode/vm/compiler/NativeCodeCompiler.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/NativeCodeCompiler.java 2010-03-28 19:26:38 UTC (rev 5741) +++ trunk/core/src/core/org/jnode/vm/compiler/NativeCodeCompiler.java 2010-03-28 19:30:08 UTC (rev 5742) @@ -313,11 +313,21 @@ protected abstract CompilerBytecodeVisitor createBytecodeVisitor(VmMethod method, CompiledMethod cm, NativeStream os, int level, boolean isBootstrap); + /** + * Returns an unused or newly created byte code visitor. + * @see #createBytecodeVisitor(org.jnode.vm.classmgr.VmMethod, CompiledMethod, org.jnode.assembler.NativeStream, + * int, boolean) + */ protected CompilerBytecodeVisitor getBytecodeVisitor(VmMethod method, CompiledMethod cm, NativeStream os, int level, boolean isBootstrap) { return createBytecodeVisitor(method, cm, os, level, isBootstrap); } + /** + * Call this method when the specified bytecode visitor finished working. + * + * @param visitor a bytecode visitor + */ protected void releaseBytecodeVisitor(CompilerBytecodeVisitor visitor) { } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2010-03-28 19:26:44
|
Revision: 5741 http://jnode.svn.sourceforge.net/jnode/?rev=5741&view=rev Author: lsantha Date: 2010-03-28 19:26:38 +0000 (Sun, 28 Mar 2010) Log Message: ----------- Added support for releasing the bytecode visitor, other fixes in reusing bytecode visitors. Modified Paths: -------------- trunk/core/src/core/org/jnode/vm/compiler/NativeCodeCompiler.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86Level1ACompiler.java Modified: trunk/core/src/core/org/jnode/vm/compiler/NativeCodeCompiler.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/NativeCodeCompiler.java 2010-03-28 19:12:41 UTC (rev 5740) +++ trunk/core/src/core/org/jnode/vm/compiler/NativeCodeCompiler.java 2010-03-28 19:26:38 UTC (rev 5741) @@ -240,38 +240,49 @@ protected CompiledMethod doCompile(VmMethod method, NativeStream os, int level, boolean isBootstrap) { final CompiledMethod cm = new CompiledMethod(level); - if (method.isNative()) { - Object label = new Label(method.getMangledName()); - cm.setCodeStart(os.getObjectRef(label)); - } else { - // Create the visitor - CompilerBytecodeVisitor bcv = createBytecodeVisitor(method, - cm, os, level, isBootstrap); - // Wrap in verifier if needed - if (!(bcv instanceof VerifyingCompilerBytecodeVisitor)) { - bcv = new VerifyingCompilerBytecodeVisitor<CompilerBytecodeVisitor>(bcv); + try { + if (method.isNative()) { + Object label = new Label(method.getMangledName()); + cm.setCodeStart(os.getObjectRef(label)); + } else { + // Create the visitor + CompilerBytecodeVisitor bcv = getBytecodeVisitor(method, cm, os, level, isBootstrap); + + try { + // Wrap in verifier if needed + if (!(bcv instanceof VerifyingCompilerBytecodeVisitor)) { + bcv = new VerifyingCompilerBytecodeVisitor<CompilerBytecodeVisitor>(bcv); + } + // Get the bytecode + final VmByteCode bc = method.getBytecode(); + // Create the control flow graph + ControlFlowGraph cfg = (ControlFlowGraph) bc.getCompilerData(); + if (cfg == null) { + cfg = new ControlFlowGraph(bc); + bc.setCompilerData(cfg); + } + // Compile the code 1 basic block at a time + final CompilerBytecodeParser parser = new CompilerBytecodeParser(bc, cfg, bcv); + bcv.startMethod(method); + for (BasicBlock bb : cfg) { + bcv.startBasicBlock(bb); + parser.parse(bb.getStartPC(), bb.getEndPC(), false); + bcv.endBasicBlock(); + } + bcv.endMethod(); + + //remove the compiler data to save memory, will be regenerated if needed + bc.setCompilerData(null); + } finally { + releaseBytecodeVisitor(bcv); + } } - // Get the bytecode - final VmByteCode bc = method.getBytecode(); - // Create the control flow graph - ControlFlowGraph cfg = (ControlFlowGraph) bc.getCompilerData(); - if (cfg == null) { - cfg = new ControlFlowGraph(bc); - bc.setCompilerData(cfg); - } - // Compile the code 1 basic block at a time - final CompilerBytecodeParser parser = new CompilerBytecodeParser( - bc, cfg, bcv); - bcv.startMethod(method); - for (BasicBlock bb : cfg) { - bcv.startBasicBlock(bb); - parser.parse(bb.getStartPC(), bb.getEndPC(), false); - bcv.endBasicBlock(); - } - bcv.endMethod(); - - //remove the compiler data to save memory, will be regenerated if needed - bc.setCompilerData(null); + } catch (RuntimeException x) { + System.err.println("ERROR in compilation of " + method.getFullName()); + throw x; + } catch (Error x) { + System.err.println("ERROR in compilation of " + method.getFullName()); + throw x; } return cm; @@ -286,8 +297,8 @@ * @param isBootstrap * @return The compiled method */ - protected abstract CompiledMethod doCompileAbstract(VmMethod method, - NativeStream os, int level, boolean isBootstrap); + protected abstract CompiledMethod doCompileAbstract(VmMethod method, NativeStream os, int level, + boolean isBootstrap); /** * Create the visitor that converts bytecodes into native code. @@ -299,10 +310,17 @@ * @param isBootstrap * @return The new bytecode visitor. */ - protected abstract CompilerBytecodeVisitor createBytecodeVisitor( - VmMethod method, CompiledMethod cm, NativeStream os, int level, - boolean isBootstrap); + protected abstract CompilerBytecodeVisitor createBytecodeVisitor(VmMethod method, CompiledMethod cm, + NativeStream os, int level, boolean isBootstrap); + protected CompilerBytecodeVisitor getBytecodeVisitor(VmMethod method, CompiledMethod cm, NativeStream os, + int level, boolean isBootstrap) { + return createBytecodeVisitor(method, cm, os, level, isBootstrap); + } + + protected void releaseBytecodeVisitor(CompilerBytecodeVisitor visitor) { + + } /** * Initialize this compiler * Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86Level1ACompiler.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86Level1ACompiler.java 2010-03-28 19:12:41 UTC (rev 5740) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86Level1ACompiler.java 2010-03-28 19:26:38 UTC (rev 5741) @@ -20,8 +20,6 @@ package org.jnode.vm.x86.compiler.l1a; -import java.util.ArrayList; -import java.util.List; import org.jnode.assembler.NativeStream; import org.jnode.assembler.ObjectResolver; import org.jnode.assembler.x86.X86BinaryAssembler; @@ -96,8 +94,6 @@ private final ThreadLocal<X86BytecodeVisitor> byteCodeVisitorHolder = new ThreadLocal<X86BytecodeVisitor>(); - private final ThreadLocal<List<X86BytecodeVisitor>> byteCodeVisitorListHolder = - new ThreadLocal<List<X86BytecodeVisitor>>(); /** * Create the visitor that converts bytecodes into native code. * @@ -115,37 +111,14 @@ final EntryPoints entryPoints = getEntryPoints(); X86BytecodeVisitor byteCodeVisitor = byteCodeVisitorHolder.get(); if (byteCodeVisitor == null) { - byteCodeVisitor = new X86BytecodeVisitor(os, cm, isBootstrap, entryPoints, - getMagicHelper(), getTypeSizeInfo()); - byteCodeVisitorHolder.set(byteCodeVisitor); + byteCodeVisitor = new X86BytecodeVisitor(os, cm, isBootstrap, entryPoints, getMagicHelper(), + getTypeSizeInfo()); } else { - if (byteCodeVisitor.isWorking()) { - //slow path - List<X86BytecodeVisitor> vlist = byteCodeVisitorListHolder.get(); - if (vlist == null) { - vlist = new ArrayList<X86BytecodeVisitor>(); - byteCodeVisitorListHolder.set(vlist); - } - byteCodeVisitor = null; - for (X86BytecodeVisitor bv : vlist) { - if (!bv.isWorking()) { - byteCodeVisitor = bv; - break; - } - } - if (byteCodeVisitor == null) { - byteCodeVisitor = new X86BytecodeVisitor(os, cm, isBootstrap, entryPoints, - getMagicHelper(), getTypeSizeInfo()); - vlist.add(byteCodeVisitor); - } else { - byteCodeVisitor.reset(os, cm, isBootstrap, entryPoints, getMagicHelper(), getTypeSizeInfo()); - } - } else { - byteCodeVisitor.reset(os, cm, isBootstrap, entryPoints, getMagicHelper(), getTypeSizeInfo()); - } + byteCodeVisitorHolder.remove(); + byteCodeVisitor.reset(os, cm, isBootstrap, entryPoints, getMagicHelper(), getTypeSizeInfo()); } cbv = byteCodeVisitor; - if (inlineMethods /*&& ((X86Assembler)os).isCode32()*/) { + if (inlineMethods) { final VmClassLoader loader = method.getDeclaringClass().getLoader(); return new OptimizingBytecodeVisitor(entryPoints, cbv, loader); } else { @@ -153,7 +126,18 @@ } } - private final MagicHelper getMagicHelper() { + @Override + protected synchronized void releaseBytecodeVisitor(CompilerBytecodeVisitor visitor) { + X86BytecodeVisitor bv; + if (inlineMethods) { + bv = (X86BytecodeVisitor) ((OptimizingBytecodeVisitor) visitor).getDelegate(); + } else { + bv = (X86BytecodeVisitor) visitor; + } + byteCodeVisitorHolder.set(bv); + } + + private MagicHelper getMagicHelper() { final MagicHelper helper = magicHelperHolder.get(); if (helper != null) { return helper; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2010-03-28 19:12:47
|
Revision: 5740 http://jnode.svn.sourceforge.net/jnode/?rev=5740&view=rev Author: lsantha Date: 2010-03-28 19:12:41 +0000 (Sun, 28 Mar 2010) Log Message: ----------- Fixed a bug where expected item was not at the top of the item stack. Modified Paths: -------------- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemStack.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/WordItem.java Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemStack.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemStack.java 2010-03-28 19:03:38 UTC (rev 5739) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemStack.java 2010-03-28 19:12:41 UTC (rev 5740) @@ -26,6 +26,7 @@ /** * @author Ewout Prangsma (ep...@us...) + * @author Levente S\u00e1ntha */ class ItemStack { @@ -129,6 +130,36 @@ return (stack[tos - 1] == item); } + /** + * Finds the position of the specified item on the stack starting from the top. + * + * @param item the item to find + * @return the position of the item or -1 if not found + */ + final int stackLocation(Item item) { + int ret = -1; + + int i = tos - 1; + while ((i >= 0) && (stack[i] != item)) + i--; + + if (i >= 0) + ret = tos - 1 - i; + + return ret; + } + + /** + * Exchanges the item at the specified position with the top item. + * + * @param pos the position of the item + */ + final void makeTop(int pos) { + Item tmp = stack[tos - 1]; + stack[tos - 1] = stack[tos - 1 - pos]; + stack[tos - 1 - pos] = tmp; + } + final void pop(EmitterContext ec) { if (tos <= 0) { throw new Error("Stack is empty"); Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/WordItem.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/WordItem.java 2010-03-28 19:03:38 UTC (rev 5739) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/WordItem.java 2010-03-28 19:12:41 UTC (rev 5740) @@ -27,6 +27,7 @@ import org.jnode.assembler.x86.X86Register.GPR64; import org.jnode.vm.JvmType; import org.jnode.vm.Vm; +import org.jnode.vm.bytecode.StackException; import org.jnode.vm.x86.compiler.X86CompilerHelper; /** @@ -186,7 +187,22 @@ break; case Kind.STACK: - // TODO: make sure this is on top os stack + // TODO: make sure 'this' is on top of stack + // TODO: implemen it for 64 bits + if (!stack.operandStack.isTos(this)) { + + int stack_loc = stack.operandStack.stackLocation(this); + if (stack_loc < 0) + throw new StackException("Item not found on stack"); + + stack.operandStack.makeTop(stack_loc); + + //todo test it + os.writeMOV(org.jnode.vm.x86.compiler.X86CompilerConstants.BITS32, reg, helper.SP, helper.SLOTSIZE); + os.writeXCHG(helper.SP, org.jnode.vm.x86.compiler.X86CompilerConstants.BITS32 * stack_loc, reg); + os.writeMOV(org.jnode.vm.x86.compiler.X86CompilerConstants.BITS32, helper.SP, helper.SLOTSIZE, reg); + } + if (VirtualStack.checkOperandStack) { stack.operandStack.pop(this); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2010-03-28 19:03:44
|
Revision: 5739 http://jnode.svn.sourceforge.net/jnode/?rev=5739&view=rev Author: lsantha Date: 2010-03-28 19:03:38 +0000 (Sun, 28 Mar 2010) Log Message: ----------- Added support for dead code detection. Modified Paths: -------------- trunk/core/src/core/org/jnode/vm/bytecode/BasicBlock.java trunk/core/src/core/org/jnode/vm/bytecode/BytecodeFlags.java Added Paths: ----------- trunk/core/src/core/org/jnode/vm/bytecode/DeadBlockFinder.java Modified: trunk/core/src/core/org/jnode/vm/bytecode/BasicBlock.java =================================================================== --- trunk/core/src/core/org/jnode/vm/bytecode/BasicBlock.java 2010-03-28 16:49:43 UTC (rev 5738) +++ trunk/core/src/core/org/jnode/vm/bytecode/BasicBlock.java 2010-03-28 19:03:38 UTC (rev 5739) @@ -33,12 +33,14 @@ * * @author epr * @author Madhu Siddalingaiah + * @author Levente S\u00e1ntha */ public class BasicBlock extends VmSystemObject { private final int startPC; private int endPC; private boolean startOfExceptionHandler; + private boolean retTarget; private TypeStack startStack; private BootableArrayList<BasicBlock> entryBlocks = new BootableArrayList<BasicBlock>(); @@ -87,6 +89,10 @@ this.startOfExceptionHandler = startOfExceptionHandler; } + public void setRetTarget(boolean retTarget) { + this.retTarget = retTarget; + } + /** * Gets the first bytecode address of this basic block * @@ -190,6 +196,12 @@ if (startPC == 0) return true; + if (startOfExceptionHandler) + return true; + + if (retTarget) + return true; + if (entryBlocks != null) { for (BasicBlock bb : entryBlocks) { if (!checked.contains(bb)) { Modified: trunk/core/src/core/org/jnode/vm/bytecode/BytecodeFlags.java =================================================================== --- trunk/core/src/core/org/jnode/vm/bytecode/BytecodeFlags.java 2010-03-28 16:49:43 UTC (rev 5738) +++ trunk/core/src/core/org/jnode/vm/bytecode/BytecodeFlags.java 2010-03-28 19:03:38 UTC (rev 5739) @@ -31,4 +31,5 @@ public static final byte F_START_OF_EXCEPTIONHANDLER = 0x08; public static final byte F_START_OF_INSTRUCTION = 0x10; public static final byte F_YIELDPOINT = 0x20; + public static final byte F_RET_TARGET = 0x40; } Added: trunk/core/src/core/org/jnode/vm/bytecode/DeadBlockFinder.java =================================================================== --- trunk/core/src/core/org/jnode/vm/bytecode/DeadBlockFinder.java (rev 0) +++ trunk/core/src/core/org/jnode/vm/bytecode/DeadBlockFinder.java 2010-03-28 19:03:38 UTC (rev 5739) @@ -0,0 +1,498 @@ +/* + * $Id: BasicBlockFinder.java 5709 2010-01-03 11:46:38Z lsantha $ + * + * Copyright (C) 2003-2010 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.vm.bytecode; + +import java.util.TreeMap; +import org.jnode.system.BootLog; +import org.jnode.vm.JvmType; +import org.jnode.vm.classmgr.VmByteCode; +import org.jnode.vm.classmgr.VmInterpretedExceptionHandler; +import org.jnode.vm.classmgr.VmMethod; + +/** + * Bytecode visitor, used to determine the start addresses of basic blocks. + * + * @author Levente S\u00e1ntha + */ +public class DeadBlockFinder extends BytecodeVisitorSupport implements BytecodeFlags { + private static final boolean debug = false; + private final TreeMap<Integer, BasicBlock> blocks = new TreeMap<Integer, BasicBlock>(); + private byte[] opcodeFlags; + private boolean nextIsStartOfBB; + private boolean nextFollowsTypeStack; + private boolean nextIsRetTarget; + private int curAddress; + private BasicBlock current; + + /** + * Create all determined basic blocks + * + * @return the basic blocks. + */ + public BasicBlock[] createBasicBlocks() { + // Create the array + final BasicBlock[] list = blocks.values().toArray(new BasicBlock[blocks.size()]); + // Set the EndPC's and flags + final byte[] opcodeFlags = this.opcodeFlags; + final int len = opcodeFlags.length; + int bbIndex = 0; + for (int i = 0; i < len; i++) { + if (isStartOfBB(i)) { + final int start = i; + // Find the end of the BB + i++; + while ((i < len) && (!isStartOfBB(i))) { + i++; + } + // the BB + final BasicBlock bb = list[bbIndex++]; + if (bb.getStartPC() != start) { + throw new AssertionError("bb.getStartPC() != start"); + } + bb.setEndPC(i); + bb.setStartOfExceptionHandler(isStartOfException(start)); + i--; + } + } + if (bbIndex != list.length) { + throw new AssertionError("bbIndex != list.length"); + } + return list; + } + + /** + * Get the per-opcode bytecode flags. + * + * @return byte[] + */ + public final byte[] getOpcodeFlags() { + return opcodeFlags; + } + + /** + * @param method + * @see BytecodeVisitor#startMethod(org.jnode.vm.classmgr.VmMethod) + */ + public void startMethod(VmMethod method) { + final VmByteCode bc = method.getBytecode(); + final int length = bc.getLength(); + opcodeFlags = new byte[length]; + // The first instruction is always the start of a BB. + startBB(0, true); + // The exception handler also start a basic block + final TypeStack ehTStack = new TypeStack(); + ehTStack.push(JvmType.REFERENCE); + for (int i = 0; i < bc.getNoExceptionHandlers(); i++) { + VmInterpretedExceptionHandler eh = bc.getExceptionHandler(i); + startTryBlock(eh.getStartPC()); + startTryBlockEnd(eh.getEndPC()); + startException(eh.getHandlerPC(), ehTStack); + } + } + + /** + * @param address + * @see BytecodeVisitor#startInstruction(int) + */ + public void startInstruction(int address) { + if (debug) { + BootLog.debug("#" + address); + } + curAddress = address; + super.startInstruction(address); + opcodeFlags[address] |= F_START_OF_INSTRUCTION; + boolean next_is_rt = nextIsRetTarget; + if (nextIsRetTarget) { + opcodeFlags[address] |= F_RET_TARGET; + nextIsRetTarget = false; + } + boolean next_is_bb = nextIsStartOfBB; + if (nextIsStartOfBB) { + if (debug) BootLog.debug("\tnextIsStartOfBB\t" + nextFollowsTypeStack); + startBB(address, nextFollowsTypeStack); + nextIsStartOfBB = false; + nextFollowsTypeStack = true; + } + if (isStartOfBB(address)) { + if (!next_is_bb) { + BasicBlock bb = blocks.get(address); + bb.addEntryBlock(current); + current = bb; + } else { + current = blocks.get(address); + } + + if (next_is_rt) { + current.setRetTarget(true); + } + + if (debug) BootLog.debug("\tcurrent\t" + current); + } + if (debug) { + BootLog.debug("#" + address); + } + } + + /** + * Mark the start of a basic block + * + * @param address + */ + private void startBB(int address, boolean setTypeStack) { + if ((opcodeFlags[address] & F_START_OF_BASICBLOCK) == 0) { + opcodeFlags[address] |= F_START_OF_BASICBLOCK; + final BasicBlock bb = new BasicBlock(address); + blocks.put(address, bb); + if (setTypeStack) { + bb.addEntryBlock(current); + } + } else if (setTypeStack) { + final BasicBlock bb = blocks.get(address); + // Add entry block + bb.addEntryBlock(current); + } + } + + /** + * Mark the end of a basic block + */ + private void endBB(boolean nextFollowsTypeStack) { + this.nextIsStartOfBB = true; + this.nextFollowsTypeStack = nextFollowsTypeStack; + } + + /** + * @param address + * @see BytecodeVisitor#visit_ifeq(int) + */ + public void visit_ifeq(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_ifne(int) + */ + public void visit_ifne(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_iflt(int) + */ + public void visit_iflt(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_ifge(int) + */ + public void visit_ifge(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_ifgt(int) + */ + public void visit_ifgt(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_ifle(int) + */ + public void visit_ifle(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_if_icmpeq(int) + */ + public void visit_if_icmpeq(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_if_icmpne(int) + */ + public void visit_if_icmpne(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_if_icmplt(int) + */ + public void visit_if_icmplt(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_if_icmpge(int) + */ + public void visit_if_icmpge(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_if_icmpgt(int) + */ + public void visit_if_icmpgt(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_if_icmple(int) + */ + public void visit_if_icmple(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_if_acmpeq(int) + */ + public void visit_if_acmpeq(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_if_acmpne(int) + */ + public void visit_if_acmpne(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_goto(int) + */ + public void visit_goto(int address) { + // No change + addBranch(address, false); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_jsr(int) + */ + public void visit_jsr(int address) { + addBranch(address, false); + nextIsRetTarget = true; + condYieldPoint(address); + } + + /** + * @param defValue + * @param lowValue + * @param highValue + * @param addresses + * @see BytecodeVisitor#visit_tableswitch(int, int, int, int[]) + */ + public void visit_tableswitch(int defValue, int lowValue, int highValue, int[] addresses) { + for (int i = 0; i < addresses.length; i++) { + addBranch(addresses[i], true); + condYieldPoint(addresses[i]); + } + addBranch(defValue, false); + condYieldPoint(defValue); + } + + /** + * @param defValue + * @param matchValues + * @param addresses + * @see BytecodeVisitor#visit_lookupswitch(int, int[], int[]) + */ + public void visit_lookupswitch(int defValue, int[] matchValues, int[] addresses) { + for (int i = 0; i < addresses.length; i++) { + addBranch(addresses[i], true); + condYieldPoint(addresses[i]); + } + addBranch(defValue, false); + condYieldPoint(defValue); + } + + /** + * @param address + * @see BytecodeVisitor#visit_ifnull(int) + */ + public void visit_ifnull(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @param address + * @see BytecodeVisitor#visit_ifnonnull(int) + */ + public void visit_ifnonnull(int address) { + addBranch(address, true); + condYieldPoint(address); + } + + /** + * @see BytecodeVisitor#visit_athrow() + */ + public void visit_athrow() { + endBB(false); + // Reference is actually pushed on the stack, but that is handled + // by the startException blocks. + } + + /** + * @see BytecodeVisitor#visit_areturn() + */ + public void visit_areturn() { + endBB(false); + } + + /** + * @see BytecodeVisitor#visit_dreturn() + */ + public void visit_dreturn() { + endBB(false); + } + + /** + * @see BytecodeVisitor#visit_freturn() + */ + public void visit_freturn() { + endBB(false); + } + + /** + * @see BytecodeVisitor#visit_ireturn() + */ + public void visit_ireturn() { + if (debug) { + BootLog.debug("ireturn at " + curAddress); + } + endBB(false); + } + + /** + * @see BytecodeVisitor#visit_lreturn() + */ + public void visit_lreturn() { + endBB(false); + } + + /** + * @param index + * @see BytecodeVisitor#visit_ret(int) + */ + public void visit_ret(int index) { + // No change + endBB(false); + } + + /** + * @see BytecodeVisitor#visit_return() + */ + public void visit_return() { + // No change + endBB(false); + } + + /** + * Add branching information (to the given target) to the basic blocks information. + * + * @param target + */ + private void addBranch(int target, boolean conditional) { + startBB(target, true); + endBB(conditional); + } + + private boolean isStartOfBB(int address) { + return ((opcodeFlags[address] & F_START_OF_BASICBLOCK) != 0); + } + + private boolean isStartOfException(int address) { + return ((opcodeFlags[address] & F_START_OF_EXCEPTIONHANDLER) != 0); + } + + /** + * Mark the start of a exception handler + * + * @param address + */ + private void startException(int address, TypeStack tstack) { + opcodeFlags[address] |= F_START_OF_EXCEPTIONHANDLER; + //System.out.println("startException: " + tstack); + startBB(address, true); + } + + /** + * Mark the start of a try-catch block + * + * @param address + */ + private void startTryBlock(int address) { + opcodeFlags[address] |= F_START_OF_TRYBLOCK; + //startBB(address, false, null); + } + + /** + * Mark the end of a try-catch block + * + * @param address + */ + private void startTryBlockEnd(int address) { + opcodeFlags[address] |= F_START_OF_TRYBLOCKEND; + //startBB(address, false, null); + } + + /** + * Mark a conditional yieldpoint. + */ + private void condYieldPoint(int target) { + if (target < curAddress) { + opcodeFlags[curAddress] |= F_YIELDPOINT; + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2010-03-28 16:49:50
|
Revision: 5738 http://jnode.svn.sourceforge.net/jnode/?rev=5738&view=rev Author: lsantha Date: 2010-03-28 16:49:43 +0000 (Sun, 28 Mar 2010) Log Message: ----------- Removed needless code. Modified Paths: -------------- trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java =================================================================== --- trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java 2010-03-28 16:29:10 UTC (rev 5737) +++ trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java 2010-03-28 16:49:43 UTC (rev 5738) @@ -499,7 +499,6 @@ code.setNext(this.compiledCode); this.compiledCode = code; this.nativeCode = code.getNativeCode(); - this.compiledCode = code; Vm.getVm().getSharedStatics().setMethodCode( getSharedStaticsIndex(), code.getNativeCode()); this.nativeCodeOptLevel = (short) optLevel; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2010-03-28 16:29:16
|
Revision: 5737 http://jnode.svn.sourceforge.net/jnode/?rev=5737&view=rev Author: lsantha Date: 2010-03-28 16:29:10 +0000 (Sun, 28 Mar 2010) Log Message: ----------- Simplified VM type to Class conversion. Modified Paths: -------------- trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java Modified: trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java =================================================================== --- trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java 2010-03-27 06:08:08 UTC (rev 5736) +++ trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java 2010-03-28 16:29:10 UTC (rev 5737) @@ -978,34 +978,7 @@ Class r_class; VmType vtm = mts.getReturnType(); if (vtm.isPrimitive()) { - switch (vtm.getJvmType()) { - case JvmType.BOOLEAN: - vtm = VmType.fromClass(Boolean.class); - break; - case JvmType.BYTE: - vtm = VmType.fromClass(Byte.class); - break; - case JvmType.SHORT: - vtm = VmType.fromClass(Short.class); - break; - case JvmType.CHAR: - vtm = VmType.fromClass(Character.class); - break; - case JvmType.INT: - vtm = VmType.fromClass(Integer.class); - break; - case JvmType.FLOAT: - vtm = VmType.fromClass(Float.class); - break; - case JvmType.LONG: - vtm = VmType.fromClass(Long.class); - break; - case JvmType.DOUBLE: - vtm = VmType.fromClass(Double.class); - break; - - } - r_class = vtm.asClass(); + r_class = getClassForJvmType(vtm.getJvmType()); } else { try { r_class = Class.forName(vtm.getName(), false, vtm.getLoader().asClassLoader()); @@ -1014,7 +987,7 @@ } } Object defo = AnnotationParser.parseMemberValue(r_class, data, new VmConstantPool(cls), - cls.asClass()); + org.jnode.vm.Vm.isRunningVm() ? cls.asClass() : cls.asClassDuringBootstrap()); mts.setAnnotationDefault(defo); } else { skip(data, length); @@ -1046,6 +1019,31 @@ } } + private static Class getClassForJvmType(int type) { + switch (type) { + case JvmType.BOOLEAN: + return boolean.class; + case JvmType.BYTE: + return byte.class; + case JvmType.SHORT: + return short.class; + case JvmType.CHAR: + return char.class; + case JvmType.INT: + return int.class; + case JvmType.FLOAT: + return float.class; + case JvmType.LONG: + return long.class; + case JvmType.DOUBLE: + return double.class; + case JvmType.VOID: + return void.class; + default: + throw new IllegalArgumentException("Invalid JVM type: " + type); + } + } + /** * Read a runtime parameter annotations attributes. * @@ -1226,34 +1224,7 @@ Class r_class; VmType vtm = mts.getReturnType(); if (vtm.isPrimitive()) { - switch (vtm.getJvmType()) { - case JvmType.BOOLEAN: - vtm = VmType.fromClass(Boolean.class); - break; - case JvmType.BYTE: - vtm = VmType.fromClass(Byte.class); - break; - case JvmType.SHORT: - vtm = VmType.fromClass(Short.class); - break; - case JvmType.CHAR: - vtm = VmType.fromClass(Character.class); - break; - case JvmType.INT: - vtm = VmType.fromClass(Integer.class); - break; - case JvmType.FLOAT: - vtm = VmType.fromClass(Float.class); - break; - case JvmType.LONG: - vtm = VmType.fromClass(Long.class); - break; - case JvmType.DOUBLE: - vtm = VmType.fromClass(Double.class); - break; - - } - r_class = vtm.asClass(); + r_class = getClassForJvmType(vtm.getJvmType()); } else { try { r_class = vtm.getLoader().asClassLoader().loadClass(vtm.getName()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2010-03-27 06:08:14
|
Revision: 5736 http://jnode.svn.sourceforge.net/jnode/?rev=5736&view=rev Author: lsantha Date: 2010-03-27 06:08:08 +0000 (Sat, 27 Mar 2010) Log Message: ----------- Added support for specifying in jnode.properties the target plugin list of the jar packager. Modified Paths: -------------- trunk/builder/src/builder/org/jnode/build/packager/PackagerTask.java trunk/builder/src/builder/org/jnode/build/packager/PluginListInsertor.java trunk/jnode.properties.dist Modified: trunk/builder/src/builder/org/jnode/build/packager/PackagerTask.java =================================================================== --- trunk/builder/src/builder/org/jnode/build/packager/PackagerTask.java 2010-03-27 05:39:07 UTC (rev 5735) +++ trunk/builder/src/builder/org/jnode/build/packager/PackagerTask.java 2010-03-27 06:08:08 UTC (rev 5736) @@ -58,6 +58,7 @@ // properties names protected static final String USER_PLUGIN_IDS = "user.plugin.ids"; protected static final String PLUGIN_LIST_NAME = "plugin.list.name"; + protected static final String TARGET_PLUGIN_LIST = "target.plugin.list"; protected static final String FORCE_OVERWRITE_SCRIPTS = "force.overwrite.scripts"; /** Modified: trunk/builder/src/builder/org/jnode/build/packager/PluginListInsertor.java =================================================================== --- trunk/builder/src/builder/org/jnode/build/packager/PluginListInsertor.java 2010-03-27 05:39:07 UTC (rev 5735) +++ trunk/builder/src/builder/org/jnode/build/packager/PluginListInsertor.java 2010-03-27 06:08:08 UTC (rev 5736) @@ -63,9 +63,13 @@ */ private List<String> readPluginIds(String pluginListName) { List<String> pluginIds = new ArrayList<String>(); - + final Properties properties = getProperties(); - final String targetName = properties.getProperty(PLUGIN_LIST_NAME, null); + String targetName = getProject().getProperty(TARGET_PLUGIN_LIST); + if (targetName == null || targetName.trim().length() == 0) { + targetName = properties.getProperty(PLUGIN_LIST_NAME, null); + } + if (targetName == null) { log("property " + PLUGIN_LIST_NAME + " not specified in " + getPropertiesFile().getAbsolutePath(), Project.MSG_ERR); Modified: trunk/jnode.properties.dist =================================================================== --- trunk/jnode.properties.dist 2010-03-27 05:39:07 UTC (rev 5735) +++ trunk/jnode.properties.dist 2010-03-27 06:08:08 UTC (rev 5736) @@ -17,6 +17,9 @@ # jar packager (tool to easily create a jnode plugin from a regular jar file) # user.applications.dir = ${root.dir}/local/applications/ +# The jar packager adds the user plugins to the plugin list specified here. +# target.plugin.list=default + # ----------------------------------------------- # Settings for the bootdisk image This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2010-03-27 05:39:13
|
Revision: 5735 http://jnode.svn.sourceforge.net/jnode/?rev=5735&view=rev Author: lsantha Date: 2010-03-27 05:39:07 +0000 (Sat, 27 Mar 2010) Log Message: ----------- Added plugin insertor to custom initjar assembler. Modified Paths: -------------- trunk/all/build.xml Modified: trunk/all/build.xml =================================================================== --- trunk/all/build.xml 2010-03-26 13:23:34 UTC (rev 5734) +++ trunk/all/build.xml 2010-03-27 05:39:07 UTC (rev 5735) @@ -502,7 +502,7 @@ pluginDir="${plugins.dir}" systemPluginList="${root.dir}/all/conf/system-plugin-list.xml"> <insert userApplicationsDir="${user.applications.dir}"/> - + <fileset dir="${root.dir}/all/conf"> <exclude name="system-plugin-list.xml"/> <include name="*plugin-list.xml"/> @@ -517,6 +517,7 @@ <initjars destdir="${initjars.dir}" pluginDir="${plugins.dir}" systemPluginList="${root.dir}/all/conf/system-plugin-list.xml"> + <insert userApplicationsDir="${user.applications.dir}"/> <fileset dir="${custom.plugin-list.dir}"> <include name="*plugin-list.xml"/> </fileset> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2010-03-26 13:23:40
|
Revision: 5734 http://jnode.svn.sourceforge.net/jnode/?rev=5734&view=rev Author: galatnm Date: 2010-03-26 13:23:34 +0000 (Fri, 26 Mar 2010) Log Message: ----------- Return space on the device. Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystem.java trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660Volume.java trunk/fs/src/fs/org/jnode/fs/iso9660/PrimaryVolumeDescriptor.java trunk/fs/src/fs/org/jnode/fs/iso9660/SupplementaryVolumeDescriptor.java Modified: trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystem.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystem.java 2010-03-26 13:23:12 UTC (rev 5733) +++ trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystem.java 2010-03-26 13:23:34 UTC (rev 5734) @@ -17,7 +17,7 @@ * 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.fs.iso9660; import java.io.IOException; @@ -43,7 +43,7 @@ * @see org.jnode.fs.FileSystem#getDevice() */ public ISO9660FileSystem(Device device, boolean readOnly, ISO9660FileSystemType type) - throws FileSystemException { + throws FileSystemException { super(device, readOnly, type); try { @@ -108,17 +108,14 @@ } public long getFreeSpace() { - // TODO implement me - return -1; + return 0; } public long getTotalSpace() { - // TODO implement me - return -1; + return volume.getSize(); } public long getUsableSpace() { - // TODO implement me - return -1; + return volume.getSize(); } } Modified: trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660Volume.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660Volume.java 2010-03-26 13:23:12 UTC (rev 5733) +++ trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660Volume.java 2010-03-26 13:23:34 UTC (rev 5734) @@ -17,7 +17,7 @@ * 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.fs.iso9660; import java.io.IOException; @@ -119,4 +119,16 @@ return primaryVolumeDescriptor.getRootDirectoryEntry(); } } + + public PrimaryVolumeDescriptor getPrimaryVolumeDescriptor() { + return primaryVolumeDescriptor; + } + + public SupplementaryVolumeDescriptor getSupplementaryVolumeDescriptor() { + return supplementaryVolumeDescriptor; + } + + public long getSize() { + return primaryVolumeDescriptor.getSize(); + } } Modified: trunk/fs/src/fs/org/jnode/fs/iso9660/PrimaryVolumeDescriptor.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/iso9660/PrimaryVolumeDescriptor.java 2010-03-26 13:23:12 UTC (rev 5733) +++ trunk/fs/src/fs/org/jnode/fs/iso9660/PrimaryVolumeDescriptor.java 2010-03-26 13:23:34 UTC (rev 5734) @@ -17,7 +17,7 @@ * 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.fs.iso9660; import java.io.IOException; @@ -105,7 +105,7 @@ this.getRootDirectoryEntry().getLengthOfExtendedAttribute()); out.println("\t\t- Location of the extent: " + this.getRootDirectoryEntry().getLocationOfExtent()); - //out.println(" - Length of the file identifier: " + + // out.println(" - Length of the file identifier: " + // this.getRootDirectoryEntry().getLengthOfFileIdentifier()); out.println("\t\t- is directory: " + this.getRootDirectoryEntry().isDirectory()); out.println("\t\t- File identifier: " + this.getRootDirectoryEntry().getFileIdentifier()); @@ -197,4 +197,8 @@ public String getVolumeIdentifier() { return volumeIdentifier; } + + public long getSize() { + return this.getSpaceSize() * this.getLBSize(); + } } Modified: trunk/fs/src/fs/org/jnode/fs/iso9660/SupplementaryVolumeDescriptor.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/iso9660/SupplementaryVolumeDescriptor.java 2010-03-26 13:23:12 UTC (rev 5733) +++ trunk/fs/src/fs/org/jnode/fs/iso9660/SupplementaryVolumeDescriptor.java 2010-03-26 13:23:34 UTC (rev 5734) @@ -17,7 +17,7 @@ * 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.fs.iso9660; import java.io.PrintStream; @@ -45,7 +45,7 @@ * @param buffer */ public SupplementaryVolumeDescriptor(ISO9660Volume volume, byte[] buffer) - throws UnsupportedEncodingException { + throws UnsupportedEncodingException { super(volume, buffer); this.flags = getUInt8(buffer, 8); this.escapeSequences = getDChars(buffer, 89, 121 - 89); @@ -71,8 +71,8 @@ public void dump(PrintStream out) { out.println("Supplementary Volume Descriptor"); out.println("\tFlags " + flags); - //out.println("\tEscape sequences " + escapeSequences); - //out.println("\tEncoding " + encoding); + // out.println("\tEscape sequences " + escapeSequences); + // out.println("\tEncoding " + encoding); out.println("\tSystemIdentifier " + systemIdentifier); out.println("\tVolumeIdentifier " + volumeIdentifier); out.println("\tVolume Space Size " + spaceSize); @@ -115,6 +115,7 @@ /** * Gets a derived encoding name from the given escape sequences. + * * @param escapeSequences * @return the encoding name */ @@ -136,6 +137,7 @@ /** * Is the used encoding known to this system. + * * @return {@code true} if the encoding known, otherwise {@code false}. */ public final boolean isEncodingKnown() { @@ -155,4 +157,5 @@ public final EntryRecord getRootDirectoryEntry() { return this.rootDirectoryEntry; } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2010-03-26 13:23:18
|
Revision: 5733 http://jnode.svn.sourceforge.net/jnode/?rev=5733&view=rev Author: galatnm Date: 2010-03-26 13:23:12 +0000 (Fri, 26 Mar 2010) Log Message: ----------- Fix dates. Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/ext2/Ext2Entry.java Modified: trunk/fs/src/fs/org/jnode/fs/ext2/Ext2Entry.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/ext2/Ext2Entry.java 2010-02-20 20:32:33 UTC (rev 5732) +++ trunk/fs/src/fs/org/jnode/fs/ext2/Ext2Entry.java 2010-03-26 13:23:12 UTC (rev 5733) @@ -17,7 +17,7 @@ * 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.fs.ext2; import java.io.IOException; @@ -30,11 +30,12 @@ /** * @author Andras Nagy * - * In case of a directory, the data will be parsed to get the file-list by - * Ext2Directory. In case of a regular file, no more processing is needed. + * In case of a directory, the data will be parsed to get the file-list + * by Ext2Directory. In case of a regular file, no more processing is + * needed. * - * TODO: besides getFile() and getDirectory(), we will need getBlockDevice() - * getCharacterDevice(), etc. + * TODO: besides getFile() and getDirectory(), we will need + * getBlockDevice() getCharacterDevice(), etc. */ public class Ext2Entry extends AbstractFSEntry { @@ -48,32 +49,32 @@ this.type = type; log.setLevel(Level.INFO); - log.debug("Ext2Entry(iNode, name): name=" + name + (isDirectory() ? " is a directory " : "") + - (isFile() ? " is a file " : "")); + log.debug("Ext2Entry(iNode, name): name=" + name + + (isDirectory() ? " is a directory " : "") + (isFile() ? " is a file " : "")); } public long getLastChanged() throws IOException { - return iNode.getCtime(); + return iNode.getCtime() * 1000; } public long getLastModified() throws IOException { - return iNode.getMtime(); + return iNode.getMtime() * 1000; } public long getLastAccessed() throws IOException { - return iNode.getAtime(); + return iNode.getAtime() * 1000; } public void setLastChanged(long lastChanged) throws IOException { - iNode.setCtime(lastChanged); + iNode.setCtime(lastChanged / 1000); } public void setLastModified(long lastModified) throws IOException { - iNode.setMtime(lastModified); + iNode.setMtime(lastModified / 1000); } public void setLastAccessed(long lastAccessed) throws IOException { - iNode.setAtime(lastAccessed); + iNode.setAtime(lastAccessed / 1000); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2010-02-20 20:32:40
|
Revision: 5732 http://jnode.svn.sourceforge.net/jnode/?rev=5732&view=rev Author: lsantha Date: 2010-02-20 20:32:33 +0000 (Sat, 20 Feb 2010) Log Message: ----------- The X86BytecodeVisitor is reused across method compilations. Modified Paths: -------------- trunk/core/src/core/org/jnode/vm/x86/compiler/X86CompilerHelper.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/EmitterContext.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompiler.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/VirtualStack.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86Level1ACompiler.java Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/X86CompilerHelper.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/X86CompilerHelper.java 2010-02-20 11:09:53 UTC (rev 5731) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/X86CompilerHelper.java 2010-02-20 20:32:33 UTC (rev 5732) @@ -103,7 +103,7 @@ */ public final int SLOTSIZE; - private final EntryPoints entryPoints; + private EntryPoints entryPoints; private VmMethod method; @@ -119,7 +119,7 @@ private final AbstractX86StackManager stackMgr; - private final X86Assembler os; + private X86Assembler os; private final Map<VmType<?>, Label> classInitLabels = new HashMap<VmType<?>, Label>(); @@ -159,6 +159,11 @@ haveCMOV = cpuId.hasFeature(X86CpuID.FEAT_CMOV); } + public void reset(X86Assembler x86Assembler, EntryPoints entryPoints) { + this.os = x86Assembler; + this.entryPoints = entryPoints; + } + /** * Reset the state of this helper. */ Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/EmitterContext.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/EmitterContext.java 2010-02-20 11:09:53 UTC (rev 5731) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/EmitterContext.java 2010-02-20 20:32:33 UTC (rev 5732) @@ -34,7 +34,7 @@ /** * The output stream */ - private final X86Assembler os; + private X86Assembler os; /** * Helper class @@ -64,7 +64,7 @@ /** * The compiler context */ - private final EntryPoints context; + private EntryPoints context; /** * Create a new context @@ -89,6 +89,13 @@ this.context = context; } + public void reset(X86Assembler os, EntryPoints entryPoints) { + this.os = os; + this.context = entryPoints; + gprPool.reset(os); + xmmPool.reset(os); + } + /** * Return the current emitter's stream * Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompiler.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompiler.java 2010-02-20 11:09:53 UTC (rev 5731) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompiler.java 2010-02-20 20:32:33 UTC (rev 5732) @@ -32,7 +32,7 @@ abstract class FPCompiler { protected final X86BytecodeVisitor bcv; - protected final X86Assembler os; + protected X86Assembler os; protected final EmitterContext ec; protected final VirtualStack vstack; protected final int arrayDataOffset; @@ -85,6 +85,11 @@ this.arrayDataOffset = arrayDataOffset; } + void reset(X86Assembler os) { + this.os = os; + vstack.reset(ec); + } + /** * fadd / dadd * Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/VirtualStack.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/VirtualStack.java 2010-02-20 11:09:53 UTC (rev 5731) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/VirtualStack.java 2010-02-20 20:32:33 UTC (rev 5732) @@ -20,7 +20,6 @@ package org.jnode.vm.x86.compiler.l1a; -import org.jnode.assembler.x86.X86Assembler; import org.jnode.assembler.x86.X86Register; import org.jnode.vm.JvmType; import org.jnode.vm.Vm; @@ -55,9 +54,8 @@ /** * Constructor; create and initialize stack with default size - * @param os */ - VirtualStack(X86Assembler os) { + VirtualStack() { this.operandStack = checkOperandStack ? new ItemStack(Item.Kind.STACK, Integer.MAX_VALUE) : null; stack = new Item[8]; tos = 0; Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java 2010-02-20 11:09:53 UTC (rev 5731) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java 2010-02-20 20:32:33 UTC (rev 5732) @@ -111,12 +111,12 @@ /** * The destination compiled method */ - private final CompiledMethod cm; + private CompiledMethod cm; /** * Current context */ - private final EntryPoints context; + private EntryPoints context; /** * Bytecode Address of current instruction @@ -156,7 +156,7 @@ /** * Emit logging info */ - private final boolean log; + private boolean log; /** * Maximum number of local variable slots @@ -166,7 +166,7 @@ /** * The output stream */ - private final X86Assembler os; + private X86Assembler os; /** * Should we set the current instruction label on startInstruction? @@ -201,7 +201,7 @@ /** * Magic method compiler */ - private final MagicHelper magicHelper; + private MagicHelper magicHelper; /** * FP instruction compiler @@ -211,7 +211,7 @@ /** * Type size information */ - private final TypeSizeInfo typeSizeInfo; + private TypeSizeInfo typeSizeInfo; /** * Current inline depth (starting at 0) @@ -248,6 +248,11 @@ private final CounterGroup counters = Vm.getVm().getCounterGroup(getClass().getName()); /** + * It is true while the compilation of a method is in progress. + */ + private boolean working; + + /** * Create a new instance * * @param outputStream @@ -264,7 +269,7 @@ this.context = context; this.typeSizeInfo = typeSizeInfo; this.magicHelper = magicHelper; - this.vstack = new VirtualStack(os); + this.vstack = new VirtualStack(); final X86RegisterPool gprPool; final X86RegisterPool xmmPool; if (os.isCode32()) { @@ -275,8 +280,7 @@ xmmPool = new X86RegisterPool.XMMs64(); } this.ifac = ItemFactory.getFactory(); - final AbstractX86StackManager stackMgr = vstack.createStackMgr(gprPool, - ifac); + final AbstractX86StackManager stackMgr = vstack.createStackMgr(gprPool, ifac); this.helper = new X86CompilerHelper(os, stackMgr, context, isBootstrap); this.cm = cm; final int slotSize = helper.SLOTSIZE; @@ -284,13 +288,26 @@ this.arrayDataOffset = VmArray.DATA_OFFSET * slotSize; this.tibOffset = ObjectLayout.TIB_SLOT * slotSize; this.log = os.isLogEnabled(); - this.eContext = new EmitterContext(os, helper, vstack, gprPool, - xmmPool, ifac, context); + this.eContext = new EmitterContext(os, helper, vstack, gprPool, xmmPool, ifac, context); vstack.initializeStackMgr(stackMgr, eContext); // TODO check for SSE support and switch to SSE compiler if available this.fpCompiler = new FPCompilerFPU(this, os, eContext, vstack, arrayDataOffset); } + public void reset(NativeStream os, CompiledMethod cm, boolean bootstrap, EntryPoints entryPoints, + MagicHelper magicHelper, TypeSizeInfo typeSizeInfo) { + this.os = (X86Assembler) os; + this.cm = cm; + this.context = entryPoints; + this.magicHelper = magicHelper; + this.typeSizeInfo = typeSizeInfo; + this.log = this.os.isLogEnabled(); + this.vstack.reset(eContext); + this.helper.reset((X86Assembler) os, entryPoints); + this.eContext.reset((X86Assembler) os, entryPoints); + this.fpCompiler.reset((X86Assembler) os); + } + private void assertCondition(boolean cond, String message) { if (!cond) throw new Error("assert failed at addresss " + curAddress + ": " @@ -639,7 +656,7 @@ /** * @see org.jnode.vm.bytecode.BytecodeVisitor#endMethod() */ - public void endMethod() { + public synchronized void endMethod() { stackFrame.emitTrailer(typeSizeInfo, maxLocals); if (ItemFactory.CHECK_BALANCED_ITEM_FACTORY) { if (!ifac.isBalanced()) { @@ -647,8 +664,13 @@ ifac.balance(); } } + working = false; } + public synchronized boolean isWorking() { + return working; + } + /** * A try block has finished */ @@ -1142,7 +1164,8 @@ * @param method * @see org.jnode.vm.bytecode.BytecodeVisitor#startMethod(org.jnode.vm.classmgr.VmMethod) */ - public void startMethod(VmMethod method) { + public synchronized void startMethod(VmMethod method) { + working = true; if (debug) { BootLog.debug("setMethod(" + method + ")"); } Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86Level1ACompiler.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86Level1ACompiler.java 2010-02-20 11:09:53 UTC (rev 5731) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86Level1ACompiler.java 2010-02-20 20:32:33 UTC (rev 5732) @@ -20,6 +20,8 @@ package org.jnode.vm.x86.compiler.l1a; +import java.util.ArrayList; +import java.util.List; import org.jnode.assembler.NativeStream; import org.jnode.assembler.ObjectResolver; import org.jnode.assembler.x86.X86BinaryAssembler; @@ -92,6 +94,10 @@ public X86Level1ACompiler() { } + private final ThreadLocal<X86BytecodeVisitor> byteCodeVisitorHolder = new ThreadLocal<X86BytecodeVisitor>(); + + private final ThreadLocal<List<X86BytecodeVisitor>> byteCodeVisitorListHolder = + new ThreadLocal<List<X86BytecodeVisitor>>(); /** * Create the visitor that converts bytecodes into native code. * @@ -107,7 +113,38 @@ boolean isBootstrap) { final InlineBytecodeVisitor cbv; final EntryPoints entryPoints = getEntryPoints(); - cbv = new X86BytecodeVisitor(os, cm, isBootstrap, entryPoints, getMagicHelper(), getTypeSizeInfo()); + X86BytecodeVisitor byteCodeVisitor = byteCodeVisitorHolder.get(); + if (byteCodeVisitor == null) { + byteCodeVisitor = new X86BytecodeVisitor(os, cm, isBootstrap, entryPoints, + getMagicHelper(), getTypeSizeInfo()); + byteCodeVisitorHolder.set(byteCodeVisitor); + } else { + if (byteCodeVisitor.isWorking()) { + //slow path + List<X86BytecodeVisitor> vlist = byteCodeVisitorListHolder.get(); + if (vlist == null) { + vlist = new ArrayList<X86BytecodeVisitor>(); + byteCodeVisitorListHolder.set(vlist); + } + byteCodeVisitor = null; + for (X86BytecodeVisitor bv : vlist) { + if (!bv.isWorking()) { + byteCodeVisitor = bv; + break; + } + } + if (byteCodeVisitor == null) { + byteCodeVisitor = new X86BytecodeVisitor(os, cm, isBootstrap, entryPoints, + getMagicHelper(), getTypeSizeInfo()); + vlist.add(byteCodeVisitor); + } else { + byteCodeVisitor.reset(os, cm, isBootstrap, entryPoints, getMagicHelper(), getTypeSizeInfo()); + } + } else { + byteCodeVisitor.reset(os, cm, isBootstrap, entryPoints, getMagicHelper(), getTypeSizeInfo()); + } + } + cbv = byteCodeVisitor; if (inlineMethods /*&& ((X86Assembler)os).isCode32()*/) { final VmClassLoader loader = method.getDeclaringClass().getLoader(); return new OptimizingBytecodeVisitor(entryPoints, cbv, loader); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2010-02-20 11:09:59
|
Revision: 5731 http://jnode.svn.sourceforge.net/jnode/?rev=5731&view=rev Author: lsantha Date: 2010-02-20 11:09:53 +0000 (Sat, 20 Feb 2010) Log Message: ----------- Cleanup of optimization experiments. Modified Paths: -------------- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java 2010-02-20 10:24:46 UTC (rev 5730) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java 2010-02-20 11:09:53 UTC (rev 5731) @@ -20,8 +20,6 @@ package org.jnode.vm.x86.compiler.l1a; -import java.util.HashMap; -import java.util.Map; import org.jnode.assembler.Label; import org.jnode.assembler.NativeStream; import org.jnode.assembler.x86.X86Assembler; @@ -221,16 +219,6 @@ private byte inlineDepth; /** - * Register used by wstore (see xloadStored methods) - */ - private GPR wstoreReg; - - /** - * Constant values that are stored in local variables - */ - private Map<Integer, Item> constLocals = new HashMap<Integer, Item>(); - - /** * The current basic block */ private BasicBlock currentBasicBlock; @@ -653,11 +641,6 @@ */ public void endMethod() { stackFrame.emitTrailer(typeSizeInfo, maxLocals); - //release constant local items - for (Item item : constLocals.values()) - item.release(eContext); - // Clear all constant locals - constLocals.clear(); if (ItemFactory.CHECK_BALANCED_ITEM_FACTORY) { if (!ifac.isBalanced()) { System.out.println("WARNING: unbalanced item handling in " + currentMethod.getFullName()); @@ -1082,12 +1065,6 @@ final TypeStack tstack = bb.getStartStack(); vstack.pushAll(ifac, tstack); - //release constant local items - for (Item item : constLocals.values()) - item.release(eContext); - // Clear all constant locals - constLocals.clear(); - if (debug) { BootLog.debug("-- VStack: " + vstack.toString()); } @@ -2502,11 +2479,6 @@ } else { os.writeADD(BITS32, helper.BP, ebpOfs, incValue); } - - // Local no longer constant - Item item = constLocals.remove(index); - if (item != null) - item.release(eContext); } /** @@ -4344,16 +4316,7 @@ * @param index */ private void wload(int jvmType, int index, boolean useStored) { - Item constValue = constLocals.get(index); - if (constValue != null) { - counters.getCounter("const-local").inc(); - vstack.push(constValue.clone(eContext)); - } else if (false && useStored && (wstoreReg != null)) { - vstack.push(L1AHelper.requestWordRegister(eContext, jvmType, wstoreReg)); - } else { - vstack.push(ifac.createLocal(jvmType, stackFrame - .getEbpOffset(typeSizeInfo, index))); - } + vstack.push(ifac.createLocal(jvmType, stackFrame.getEbpOffset(typeSizeInfo, index))); } /** @@ -4390,25 +4353,12 @@ */ private void wstore(int jvmType, int index) { final int disp = stackFrame.getEbpOffset(typeSizeInfo, index); - wstoreReg = null; - // Pin down (load) other references to this local vstack.loadLocal(eContext, disp); // Load final WordItem val = (WordItem) vstack.pop(jvmType); final boolean vconst = val.isConstant(); - if (vconst) { - // Store constant locals - Item item = constLocals.put(index, val.clone(eContext)); - if (item != null) - item.release(eContext); - } else { - // Not constant anymore, remove it - Item item = constLocals.remove(index); - if (item != null) - item.release(eContext); - } if (vconst && (jvmType == JvmType.INT)) { if (localEscapesBasicBlock(index)) { // Store constant int @@ -4443,7 +4393,6 @@ final GPR valr = val.getRegister(); // Store os.writeMOV(valr.getSize(), helper.BP, disp, valr); - wstoreReg = valr; } // Release This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2010-02-20 10:24:54
|
Revision: 5730 http://jnode.svn.sourceforge.net/jnode/?rev=5730&view=rev Author: lsantha Date: 2010-02-20 10:24:46 +0000 (Sat, 20 Feb 2010) Log Message: ----------- Fixed item recycling. Modified Paths: -------------- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemFactory.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemFactory.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemFactory.java 2010-02-19 20:58:45 UTC (rev 5729) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemFactory.java 2010-02-20 10:24:46 UTC (rev 5730) @@ -32,6 +32,7 @@ * @author Ewout Prangsma (ep...@us...) */ final class ItemFactory { + public static final boolean CHECK_BALANCED_ITEM_FACTORY = true; private static ThreadLocal itemFactory = new ThreadLocal(); @@ -47,8 +48,10 @@ private int createCount = 0; - protected int releaseCount = 0; + private int getOrCreateCount = 0; + private int releaseCount = 0; + /** * Create a constant item * @@ -217,7 +220,9 @@ */ @SuppressWarnings("unchecked") final <T extends Item> void release(T item) { - releaseCount++; + if (CHECK_BALANCED_ITEM_FACTORY) { + releaseCount++; + } if (Vm.VerifyAssertions) { Vm._assert(item.getKind() == 0, "Item is not yet released"); } @@ -240,6 +245,9 @@ * @return */ private Item getOrCreate(int jvmType) { + if (CHECK_BALANCED_ITEM_FACTORY) { + getOrCreateCount++; + } final ArrayList<? extends Item> list = getList(jvmType); final Item item; if (list.isEmpty()) { @@ -282,7 +290,9 @@ * @return */ private Item createNew(int jvmType) { - createCount++; + if (CHECK_BALANCED_ITEM_FACTORY) { + createCount++; + } switch (jvmType) { case JvmType.INT: return new IntItem(this); @@ -317,4 +327,12 @@ } return fac; } + + boolean isBalanced() { + return getOrCreateCount == releaseCount; + } + + void balance() { + getOrCreateCount = releaseCount = 0; + } } Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java 2010-02-19 20:58:45 UTC (rev 5729) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java 2010-02-20 10:24:46 UTC (rev 5730) @@ -653,6 +653,17 @@ */ public void endMethod() { stackFrame.emitTrailer(typeSizeInfo, maxLocals); + //release constant local items + for (Item item : constLocals.values()) + item.release(eContext); + // Clear all constant locals + constLocals.clear(); + if (ItemFactory.CHECK_BALANCED_ITEM_FACTORY) { + if (!ifac.isBalanced()) { + System.out.println("WARNING: unbalanced item handling in " + currentMethod.getFullName()); + ifac.balance(); + } + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2010-02-19 20:59:10
|
Revision: 5729 http://jnode.svn.sourceforge.net/jnode/?rev=5729&view=rev Author: lsantha Date: 2010-02-19 20:58:45 +0000 (Fri, 19 Feb 2010) Log Message: ----------- Added missing export. Modified Paths: -------------- trunk/core/descriptors/org.classpath.core.vm.xml Modified: trunk/core/descriptors/org.classpath.core.vm.xml =================================================================== --- trunk/core/descriptors/org.classpath.core.vm.xml 2010-02-19 12:35:53 UTC (rev 5728) +++ trunk/core/descriptors/org.classpath.core.vm.xml 2010-02-19 20:58:45 UTC (rev 5729) @@ -12,6 +12,7 @@ <runtime> <library name="jnode-core.jar"> + <export name="com.sun.management.*"/> <export name="gnu.classpath.*"/> <export name="gnu.classpath.jdwp.*"/> <export name="gnu.classpath.jdwp.transport.*"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2010-02-19 13:08:05
|
Revision: 5728 http://jnode.svn.sourceforge.net/jnode/?rev=5728&view=rev Author: galatnm Date: 2010-02-19 12:35:53 +0000 (Fri, 19 Feb 2010) Log Message: ----------- Correct behaviour for equals method of Key class. Modified Paths: -------------- trunk/core/src/core/org/jnode/assembler/x86/X86BinaryAssembler.java Modified: trunk/core/src/core/org/jnode/assembler/x86/X86BinaryAssembler.java =================================================================== --- trunk/core/src/core/org/jnode/assembler/x86/X86BinaryAssembler.java 2010-02-19 07:21:51 UTC (rev 5727) +++ trunk/core/src/core/org/jnode/assembler/x86/X86BinaryAssembler.java 2010-02-19 12:35:53 UTC (rev 5728) @@ -81,8 +81,9 @@ * @return Return {@code true} if obj is 'equal to' this, {@code false} otherwise. */ public final boolean equals(Object obj) { - // FIXME ... this method will throw exceptions where a well-behaved implementation - // of 'equals' should return false; i.e. if obj is null or not a Key. + if(obj==null || !(obj instanceof Key)){ + return false; + } obj = ((Key) obj).key; if (this.key instanceof Label) { return key.equals(obj); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2010-02-19 07:21:58
|
Revision: 5727 http://jnode.svn.sourceforge.net/jnode/?rev=5727&view=rev Author: lsantha Date: 2010-02-19 07:21:51 +0000 (Fri, 19 Feb 2010) Log Message: ----------- Code style fixes. Modified Paths: -------------- trunk/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java trunk/core/src/core/org/jnode/vm/compiler/CompilerBytecodeParser.java trunk/core/src/core/org/jnode/vm/compiler/CompilerBytecodeVisitor.java trunk/core/src/core/org/jnode/vm/compiler/EntryPoints.java trunk/core/src/core/org/jnode/vm/compiler/IMTCompiler.java trunk/core/src/core/org/jnode/vm/compiler/InlineBytecodeVisitor.java trunk/core/src/core/org/jnode/vm/compiler/OptimizingBytecodeVisitor.java trunk/core/src/core/org/jnode/vm/compiler/VerifyingCompilerBytecodeVisitor.java trunk/core/src/core/org/jnode/vm/x86/compiler/AbstractX86Compiler.java trunk/core/src/core/org/jnode/vm/x86/compiler/AbstractX86StackManager.java trunk/core/src/core/org/jnode/vm/x86/compiler/BaseX86MagicHelper.java trunk/core/src/core/org/jnode/vm/x86/compiler/X86CompilerHelper.java trunk/core/src/core/org/jnode/vm/x86/compiler/X86IMTCompiler32.java trunk/core/src/core/org/jnode/vm/x86/compiler/X86IMTCompiler64.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/DoubleItem.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/DoubleWordItem.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/EmitterContext.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompiler.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompilerFPU.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompilerSSE.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPUHelper.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPUStack.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FloatItem.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/InlinedMethodInfo.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/IntItem.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/Item.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemFactory.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemStack.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/L1AHelper.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/LongItem.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/MagicHelper.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/RefItem.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/VirtualStack.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/WordItem.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86Level1ACompiler.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86RegisterPool.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86StackFrame.java trunk/core/src/core/org/jnode/vm/x86/compiler/l1b/X86Level1BCompiler.java trunk/core/src/core/org/jnode/vm/x86/compiler/stub/X86StubCompiler.java Modified: trunk/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java =================================================================== --- trunk/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -69,14 +69,12 @@ import org.jnode.vm.x86.VmX86Processor32; import org.jnode.vm.x86.VmX86Processor64; import org.jnode.vm.x86.X86CpuID; -import org.jnode.vm.x86.compiler.X86CompilerConstants; import org.jnode.vm.x86.compiler.X86JumpTable; /** * @author epr */ -public class BootImageBuilder extends AbstractBootImageBuilder implements - X86CompilerConstants { +public class BootImageBuilder extends AbstractBootImageBuilder { public static final int LOAD_ADDR = 1024 * 1024; Modified: trunk/core/src/core/org/jnode/vm/compiler/CompilerBytecodeParser.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/CompilerBytecodeParser.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/compiler/CompilerBytecodeParser.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -35,6 +35,7 @@ /** * @param bc + * @param cfg * @param handler */ protected CompilerBytecodeParser(VmByteCode bc, ControlFlowGraph cfg, CompilerBytecodeVisitor handler) { Modified: trunk/core/src/core/org/jnode/vm/compiler/CompilerBytecodeVisitor.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/CompilerBytecodeVisitor.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/compiler/CompilerBytecodeVisitor.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -32,6 +32,7 @@ /** * The given basic block is about to start. + * @param bb */ public abstract void startBasicBlock(BasicBlock bb); @@ -57,6 +58,7 @@ /** * Push the given VmType on the stack. + * @param value */ public abstract void visit_ldc(VmType<?> value); Modified: trunk/core/src/core/org/jnode/vm/compiler/EntryPoints.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/EntryPoints.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/compiler/EntryPoints.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -127,10 +127,11 @@ /** * Create a new instance * - * @param loader + * @param loader the VmClassLoader instance + * @param heapManager heap manager + * @param magic the compiler magic ID */ - public EntryPoints(VmClassLoader loader, VmHeapManager heapManager, - int magic) { + public EntryPoints(VmClassLoader loader, VmHeapManager heapManager, int magic) { try { this.magic = magic; // VmMember class @@ -174,8 +175,7 @@ writeBarrier = (heapManager != null) ? heapManager .getWriteBarrier() : null; if (writeBarrier != null) { - final VmType wbClass = loader.loadClass(writeBarrier.getClass() - .getName(), true); + final VmType wbClass = loader.loadClass(writeBarrier.getClass().getName(), true); arrayStoreWriteBarrier = testMethod(wbClass.getMethod( "arrayStoreWriteBarrier", "(Ljava/lang/Object;ILjava/lang/Object;)V")); @@ -191,105 +191,79 @@ } // MonitorManager - this.vmMonitorManagerClass = loader.loadClass( - "org.jnode.vm.scheduler.MonitorManager", true); - monitorEnterMethod = testMethod(vmMonitorManagerClass.getMethod( - "monitorEnter", "(Ljava/lang/Object;)V")); - monitorExitMethod = testMethod(vmMonitorManagerClass.getMethod( - "monitorExit", "(Ljava/lang/Object;)V")); + this.vmMonitorManagerClass = loader.loadClass("org.jnode.vm.scheduler.MonitorManager", true); + monitorEnterMethod = testMethod(vmMonitorManagerClass.getMethod("monitorEnter", "(Ljava/lang/Object;)V")); + monitorExitMethod = testMethod(vmMonitorManagerClass.getMethod("monitorExit", "(Ljava/lang/Object;)V")); // MathSupport - final VmType vmClass = loader.loadClass("org.jnode.vm.MathSupport", - true); + final VmType vmClass = loader.loadClass("org.jnode.vm.MathSupport", true); ldivMethod = testMethod(vmClass.getMethod("ldiv", "(JJ)J")); lremMethod = testMethod(vmClass.getMethod("lrem", "(JJ)J")); // VmInstanceField - this.vmInstanceFieldClass = loader.loadClass( - "org.jnode.vm.classmgr.VmInstanceField", true); - vmFieldOffsetField = (VmInstanceField) testField(vmInstanceFieldClass - .getField("offset")); + this.vmInstanceFieldClass = loader.loadClass("org.jnode.vm.classmgr.VmInstanceField", true); + vmFieldOffsetField = (VmInstanceField) testField(vmInstanceFieldClass.getField("offset")); // VmStaticField - this.vmStaticFieldClass = loader.loadClass( - "org.jnode.vm.classmgr.VmStaticField", true); - vmFieldStaticsIndexField = (VmInstanceField) testField(vmStaticFieldClass - .getField("staticsIndex")); + this.vmStaticFieldClass = loader.loadClass("org.jnode.vm.classmgr.VmStaticField", true); + vmFieldStaticsIndexField = (VmInstanceField) testField(vmStaticFieldClass.getField("staticsIndex")); // VmInstanceMethod - this.vmInstanceMethodClass = loader.loadClass( - "org.jnode.vm.classmgr.VmInstanceMethod", true); - vmMethodTibOffsetField = (VmInstanceField) testField(vmInstanceMethodClass - .getField("tibOffset")); + this.vmInstanceMethodClass = loader.loadClass("org.jnode.vm.classmgr.VmInstanceMethod", true); + vmMethodTibOffsetField = (VmInstanceField) testField(vmInstanceMethodClass.getField("tibOffset")); // VmMethodCode - this.vmMethodCodeClass = loader.loadClass( - "org.jnode.vm.classmgr.VmMethodCode", true); - vmMethodSelectorField = (VmInstanceField) testField(vmInstanceMethodClass - .getField("selector")); - vmMethodNativeCodeField = (VmInstanceField) testField(vmInstanceMethodClass - .getField("nativeCode")); + this.vmMethodCodeClass = loader.loadClass("org.jnode.vm.classmgr.VmMethodCode", true); + vmMethodSelectorField = (VmInstanceField) testField(vmInstanceMethodClass.getField("selector")); + vmMethodNativeCodeField = (VmInstanceField) testField(vmInstanceMethodClass.getField("nativeCode")); // VmConstIMethodRef - final VmType cimrClass = loader.loadClass( - "org.jnode.vm.classmgr.VmConstIMethodRef", true); - this.vmConstIMethodRefSelectorField = (VmInstanceField) testField(cimrClass - .getField("selector")); + final VmType cimrClass = loader.loadClass("org.jnode.vm.classmgr.VmConstIMethodRef", true); + this.vmConstIMethodRefSelectorField = (VmInstanceField) testField(cimrClass.getField("selector")); // VmProcessor - final VmType processorClass = loader.loadClass( - "org.jnode.vm.scheduler.VmProcessor", true); + final VmType processorClass = loader.loadClass("org.jnode.vm.scheduler.VmProcessor", true); vmThreadSwitchIndicatorOffset = ((VmInstanceField) testField(processorClass.getField("threadSwitchIndicator"))).getOffset(); vmProcessorMeField = (VmInstanceField) testField(processorClass.getField("me")); - vmProcessorStackEnd = (VmInstanceField) testField(processorClass - .getField("stackEnd")); - vmProcessorSharedStaticsTable = (VmInstanceField) testField(processorClass - .getField("staticsTable")); + vmProcessorStackEnd = (VmInstanceField) testField(processorClass.getField("stackEnd")); + vmProcessorSharedStaticsTable = (VmInstanceField) testField(processorClass.getField("staticsTable")); vmProcessorIsolatedStaticsTable = (VmInstanceField) testField(processorClass .getField("isolatedStaticsTable")); // VmType - final VmType typeClass = loader.loadClass( - "org.jnode.vm.classmgr.VmType", true); - vmTypeInitialize = testMethod(typeClass.getMethod("initialize", - "()V")); - vmTypeModifiers = (VmInstanceField) testField(typeClass - .getField("modifiers")); - vmTypeState = (VmInstanceField) testField(typeClass - .getField("state")); + final VmType typeClass = loader.loadClass("org.jnode.vm.classmgr.VmType", true); + vmTypeInitialize = testMethod(typeClass.getMethod("initialize", "()V")); + vmTypeModifiers = (VmInstanceField) testField(typeClass.getField("modifiers")); + vmTypeState = (VmInstanceField) testField(typeClass.getField("state")); vmTypeCp = (VmInstanceField) testField(typeClass.getField("cp")); // VmCP - final VmType cpClass = loader.loadClass( - "org.jnode.vm.classmgr.VmCP", true); + final VmType cpClass = loader.loadClass("org.jnode.vm.classmgr.VmCP", true); vmCPCp = (VmInstanceField) testField(cpClass.getField("cp")); // VmProcessor // VmThread final VmType vmThreadClass = loader.loadClass("org.jnode.vm.scheduler.VmThread", true); - systemExceptionMethod = testMethod(vmThreadClass.getMethod( - "systemException", "(II)Ljava/lang/Throwable;")); + systemExceptionMethod = testMethod(vmThreadClass.getMethod("systemException", "(II)Ljava/lang/Throwable;")); // VmMethod - final VmType vmMethodClass = loader.loadClass( - "org.jnode.vm.classmgr.VmMethod", true); - recompileMethod = testMethod(vmMethodClass.getDeclaredMethod( - "recompileMethod", "(II)V")); + final VmType vmMethodClass = loader.loadClass("org.jnode.vm.classmgr.VmMethod", true); + recompileMethod = testMethod(vmMethodClass.getDeclaredMethod("recompileMethod", "(II)V")); } catch (ClassNotFoundException ex) { throw new NoClassDefFoundError(ex.getMessage()); } } - private final VmMethod testMethod(VmMethod method) { + private VmMethod testMethod(VmMethod method) { if (method == null) { throw new RuntimeException("Cannot find a method"); } return method; } - private final VmField testField(VmField field) { + private VmField testField(VmField field) { if (field == null) { throw new RuntimeException("Cannot find a field"); } Modified: trunk/core/src/core/org/jnode/vm/compiler/IMTCompiler.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/IMTCompiler.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/compiler/IMTCompiler.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -42,8 +42,10 @@ /** * Compile the given IMT. * + * @param resolver * @param imt * @param imtCollisions + * @return */ public abstract CompiledIMT compile(ObjectResolver resolver, Object[] imt, boolean[] imtCollisions); } Modified: trunk/core/src/core/org/jnode/vm/compiler/InlineBytecodeVisitor.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/InlineBytecodeVisitor.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/compiler/InlineBytecodeVisitor.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -52,6 +52,7 @@ /** * Leave the values on the stack and jump to the end of the inlined method. + * @param jvmType */ public abstract void visit_inlinedReturn(int jvmType); } Modified: trunk/core/src/core/org/jnode/vm/compiler/OptimizingBytecodeVisitor.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/OptimizingBytecodeVisitor.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/compiler/OptimizingBytecodeVisitor.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -158,11 +158,11 @@ /** * Initialize this instance. * + * @param entryPoints * @param delegate * @param loader */ - public OptimizingBytecodeVisitor(EntryPoints entryPoints, - InlineBytecodeVisitor delegate, VmClassLoader loader) { + public OptimizingBytecodeVisitor(EntryPoints entryPoints, InlineBytecodeVisitor delegate, VmClassLoader loader) { super(delegate); this.entryPoints = entryPoints; this.loader = loader; Modified: trunk/core/src/core/org/jnode/vm/compiler/VerifyingCompilerBytecodeVisitor.java =================================================================== --- trunk/core/src/core/org/jnode/vm/compiler/VerifyingCompilerBytecodeVisitor.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/compiler/VerifyingCompilerBytecodeVisitor.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -55,8 +55,8 @@ } /** - * @see org.jnode.vm.compiler.DelegatingCompilerBytecodeVisitor - * #visit_invokeinterface(org.jnode.vm.classmgr.VmConstIMethodRef, int) + * @see org.jnode.vm.compiler.DelegatingCompilerBytecodeVisitor#visit_invokeinterface( + * org.jnode.vm.classmgr.VmConstIMethodRef, int) */ @Override public void visit_invokeinterface(VmConstIMethodRef methodRef, int count) { @@ -65,8 +65,8 @@ } /** - * @see org.jnode.vm.compiler.DelegatingCompilerBytecodeVisitor - * #visit_invokespecial(org.jnode.vm.classmgr.VmConstMethodRef) + * @see org.jnode.vm.compiler.DelegatingCompilerBytecodeVisitor#visit_invokespecial( + * org.jnode.vm.classmgr.VmConstMethodRef) */ @Override public void visit_invokespecial(VmConstMethodRef methodRef) { @@ -75,8 +75,8 @@ } /** - * @see org.jnode.vm.compiler.DelegatingCompilerBytecodeVisitor - * #visit_invokestatic(org.jnode.vm.classmgr.VmConstMethodRef) + * @see org.jnode.vm.compiler.DelegatingCompilerBytecodeVisitor#visit_invokestatic( + * org.jnode.vm.classmgr.VmConstMethodRef) */ @Override public void visit_invokestatic(VmConstMethodRef methodRef) { @@ -85,8 +85,8 @@ } /** - * @see org.jnode.vm.compiler.DelegatingCompilerBytecodeVisitor - * #visit_invokevirtual(org.jnode.vm.classmgr.VmConstMethodRef) + * @see org.jnode.vm.compiler.DelegatingCompilerBytecodeVisitor#visit_invokevirtual( + * org.jnode.vm.classmgr.VmConstMethodRef) */ @Override public void visit_invokevirtual(VmConstMethodRef methodRef) { Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/AbstractX86Compiler.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/AbstractX86Compiler.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/AbstractX86Compiler.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -51,8 +51,7 @@ * @author Ewout Prangsma (ep...@us...) */ @MagicPermission -public abstract class AbstractX86Compiler extends NativeCodeCompiler implements - X86CompilerConstants { +public abstract class AbstractX86Compiler extends NativeCodeCompiler { private EntryPoints context; @@ -65,7 +64,7 @@ /** * Initialize this compiler * - * @param loader + * @param loader the VmClassLoader */ public final void initialize(VmClassLoader loader) { if (context == null) { Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/AbstractX86StackManager.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/AbstractX86StackManager.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/AbstractX86StackManager.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -42,8 +42,7 @@ * @param msbReg * @param jvmType the type of the registers contents as a {@link org.jnode.vm.JvmType}. */ - public void writePUSH64(int jvmType, X86Register.GPR lsbReg, - X86Register.GPR msbReg); + public void writePUSH64(int jvmType, X86Register.GPR lsbReg, X86Register.GPR msbReg); /** * Write code to push a 64-bit word on the stack Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/BaseX86MagicHelper.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/BaseX86MagicHelper.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/BaseX86MagicHelper.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -34,6 +34,7 @@ * Convert a method code into an X86 condition code. * * @param mcode + * @return */ protected final int methodToCC(MagicMethod mcode) { switch (mcode) { @@ -67,6 +68,7 @@ * Convert a method code into an X86 condition code. * * @param mcode + * @return */ protected final int methodToShift(MagicMethod mcode) { switch (mcode) { @@ -142,7 +144,7 @@ } } - protected static final int methodCodeToOperation(MagicMethod mcode) { + protected static int methodCodeToOperation(MagicMethod mcode) { switch (mcode) { case ATOMICADD: return X86Operation.ADD; Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/X86CompilerHelper.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/X86CompilerHelper.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/X86CompilerHelper.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -45,13 +45,18 @@ import org.jnode.vm.scheduler.VmProcessor; import org.jnode.vm.x86.X86CpuID; +import static org.jnode.vm.x86.compiler.X86CompilerConstants.BITS32; +import static org.jnode.vm.x86.compiler.X86CompilerConstants.BITS64; +import static org.jnode.vm.x86.compiler.X86CompilerConstants.INTSIZE; +import static org.jnode.vm.x86.compiler.X86CompilerConstants.PROCESSOR64; + /** * Helpers class used by the X86 compilers. * * @author epr * @author patrik_reali */ -public class X86CompilerHelper implements X86CompilerConstants { +public class X86CompilerHelper { /** * Address size ax register (EAX/RAX) Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/X86IMTCompiler32.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/X86IMTCompiler32.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/X86IMTCompiler32.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -32,11 +32,12 @@ import org.jnode.vm.compiler.CompiledIMT; import org.jnode.vm.compiler.IMTCompiler; +import static org.jnode.vm.x86.compiler.X86CompilerConstants.BITS32; + /** * @author Ewout Prangsma (ep...@us...) */ -public final class X86IMTCompiler32 extends IMTCompiler implements - X86CompilerConstants { +public final class X86IMTCompiler32 extends IMTCompiler { /** * Register that holds the selector @@ -60,6 +61,7 @@ * destroyed) * * @param os + * @param method */ public static void emitInvokeInterface(X86Assembler os, VmMethod method) { final int selector = method.getSelector(); @@ -95,8 +97,7 @@ * @see org.jnode.vm.compiler.IMTCompiler#compile(ObjectResolver, Object[], * boolean[]) */ - public CompiledIMT compile(ObjectResolver resolver__, Object[] imt, - boolean[] imtCollisions) { + public CompiledIMT compile(ObjectResolver resolver__, Object[] imt, boolean[] imtCollisions) { final int imtLength = imt.length; // Calculate size of code array @@ -186,10 +187,10 @@ * * @param code * @param ofs + * @param staticsIndex * @return the new offset */ - private final int genJmpStaticsCodeOfs(byte[] code, int ofs, - int staticsIndex) { + private int genJmpStaticsCodeOfs(byte[] code, int ofs, int staticsIndex) { final int offset = (staticsIndex + VmArray.DATA_OFFSET) * 4; // JMP [EDI+codeOfs] code[ofs++] = (byte) 0xFF; Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/X86IMTCompiler64.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/X86IMTCompiler64.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/X86IMTCompiler64.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -33,11 +33,12 @@ import org.jnode.vm.compiler.CompiledIMT; import org.jnode.vm.compiler.IMTCompiler; +import static org.jnode.vm.x86.compiler.X86CompilerConstants.BITS64; + /** * @author Ewout Prangsma (ep...@us...) */ -public final class X86IMTCompiler64 extends IMTCompiler implements - X86CompilerConstants { +public final class X86IMTCompiler64 extends IMTCompiler { /** * Size in bytes of an entry in the IMT jump table generated by this method. @@ -55,6 +56,7 @@ * destroyed) RDX is destroyed * * @param os + * @param method */ public static void emitInvokeInterface(X86Assembler os, VmMethod method) { final int selector = method.getSelector(); @@ -166,10 +168,10 @@ * * @param code * @param ofs + * @param staticsIndex * @return the new offset */ - private final int genJmpStaticsCodeOfs(byte[] code, int ofs, - int staticsIndex) { + private int genJmpStaticsCodeOfs(byte[] code, int ofs, int staticsIndex) { final int offset = (staticsIndex * 4) + (VmArray.DATA_OFFSET * 8); // JMP [RDI+codeOfs] code[ofs++] = (byte) 0xFF; Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/DoubleItem.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/DoubleItem.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/DoubleItem.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -28,6 +28,10 @@ import org.jnode.vm.JvmType; import org.jnode.vm.Vm; +import static org.jnode.vm.x86.compiler.X86CompilerConstants.BITS32; +import static org.jnode.vm.x86.compiler.X86CompilerConstants.LSB; +import static org.jnode.vm.x86.compiler.X86CompilerConstants.MSB; + /** * @author Patrik Reali */ @@ -37,14 +41,21 @@ /** * Initialize a blank item. + * + * @param factory the item factory which created this item. */ DoubleItem(ItemFactory factory) { super(factory); } /** + * @param ec * @param kind * @param offsetToFP + * @param lsb + * @param msb + * @param reg + * @param xmm * @param value */ final void initialize(EmitterContext ec, byte kind, short offsetToFP, X86Register.GPR lsb, @@ -55,7 +66,7 @@ } /** - * @see org.jnode.vm.x86.compiler.l1a.DoubleWordItem#cloneConstant() + * @see DoubleWordItem#cloneConstant(EmitterContext) */ protected DoubleWordItem cloneConstant(EmitterContext ec) { return factory.createDConst(ec, getValue()); @@ -89,8 +100,7 @@ * @param lsb * @param msb */ - protected final void loadToConstant32(EmitterContext ec, X86Assembler os, - GPR32 lsb, GPR32 msb) { + protected final void loadToConstant32(EmitterContext ec, X86Assembler os, GPR32 lsb, GPR32 msb) { final long lvalue = Double.doubleToLongBits(value); final int lsbv = (int) (lvalue & 0xFFFFFFFFL); final int msbv = (int) ((lvalue >>> 32) & 0xFFFFFFFFL); @@ -105,8 +115,7 @@ * @param os * @param reg */ - protected final void loadToConstant64(EmitterContext ec, X86Assembler os, - GPR64 reg) { + protected final void loadToConstant64(EmitterContext ec, X86Assembler os, GPR64 reg) { final long lvalue = Double.doubleToLongBits(value); os.writeMOV_Const(reg, lvalue); } @@ -144,8 +153,8 @@ /** * Push the given memory location on the FPU stack. * - * @param os - * @param reg + * @param os the assembler + * @param reg the * @param disp */ protected void pushToFPU(X86Assembler os, GPR reg, int disp) { Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/DoubleWordItem.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/DoubleWordItem.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/DoubleWordItem.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -27,13 +27,14 @@ import org.jnode.assembler.x86.X86Register.GPR64; import org.jnode.vm.JvmType; import org.jnode.vm.Vm; -import org.jnode.vm.x86.compiler.X86CompilerConstants; +import static org.jnode.vm.x86.compiler.X86CompilerConstants.INTSIZE; +import static org.jnode.vm.x86.compiler.X86CompilerConstants.BITS64; + /** * @author Ewout Prangsma (ep...@us...) */ -public abstract class DoubleWordItem extends Item implements - X86CompilerConstants { +public abstract class DoubleWordItem extends Item { /** * LSB Register in 32-bit mode @@ -52,16 +53,20 @@ /** * Initialize a blank item. + * @param factory */ protected DoubleWordItem(ItemFactory factory) { super(factory); } /** + * @param ec * @param kind * @param offsetToFP * @param lsb * @param msb + * @param reg + * @param xmm */ protected final void initialize(EmitterContext ec, byte kind, short offsetToFP, X86Register.GPR lsb, X86Register.GPR msb, X86Register.GPR64 reg, @@ -129,6 +134,7 @@ /** * Create a clone of this item, which must be a constant. * + * @param ec * @return the clone */ protected abstract DoubleWordItem cloneConstant(EmitterContext ec); @@ -148,6 +154,7 @@ * Gets the offset from the LSB part of this item to the FramePointer * register. This is only valid if this item has a LOCAL kind. * + * @param ec * @return the offset */ final int getLsbOffsetToFP(EmitterContext ec) { @@ -157,6 +164,7 @@ /** * Gets the register holding the LSB part of this item in 32-bit mode. * + * @param ec * @return the register */ final X86Register.GPR getLsbRegister(EmitterContext ec) { @@ -174,6 +182,7 @@ * Gets the offset from the MSB part of this item to the FramePointer * register. This is only valid if this item has a LOCAL kind. * + * @param ec * @return the offset */ final int getMsbOffsetToFP(EmitterContext ec) { @@ -183,6 +192,7 @@ /** * Gets the register holding the MSB part of this item in 32-bit mode. * + * @param ec * @return the register */ final X86Register.GPR getMsbRegister(EmitterContext ec) { @@ -199,6 +209,7 @@ /** * Gets the register holding this item in 64-bit mode. * + * @param ec * @return the register */ final X86Register.GPR64 getRegister(EmitterContext ec) { @@ -437,6 +448,7 @@ /** * Load my constant to the given os in 32-bit mode. * + * @param ec * @param os * @param lsb * @param msb @@ -447,6 +459,7 @@ /** * Load my constant to the given os in 64-bit mode. * + * @param ec * @param os * @param reg */ @@ -591,6 +604,7 @@ /** * Push my constant on the stack using the given os. * + * @param ec * @param os */ protected abstract void pushConstant(EmitterContext ec, X86Assembler os); @@ -680,9 +694,10 @@ } /** + * @param ec * @see org.jnode.vm.x86.compiler.l1a.Item#release(EmitterContext) */ - private final void cleanup(EmitterContext ec) { + private void cleanup(EmitterContext ec) { // assertCondition(!ec.getVStack().contains(this), "Cannot release while // on vstack"); final X86RegisterPool pool = ec.getGPRPool(); @@ -721,7 +736,7 @@ setKind((byte) 0); } - private final X86Register request(EmitterContext ec, X86RegisterPool pool) { + private X86Register request(EmitterContext ec, X86RegisterPool pool) { final X86Assembler os = ec.getStream(); final X86Register r; if (os.isCode32()) { Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/EmitterContext.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/EmitterContext.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/EmitterContext.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -68,6 +68,13 @@ /** * Create a new context + * @param os + * @param helper + * @param vstack + * @param gprPool + * @param xmmPool + * @param ifac + * @param context */ EmitterContext(X86Assembler os, X86CompilerHelper helper, VirtualStack vstack, X86RegisterPool gprPool, Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompiler.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompiler.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompiler.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -88,8 +88,6 @@ /** * fadd / dadd * - * @param ec - * @param vstack * @param type */ abstract void add(int type); @@ -97,9 +95,6 @@ /** * fcmpg, fcmpl, dcmpg, dcmpl * - * @param os - * @param ec - * @param vstack * @param gt * @param type * @param curInstrLabel @@ -109,16 +104,14 @@ /** * f2x / d2x * - * @param ec - * @param vstack + * @param fromType + * @param toType */ abstract void convert(int fromType, int toType); /** * fdiv / ddiv * - * @param ec - * @param vstack * @param type */ abstract void div(int type); @@ -126,8 +119,6 @@ /** * fmul / dmul * - * @param ec - * @param vstack * @param type */ abstract void mul(int type); @@ -135,8 +126,6 @@ /** * fneg / dneg * - * @param ec - * @param vstack * @param type */ abstract void neg(int type); @@ -144,8 +133,6 @@ /** * frem / drem * - * @param ec - * @param vstack * @param type */ abstract void rem(int type); @@ -153,8 +140,6 @@ /** * fsub / dsub * - * @param ec - * @param vstack * @param type */ abstract void sub(int type); Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompilerFPU.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompilerFPU.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompilerFPU.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -38,9 +38,11 @@ final class FPCompilerFPU extends FPCompiler { /** + * @param bcv * @param os * @param ec * @param vstack + * @param arrayDataOffset */ public FPCompilerFPU(X86BytecodeVisitor bcv, X86Assembler os, EmitterContext ec, VirtualStack vstack, int arrayDataOffset) { @@ -50,8 +52,6 @@ /** * fadd / dadd * - * @param ec - * @param vstack * @param type */ final void add(int type) { @@ -83,9 +83,6 @@ /** * fcmpg, fcmpl, dcmpg, dcmpl * - * @param os - * @param ec - * @param vstack * @param gt * @param type * @param curInstrLabel @@ -166,8 +163,6 @@ /** * f2x / d2x * - * @param ec - * @param vstack */ final void convert(int fromType, int toType) { final ItemFactory ifac = ec.getItemFactory(); @@ -191,8 +186,6 @@ /** * fdiv / ddiv * - * @param ec - * @param vstack * @param type */ final void div(int type) { @@ -230,7 +223,7 @@ * @param vstack * @param items */ - static final void ensureStackCapacity(X86Assembler os, EmitterContext ec, + static void ensureStackCapacity(X86Assembler os, EmitterContext ec, VirtualStack vstack, int items) { final FPUStack fpuStack = vstack.fpuStack; if (!fpuStack.hasCapacity(items)) { @@ -249,7 +242,7 @@ * @param fpuStack * @param fpuReg */ - private static final void fxchST1(X86Assembler os, FPUStack fpuStack, + private static void fxchST1(X86Assembler os, FPUStack fpuStack, FPU fpuReg) { // We need reg to be ST1, if not swap if (fpuReg != X86Register.ST1) { @@ -263,8 +256,6 @@ /** * fmul / dmul * - * @param ec - * @param vstack * @param type */ final void mul(int type) { @@ -296,8 +287,6 @@ /** * fneg / dneg * - * @param ec - * @param vstack * @param type */ final void neg(int type) { @@ -322,6 +311,11 @@ /** * Make sure that the given operand is on the top on the FPU stack. + * @param os + * @param ec + * @param vstack + * @param fpuStack + * @param left */ private static void prepareForOperation(X86Assembler os, EmitterContext ec, VirtualStack vstack, FPUStack fpuStack, @@ -355,8 +349,14 @@ * <p/> * The item at ST0 is popped of the given fpuStack stack. * + * @param os + * @param ec + * @param vstack + * @param fpuStack * @param left * @param right + * @param commutative + * @return */ private static FPU prepareForOperation(X86Assembler os, EmitterContext ec, VirtualStack vstack, FPUStack fpuStack, @@ -424,8 +424,6 @@ /** * frem / drem * - * @param ec - * @param vstack * @param type */ final void rem(int type) { @@ -462,8 +460,6 @@ /** * fsub / dsub * - * @param ec - * @param vstack * @param type */ final void sub(int type) { Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompilerSSE.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompilerSSE.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompilerSSE.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -91,7 +91,7 @@ * @param operation * @param commutative */ - private final void arithOperation(int type, int operation, boolean commutative) { + private void arithOperation(int type, int operation, boolean commutative) { final ItemFactory ifac = ec.getItemFactory(); Item v2 = vstack.pop(type); Item v1 = vstack.pop(type); @@ -138,7 +138,7 @@ * @return True if the operand must be swapped. when not commutative, false * is always returned. */ - private final boolean prepareForOperation(Item destAndSource, Item source, + private boolean prepareForOperation(Item destAndSource, Item source, boolean commutative) { // WARNING: source was on top of the virtual stack (thus higher than // destAndSource) Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPUHelper.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPUHelper.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPUHelper.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -24,12 +24,11 @@ import org.jnode.assembler.x86.X86Register; import org.jnode.assembler.x86.X86Register.FPU; import org.jnode.vm.bytecode.StackException; -import org.jnode.vm.x86.compiler.X86CompilerConstants; /** * @author Ewout Prangsma (ep...@us...) */ -final class FPUHelper implements X86CompilerConstants { +final class FPUHelper { /** * Swap ST0 and the given item. Action is emitted to code & performed on @@ -39,7 +38,7 @@ * @param fpuStack * @param item */ - static final void fxch(X86Assembler os, FPUStack fpuStack, Item item) { + static void fxch(X86Assembler os, FPUStack fpuStack, Item item) { if (!fpuStack.isTos(item)) { final FPU fpuReg = fpuStack.getRegister(item); fxch(os, fpuStack, fpuReg); @@ -53,7 +52,7 @@ * @param fpuStack * @param fpuReg */ - static final void fxch(X86Assembler os, FPUStack fpuStack, + static void fxch(X86Assembler os, FPUStack fpuStack, FPU fpuReg) { if (fpuReg == X86Register.ST0) { throw new StackException("Cannot fxch ST0"); Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPUStack.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPUStack.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FPUStack.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -58,6 +58,8 @@ /** * Gets the item that is contained in the given register. + * @param fpuReg + * @return */ final Item getItem(FPU fpuReg) { final int idx = tos - (fpuReg.getNr() + 1); Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FloatItem.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FloatItem.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/FloatItem.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -52,7 +52,7 @@ } /** - * @see org.jnode.vm.x86.compiler.l1a.WordItem#cloneConstant() + * @see org.jnode.vm.x86.compiler.l1a.WordItem#cloneConstant(EmitterContext) */ protected WordItem cloneConstant(EmitterContext ec) { return factory.createFConst(ec, getValue()); Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/InlinedMethodInfo.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/InlinedMethodInfo.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/InlinedMethodInfo.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -45,7 +45,10 @@ /** * Initialize this instance. * + * @param previous * @param inlinedMethod + * @param endOfInlineLabel + * @param previousLabelPrefix */ public InlinedMethodInfo(InlinedMethodInfo previous, VmMethod inlinedMethod, Label endOfInlineLabel, String previousLabelPrefix) { @@ -69,6 +72,7 @@ /** * Push the stack elements of the outer method stack. * + * @param ifac * @param vstack */ final void pushOuterMethodStack(ItemFactory ifac, VirtualStack vstack) { @@ -78,6 +82,7 @@ /** * Push the stack elements of the outer method stack and the exit stack. * + * @param ifac * @param vstack * @param eContext */ Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/IntItem.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/IntItem.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/IntItem.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -25,7 +25,6 @@ import org.jnode.assembler.x86.X86Register.GPR; import org.jnode.vm.JvmType; import org.jnode.vm.Vm; -import org.jnode.vm.x86.compiler.X86CompilerConstants; /** * @author Patrik Reali @@ -33,7 +32,7 @@ * IntItems are items with type INT */ -final class IntItem extends WordItem implements X86CompilerConstants { +final class IntItem extends WordItem { private int value; @@ -47,7 +46,7 @@ } /** - * @see org.jnode.vm.x86.compiler.l1a.WordItem#cloneConstant() + * @see org.jnode.vm.x86.compiler.l1a.WordItem#cloneConstant(EmitterContext) */ protected WordItem cloneConstant(EmitterContext ec) { return factory.createIConst(ec, getValue()); Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/Item.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/Item.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/Item.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -75,7 +75,7 @@ */ static final byte LOCAL = 0x20; - public static final String toString(int kind) { + public static String toString(int kind) { switch (kind) { case STACK: return "STACK"; @@ -117,6 +117,7 @@ /** * Initialize a blank item. + * @param factory */ protected Item(ItemFactory factory) { this.factory = factory; @@ -185,6 +186,7 @@ /** * Is this item on the stack + * @return */ final boolean isStack() { return (kind == Kind.STACK); @@ -192,6 +194,7 @@ /** * Is this item in a general purpose register + * @return */ final boolean isGPR() { return (kind == Kind.GPR); @@ -199,6 +202,7 @@ /** * Is this item in a SSE register + * @return */ final boolean isXMM() { return (kind == Kind.XMM); @@ -206,6 +210,7 @@ /** * Is this item on the FPU stack + * @return */ final boolean isFPUStack() { return (kind == Kind.FPUSTACK); @@ -213,6 +218,7 @@ /** * Is this item a local variable + * @return */ final boolean isLocal() { return (kind == Kind.LOCAL); @@ -220,6 +226,7 @@ /** * Is this item a constant + * @return */ final boolean isConstant() { return (kind == Kind.CONSTANT); @@ -240,6 +247,7 @@ * Gets the offset from this item to the FramePointer register. This is only * valid if this item has a LOCAL kind. * + * @param ec * @return */ short getOffsetToFP(EmitterContext ec) { @@ -265,6 +273,7 @@ /** * Is this item located at the given FP offset. * + * @param offset * @return */ boolean isAtOffset(int offset) { @@ -297,6 +306,8 @@ /** * Load item into a register / two registers / an FPU register depending on * its type, if its kind matches the mask + * @param eContext + * @param mask */ final void loadIf(EmitterContext eContext, int mask) { if ((kind & mask) > 0) { @@ -306,6 +317,8 @@ /** * Load item into an XMM register if its kind matches the mask + * @param eContext + * @param mask */ final void loadToXMMIf(EmitterContext eContext, int mask) { if ((kind & mask) > 0) { @@ -331,6 +344,7 @@ /** * Push the value of this item on the FPU stack. The item itself is not * changed in any way. + * @param ec */ abstract void pushToFPU(EmitterContext ec); @@ -364,6 +378,8 @@ /** * Spill this item if it uses the given register. + * @param ec + * @param reg */ final void spillIfUsing(EmitterContext ec, X86Register reg) { if (uses(reg)) { @@ -382,7 +398,7 @@ /** * enquire whether the item uses a volatile register * - * @param reg + * @param pool * @return true, when this item uses a volatile register. */ abstract boolean usesVolatileRegister(X86RegisterPool pool); @@ -390,6 +406,7 @@ /** * Verify the consistency of the state of this item. * Throw an exception is the state is inconsistent. + * @param ec */ protected abstract void verifyState(EmitterContext ec); Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemFactory.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemFactory.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemFactory.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -52,7 +52,9 @@ /** * Create a constant item * + * @param ec * @param val + * @return */ final IntItem createIConst(EmitterContext ec, int val) { final IntItem item = (IntItem) getOrCreate(JvmType.INT); @@ -63,7 +65,9 @@ /** * Create a constant item * + * @param ec * @param val + * @return */ final FloatItem createFConst(EmitterContext ec, float val) { final FloatItem item = (FloatItem) getOrCreate(JvmType.FLOAT); @@ -74,7 +78,9 @@ /** * Create a constant item * + * @param ec * @param val + * @return */ final RefItem createAConst(EmitterContext ec, VmConstString val) { final RefItem item = (RefItem) getOrCreate(JvmType.REFERENCE); @@ -85,7 +91,9 @@ /** * Create a constant item * + * @param ec * @param val + * @return */ final LongItem createLConst(EmitterContext ec, long val) { final LongItem item = (LongItem) getOrCreate(JvmType.LONG); @@ -96,7 +104,9 @@ /** * Create a constant item * + * @param ec * @param val + * @return */ final DoubleItem createDConst(EmitterContext ec, double val) { final DoubleItem item = (DoubleItem) getOrCreate(JvmType.DOUBLE); @@ -108,6 +118,7 @@ * Create a stack item. * * @param jvmType + * @return */ public Item createStack(int jvmType) { final Item item = getOrCreate(jvmType); @@ -119,6 +130,7 @@ * Create an FPU stack item. * * @param jvmType + * @return */ public Item createFPUStack(int jvmType) { final Item item = getOrCreate(jvmType); @@ -130,6 +142,8 @@ * Create an LOCAL item. * * @param jvmType + * @param ebpOffset + * @return */ public Item createLocal(int jvmType, short ebpOffset) { final Item item = getOrCreate(jvmType); @@ -141,6 +155,8 @@ * Create an XMM item. * * @param jvmType + * @param xmm + * @return */ public Item createLocal(int jvmType, X86Register.XMM xmm) { final Item item = getOrCreate(jvmType); @@ -151,8 +167,10 @@ /** * Create a word register item. * + * @param ec * @param jvmType * @param reg + * @return */ public WordItem createReg(EmitterContext ec, int jvmType, X86Register reg) { final WordItem item = (WordItem) getOrCreate(jvmType); @@ -163,9 +181,11 @@ /** * Create a doubleword register item. * + * @param ec * @param jvmType * @param lsb * @param msb + * @return */ public DoubleWordItem createReg(EmitterContext ec, int jvmType, X86Register.GPR lsb, X86Register.GPR msb) { if (!ec.getStream().isCode32()) { @@ -179,9 +199,10 @@ /** * Create a doubleword register item. * + * @param ec * @param jvmType - * @param lsb - * @param msb + * @param reg + * @return */ public DoubleWordItem createReg(EmitterContext ec, int jvmType, X86Register.GPR64 reg) { final DoubleWordItem item = (DoubleWordItem) getOrCreate(jvmType); @@ -216,8 +237,9 @@ * Get an item out of the cache or if not present, create a new one. * * @param jvmType + * @return */ - private final Item getOrCreate(int jvmType) { + private Item getOrCreate(int jvmType) { final ArrayList<? extends Item> list = getList(jvmType); final Item item; if (list.isEmpty()) { @@ -234,8 +256,9 @@ * Gets the cache array for a given type. * * @param jvmType + * @return */ - private final ArrayList<? extends Item> getList(int jvmType) { + private ArrayList<? extends Item> getList(int jvmType) { switch (jvmType) { case JvmType.INT: return intItems; @@ -256,8 +279,9 @@ * Create a new item of a given type. * * @param jvmType + * @return */ - private final Item createNew(int jvmType) { + private Item createNew(int jvmType) { createCount++; switch (jvmType) { case JvmType.INT: @@ -283,8 +307,9 @@ /** * Gets the item factory. This item factory is singleton per thread. + * @return */ - static final ItemFactory getFactory() { + static ItemFactory getFactory() { ItemFactory fac = (ItemFactory) itemFactory.get(); if (fac == null) { fac = new ItemFactory(); Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemStack.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemStack.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/ItemStack.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -51,6 +51,8 @@ /** * Constructor; create and initialize stack with default size + * @param expectedKind + * @param maxSize */ ItemStack(int expectedKind, int maxSize) { this.expectedKind = expectedKind; @@ -78,7 +80,7 @@ /** * Grow the stack capacity. */ - private final void grow() { + private void grow() { if (stack.length == maxSize) { throw new StackException("Stack full"); } else { @@ -165,6 +167,7 @@ /** * Reset this stack. The stack will be empty afterwards. + * @param ec */ final void reset(EmitterContext ec) { while (tos != 0) { Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/L1AHelper.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/L1AHelper.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/L1AHelper.java 2010-02-19 07:21:51 UTC (rev 5727) @@ -32,12 +32,12 @@ */ final class L1AHelper { - static final void assertCondition(boolean cond, String message) { + static void assertCondition(boolean cond, String message) { if (!cond) throw new Error("assert failed: " + message); } - static final void assertCondition(boolean cond, String message, Object param) { + static void assertCondition(boolean cond, String message, Object param) { if (!cond) { throw new Error("assert failed: " + message + param); } @@ -46,27 +46,32 @@ /** * Gets the 64-bit equivalent of the given 32-bit register. * + * @param eContext * @param src * @return the 64-bit register. */ - static final GPR64 get64BitReg(EmitterContext eContext, GPR src) { + static GPR64 get64BitReg(EmitterContext eContext, GPR src) { return (GPR64) eContext.getGPRPool().getRegisterInSameGroup(src, JvmType.LONG); } /** * Release a register. * + * @param eContext * @param reg */ - static final void releaseRegister(EmitterContext eContext, X86Register reg) { + static void releaseRegister(EmitterContext eContext, X86Register reg) { final X86RegisterPool pool = eContext.getGPRPool(); pool.release(reg); } /** * Request two register for a 8-byte item. + * @param eContext + * @param jvmType + * @return */ - static final DoubleWordItem requestDoubleWordRegisters( + static DoubleWordItem requestDoubleWordRegisters( EmitterContext eContext, int jvmType) { final X86RegisterPool pool = eContext.getGPRPool(); final X86Assembler os = eContext.getStream(); @@ -89,8 +94,13 @@ /** * Request two register for a 8-byte item. + * @param eContext + * @param jvmType + * @param lsb + * @param msb + * @return */ - static final DoubleWordItem requestDoubleWordRegisters( + static DoubleWordItem requestDoubleWordRegisters( EmitterContext eContext, int jvmType, X86Register.GPR lsb, X86Register.GPR msb) { if (!eContext.getStream().isCode32()) { throw new IllegalModeException("Only support in 32-bit mode"); @@ -108,8 +118,12 @@ /** * Request a 64-bit register for a 8-byte item. + * @param eContext + * @param jvmType + * @param reg + * @return */ - static final DoubleWordItem requestDoubleWordRegister( + static DoubleWordItem requestDoubleWordRegister( EmitterContext eContext, int jvmType, GPR64 reg) { if (!eContext.getStream().isCode64()) { throw new IllegalModeException("Only support in 64-bit mode"); @@ -126,9 +140,10 @@ * Request a register for calcuation, not tied to an item. Make sure to * release the register afterwards. * + * @param eContext * @param reg */ - static final void requestRegister(EmitterContext eContext, X86Register reg) { + static void requestRegister(EmitterContext eContext, X86Register reg) { final X86RegisterPool pool = eContext.getGPRPool(); if (!pool.isFree(reg)) { final Item i = (Item) pool.getOwner(reg); @@ -142,8 +157,12 @@ /** * Request a register of a given type, not tied to an item. Make sure to * release the register afterwards. + * @param eContext + * @param type + * @param supportsBits8 + * @return */ - static final X86Register requestRegister(EmitterContext eContext, int type, + static X86Register requestRegister(EmitterContext eContext, int type, boolean supportsBits8) { final X86RegisterPool pool = eContext.getGPRPool(); X86Register r = pool.request(type, supportsBits8); @@ -159,10 +178,11 @@ * reserve a register for an item. The item is not loaded with the register. * The register is spilled if another item holds it. * + * @param eContext * @param reg the register to reserve * @param it the item requiring the register */ - static final void requestRegister(EmitterContext eContext, X86Register reg, + static void requestRegister(EmitterContext eContext, X86Register reg, Item it) { final X86RegisterPool pool = eContext.getGPRPool(); @@ -182,8 +202,12 @@ /** * Request one register for a single word item. + * @param eContext + * @param jvmType + * @param supportsBits8 + * @return */ - static final WordItem requestWordRegister(EmitterContext eContext, + static WordItem requestWordRegister(EmitterContext eContext, int jvmType, boolean supportsBits8) { final X86RegisterPool pool = eContext.getGPRPool(); final ItemFactory ifac = eContext.getItemFactory(); @@ -196,8 +220,12 @@ /** * Request specific one register for a single word item. + * @param eContext + * @param jvmType + * @param reg + * @return */ - static final WordItem requestWordRegister(EmitterContext eContext, + static WordItem requestWordRegister(EmitterContext eContext, int jvmType, X86Register reg) { final X86RegisterPool pool = eContext.getGPRPool(); final ItemFactory ifac = eContext.getItemFactory(); Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/LongItem.java =================================================================== --- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/LongItem.java 2010-02-13 22:12:20 UTC (rev 5726) +++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/LongIt... [truncated message content] |