|
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] |