|
From: <ls...@us...> - 2008-07-17 10:45:57
|
Revision: 4306
http://jnode.svn.sourceforge.net/jnode/?rev=4306&view=rev
Author: lsantha
Date: 2008-07-17 10:45:28 +0000 (Thu, 17 Jul 2008)
Log Message:
-----------
Integrated java.awt.Toolkit from OpenJDK.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/awt/Toolkit.java
Removed Paths:
-------------
trunk/core/src/classpath/java/java/awt/Toolkit.java
Deleted: trunk/core/src/classpath/java/java/awt/Toolkit.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/Toolkit.java 2008-07-17 10:15:31 UTC (rev 4305)
+++ trunk/core/src/classpath/java/java/awt/Toolkit.java 2008-07-17 10:45:28 UTC (rev 4306)
@@ -1,1535 +0,0 @@
-/* Toolkit.java -- AWT Toolkit superclass
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath 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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import gnu.classpath.SystemProperties;
-import gnu.java.awt.AWTUtilities;
-import gnu.java.awt.peer.GLightweightPeer;
-import gnu.java.awt.peer.headless.HeadlessToolkit;
-
-import java.awt.datatransfer.Clipboard;
-import java.awt.dnd.DragGestureEvent;
-import java.awt.dnd.DragGestureListener;
-import java.awt.dnd.DragGestureRecognizer;
-import java.awt.dnd.DragSource;
-import java.awt.dnd.peer.DragSourceContextPeer;
-import java.awt.event.AWTEventListener;
-import java.awt.event.AWTEventListenerProxy;
-import java.awt.event.KeyEvent;
-import java.awt.font.TextAttribute;
-import java.awt.im.InputMethodHighlight;
-import java.awt.image.ColorModel;
-import java.awt.image.ImageObserver;
-import java.awt.image.ImageProducer;
-import java.awt.peer.ButtonPeer;
-import java.awt.peer.CanvasPeer;
-import java.awt.peer.CheckboxMenuItemPeer;
-import java.awt.peer.CheckboxPeer;
-import java.awt.peer.ChoicePeer;
-import java.awt.peer.DialogPeer;
-import java.awt.peer.FileDialogPeer;
-import java.awt.peer.FontPeer;
-import java.awt.peer.FramePeer;
-import java.awt.peer.LabelPeer;
-import java.awt.peer.LightweightPeer;
-import java.awt.peer.ListPeer;
-import java.awt.peer.MenuBarPeer;
-import java.awt.peer.MenuItemPeer;
-import java.awt.peer.MenuPeer;
-import java.awt.peer.MouseInfoPeer;
-import java.awt.peer.PanelPeer;
-import java.awt.peer.PopupMenuPeer;
-import java.awt.peer.ScrollPanePeer;
-import java.awt.peer.ScrollbarPeer;
-import java.awt.peer.TextAreaPeer;
-import java.awt.peer.TextFieldPeer;
-import java.awt.peer.WindowPeer;
-import java.awt.peer.DesktopPeer;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.io.File;
-import java.io.FileInputStream;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import org.jnode.vm.annotation.SharedStatics;
-
-/**
- * The AWT system uses a set of native peer objects to implement its
- * widgets. These peers are provided by a peer toolkit, that is accessed
- * via a subclass of this superclass. The system toolkit is retrieved
- * by the static methods <code>getDefaultToolkit</code>. This method
- * determines the system toolkit by examining the system property
- * <code>awt.toolkit</code>. That property is set to the name of the
- * <code>Toolkit</code> subclass for the specified peer set. If the
- * <code>awt.toolkit</code> property is not set, then the default
- * toolkit <code>gnu.java.awt.peer.gtk.GtkToolkit</code> is used. This
- * toolkit creates its peers using the GTK+ toolkit.
- *
- * @author Aaron M. Renn (ar...@ur...)
- */
-@SharedStatics
-public abstract class Toolkit
-{
- /** The default toolkit name. */
- private static String default_toolkit_name
- = gnu.classpath.Configuration.default_awt_peer_toolkit;
-
- /**
- * The toolkit in use. Once we load it, we don't ever change it
- * if the awt.toolkit property is set.
- */
- private static Toolkit toolkit;
-
- /** The toolkit properties. */
- private static Properties props = new Properties();
-
- protected final Map<String,Object> desktopProperties =
- new Hashtable<String,Object>();
-
- protected final PropertyChangeSupport desktopPropsSupport
- = new PropertyChangeSupport(this);
-
- /**
- * All registered AWTEventListener objects. This is package private, so the
- * event queue can efficiently access this list.
- */
- AWTEventListenerProxy[] awtEventListeners;
-
- /**
- * The shared peer for all lightweight components.
- */
- private GLightweightPeer lightweightPeer;
-
- /**
- * Default constructor for subclasses.
- */
- public Toolkit()
- {
- awtEventListeners = new AWTEventListenerProxy[0];
- }
-
- /**
- * Creates a peer object for the specified <code>Button</code>.
- *
- * @param target The <code>Button</code> to create the peer for.
- *
- * @return The peer for the specified <code>Button</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract ButtonPeer createButton(Button target);
-
- /**
- * Creates a peer object for the specified <code>TextField</code>.
- *
- * @param target The <code>TextField</code> to create the peer for.
- *
- * @return The peer for the specified <code>TextField</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract TextFieldPeer createTextField(TextField target);
-
- /**
- * Creates a peer object for the specified <code>Label</code>.
- *
- * @param target The <code>Label</code> to create the peer for.
- *
- * @return The peer for the specified <code>Label</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract LabelPeer createLabel(Label target);
-
- /**
- * Creates a peer object for the specified <code>List</code>.
- *
- * @param target The <code>List</code> to create the peer for.
- *
- * @return The peer for the specified <code>List</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract ListPeer createList(List target);
-
- /**
- * Creates a peer object for the specified <code>Checkbox</code>.
- *
- * @param target The <code>Checkbox</code> to create the peer for.
- *
- * @return The peer for the specified <code>Checkbox</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract CheckboxPeer createCheckbox(Checkbox target);
-
- /**
- * Creates a peer object for the specified <code>Scrollbar</code>.
- *
- * @param target The <code>Scrollbar</code> to create the peer for.
- *
- * @return The peer for the specified <code>Scrollbar</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract ScrollbarPeer createScrollbar(Scrollbar target);
-
- /**
- * Creates a peer object for the specified <code>ScrollPane</code>.
- *
- * @param target The <code>ScrollPane</code> to create the peer for.
- *
- * @return The peer for the specified <code>ScrollPane</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract ScrollPanePeer createScrollPane(ScrollPane target);
-
- /**
- * Creates a peer object for the specified <code>TextArea</code>.
- *
- * @param target The <code>TextArea</code> to create the peer for.
- *
- * @return The peer for the specified <code>TextArea</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract TextAreaPeer createTextArea(TextArea target);
-
- /**
- * Creates a peer object for the specified <code>Choice</code>.
- *
- * @param target The <code>Choice</code> to create the peer for.
- *
- * @return The peer for the specified <code>Choice</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract ChoicePeer createChoice(Choice target);
-
- /**
- * Creates a peer object for the specified <code>Frame</code>.
- *
- * @param target The <code>Frame</code> to create the peer for.
- *
- * @return The peer for the specified <code>Frame</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract FramePeer createFrame(Frame target);
-
- /**
- * Creates a peer object for the specified <code>Canvas</code>.
- *
- * @param target The <code>Canvas</code> to create the peer for.
- *
- * @return The peer for the specified <code>Canvas</code> object.
- */
- protected abstract CanvasPeer createCanvas(Canvas target);
-
- /**
- * Creates a peer object for the specified <code>Panel</code>.
- *
- * @param target The <code>Panel</code> to create the peer for.
- *
- * @return The peer for the specified <code>Panel</code> object.
- */
- protected abstract PanelPeer createPanel(Panel target);
-
- /**
- * Creates a peer object for the specified <code>Window</code>.
- *
- * @param target The <code>Window</code> to create the peer for.
- *
- * @return The peer for the specified <code>Window</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract WindowPeer createWindow(Window target);
-
- /**
- * Creates a peer object for the specified <code>Dialog</code>.
- *
- * @param target The dialog to create the peer for
- *
- * @return The peer for the specified font name.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract DialogPeer createDialog(Dialog target);
-
- /**
- * Creates a peer object for the specified <code>MenuBar</code>.
- *
- * @param target The <code>MenuBar</code> to create the peer for.
- *
- * @return The peer for the specified <code>MenuBar</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract MenuBarPeer createMenuBar(MenuBar target);
-
- /**
- * Creates a peer object for the specified <code>Menu</code>.
- *
- * @param target The <code>Menu</code> to create the peer for.
- *
- * @return The peer for the specified <code>Menu</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract MenuPeer createMenu(Menu target);
-
- /**
- * Creates a peer object for the specified <code>PopupMenu</code>.
- *
- * @param target The <code>PopupMenu</code> to create the peer for.
- *
- * @return The peer for the specified <code>PopupMenu</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract PopupMenuPeer createPopupMenu(PopupMenu target);
-
- /**
- * Creates a peer object for the specified <code>MenuItem</code>.
- *
- * @param target The <code>MenuItem</code> to create the peer for.
- *
- * @return The peer for the specified <code>MenuItem</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract MenuItemPeer createMenuItem(MenuItem target);
-
- /**
- * Returns a MouseInfoPeer.
- * The default implementation of this method throws
- * UnsupportedOperationException.
- *
- * Toolkit implementations should overload this if possible, however.
- */
- protected MouseInfoPeer getMouseInfoPeer()
- {
- throw new UnsupportedOperationException("No mouse info peer.");
- }
-
- /**
- * Creates a peer object for the specified <code>FileDialog</code>.
- *
- * @param target The <code>FileDialog</code> to create the peer for.
- *
- * @return The peer for the specified <code>FileDialog</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract FileDialogPeer createFileDialog(FileDialog target);
-
- /**
- * Creates a peer object for the specified <code>CheckboxMenuItem</code>.
- *
- * @param target The <code>CheckboxMenuItem</code> to create the peer for.
- *
- * @return The peer for the specified <code>CheckboxMenuItem</code> object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract CheckboxMenuItemPeer
- createCheckboxMenuItem(CheckboxMenuItem target);
-
- /**
- * Creates a peer object for the specified <code>Component</code>. The
- * peer returned by this method is not a native windowing system peer
- * with its own native window. Instead, this method allows the component
- * to draw on its parent window as a "lightweight" widget.
- *
- * @param target The <code>Component</code> to create the peer for.
- *
- * @return The peer for the specified <code>Component</code> object.
- */
- protected LightweightPeer createComponent(Component target)
- {
- if (lightweightPeer == null)
- lightweightPeer = new GLightweightPeer();
- return lightweightPeer;
- }
-
- /**
- * Creates a peer object for the specified font name.
- *
- * @param name The font to create the peer for.
- * @param style The font style to create the peer for.
- *
- * @return The peer for the specified font name.
- *
- * @deprecated
- */
- protected abstract FontPeer getFontPeer(String name, int style);
-
- /**
- * Copies the current system colors into the specified array. This is
- * the interface used by the <code>SystemColor</code> class. Although
- * this method fills in the array with some default colors a real Toolkit
- * should override this method and provide real system colors for the
- * native GUI platform.
- *
- * @param systemColors The array to copy the system colors into.
- * It must be at least 26 elements.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- *
- * @see java.awt.SystemColor
- */
- protected void loadSystemColors(int systemColors[])
- {
- systemColors[SystemColor.DESKTOP] = 0xFF005C5C;
- systemColors[SystemColor.ACTIVE_CAPTION] = 0xFF000080;
- systemColors[SystemColor.ACTIVE_CAPTION_TEXT] = 0xFFFFFFFF;
- systemColors[SystemColor.ACTIVE_CAPTION_BORDER] = 0xFFC0C0C0;
- systemColors[SystemColor.INACTIVE_CAPTION] = 0xFF808080;
- systemColors[SystemColor.INACTIVE_CAPTION_TEXT] = 0xFFC0C0C0;
- systemColors[SystemColor.INACTIVE_CAPTION_BORDER] = 0xFFC0C0C0;
- systemColors[SystemColor.WINDOW] = 0xFFFFFFFF;
- systemColors[SystemColor.WINDOW_BORDER] = 0xFF000000;
- systemColors[SystemColor.WINDOW_TEXT] = 0xFF000000;
- systemColors[SystemColor.MENU] = 0xFFC0C0C0;
- systemColors[SystemColor.MENU_TEXT] = 0xFF000000;
- systemColors[SystemColor.TEXT] = 0xFFC0C0C0;
- systemColors[SystemColor.TEXT_TEXT] = 0xFF000000;
- systemColors[SystemColor.TEXT_HIGHLIGHT] = 0xFF000090;
- systemColors[SystemColor.TEXT_HIGHLIGHT_TEXT] = 0xFFFFFFFF;
- systemColors[SystemColor.TEXT_INACTIVE_TEXT] = 0xFF808080;
- systemColors[SystemColor.CONTROL] = 0xFFC0C0C0;
- systemColors[SystemColor.CONTROL_TEXT] = 0xFF000000;
- systemColors[SystemColor.CONTROL_HIGHLIGHT] = 0xFFFFFFFF;
- systemColors[SystemColor.CONTROL_LT_HIGHLIGHT] = 0xFFE0E0E0;
- systemColors[SystemColor.CONTROL_SHADOW] = 0xFF808080;
- systemColors[SystemColor.CONTROL_DK_SHADOW] = 0xFF000000;
- systemColors[SystemColor.SCROLLBAR] = 0xFFE0E0E0;
- systemColors[SystemColor.INFO] = 0xFFE0E000;
- systemColors[SystemColor.INFO_TEXT] = 0xFF000000;
- }
-
- /**
- * @since 1.4
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public void setDynamicLayout(boolean dynamic)
- {
- }
-
- /**
- * @since 1.4
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected boolean isDynamicLayoutSet()
- {
- return false;
- }
-
- /**
- * @since 1.4
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public boolean isDynamicLayoutActive()
- {
- return false;
- }
-
- /**
- * Returns the dimensions of the screen in pixels.
- *
- * @return The dimensions of the screen in pixels.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public abstract Dimension getScreenSize();
-
- /**
- * Returns the screen resolution in dots per square inch.
- *
- * @return The screen resolution in dots per square inch.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public abstract int getScreenResolution();
-
- /**
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- *
- * @since 1.4
- */
- public Insets getScreenInsets(GraphicsConfiguration gc)
- {
- return new Insets(0, 0, 0, 0);
- }
-
- /**
- * Returns the color model of the screen.
- *
- * @return The color model of the screen.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public abstract ColorModel getColorModel();
-
- /**
- * Returns the names of the available fonts.
- *
- * @return The names of the available fonts.
- *
- * @deprecated
- */
- public abstract String[] getFontList();
-
- /**
- * Return the font metrics for the specified font
- *
- * @param name The name of the font to return metrics for.
- *
- * @return The requested font metrics.
- *
- * @deprecated
- */
- public abstract FontMetrics getFontMetrics(Font name);
-
- /**
- * Flushes any buffered data to the screen so that it is in sync with
- * what the AWT system has drawn to it.
- */
- public abstract void sync();
-
- /**
- * Returns an instance of the default toolkit. The default toolkit is
- * the subclass of <code>Toolkit</code> specified in the system property
- * <code>awt.toolkit</code>, or <code>gnu.java.awt.peer.gtk.GtkToolkit</code>
- * if the property is not set.
- *
- * @return An instance of the system default toolkit.
- *
- * @throws AWTError If the toolkit cannot be loaded.
- */
- public static synchronized Toolkit getDefaultToolkit()
- {
- if (toolkit != null)
- return toolkit;
-
- String toolkit_name = SystemProperties.getProperty("awt.toolkit",
- default_toolkit_name);
- try
- {
- // @classpath-bugfix-22969 Replace Class.forName
- //Class cls = Class.forName(toolkit_name);
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- Class cls = cl.loadClass(toolkit_name);
- // @classpath-bugfix-end
- Object obj = cls.newInstance();
- if (!(obj instanceof Toolkit))
- throw new AWTError(toolkit_name + " is not a subclass of " +
- "java.awt.Toolkit");
- toolkit = (Toolkit) obj;
-
- initAccessibility();
- return toolkit;
- }
- catch (ThreadDeath death)
- {
- throw death;
- }
- catch (Throwable t)
- {
- // Check for the headless property.
- if (GraphicsEnvironment.isHeadless())
- {
- toolkit = new HeadlessToolkit();
- return toolkit;
- }
- else
- {
- AWTError e = new AWTError("Cannot load AWT toolkit: "
- + toolkit_name);
- throw (AWTError) e.initCause(t);
- }
- }
- }
-
- // @classpath-bugfix
- /**
- * Flush a previously instantiate toolkit.
- */
- protected static void clearDefaultToolkit() {
- toolkit = null;
- }
- // @classpath-bugfix-end
-
- /**
- * Returns an image from the specified file, which must be in a
- * recognized format. Supported formats vary from toolkit to toolkit.
- *
- * @return name The name of the file to read the image from.
- */
- public abstract Image getImage(String name);
-
- /**
- * Returns an image from the specified URL, which must be in a
- * recognized format. Supported formats vary from toolkit to toolkit.
- *
- * @return url The URl to read the image from.
- */
- public abstract Image getImage(URL url);
-
- public abstract Image createImage(String filename);
-
- public abstract Image createImage(URL url);
-
- /**
- * Readies an image to be rendered on the screen. The width and height
- * values can be set to the default sizes for the image by passing -1
- * in those parameters.
- *
- * @param image The image to prepare for rendering.
- * @param width The width of the image.
- * @param height The height of the image.
- * @param observer The observer to receive events about the preparation
- * process.
- *
- * @return <code>true</code> if the image is already prepared for rendering,
- * <code>false</code> otherwise.
- */
- public abstract boolean prepareImage(Image image, int width, int height,
- ImageObserver observer);
-
- /**
- * Checks the status of specified image as it is being readied for
- * rendering.
- *
- * @param image The image to prepare for rendering.
- * @param width The width of the image.
- * @param height The height of the image.
- * @param observer The observer to receive events about the preparation
- * process.
- *
- * @return A union of the bitmasks from
- * <code>java.awt.image.ImageObserver</code> that indicates the current
- * state of the imaging readying process.
- */
- public abstract int checkImage(Image image, int width, int height,
- ImageObserver observer);
-
- /**
- * Creates an image using the specified <code>ImageProducer</code>
- *
- * @param producer The <code>ImageProducer</code> to create the image from.
- *
- * @return The created image.
- */
- public abstract Image createImage(ImageProducer producer);
-
- /**
- * Creates an image from the specified byte array. The array must be in
- * a recognized format. Supported formats vary from toolkit to toolkit.
- *
- * @param data The raw image data.
- *
- * @return The created image.
- */
- public Image createImage(byte[] data)
- {
- return createImage(data, 0, data.length);
- }
-
- /**
- * Creates an image from the specified portion of the byte array passed.
- * The array must be in a recognized format. Supported formats vary from
- * toolkit to toolkit.
- *
- * @param data The raw image data.
- * @param offset The offset into the data where the image data starts.
- * @param len The length of the image data.
- *
- * @return The created image.
- */
- public abstract Image createImage(byte[] data, int offset, int len);
-
- /**
- * Returns a instance of <code>PrintJob</code> for the specified
- * arguments.
- *
- * @param frame The window initiating the print job.
- * @param title The print job title.
- * @param props The print job properties.
- *
- * @return The requested print job, or <code>null</code> if the job
- * was cancelled.
- *
- * @exception NullPointerException If frame is null,
- * or GraphicsEnvironment.isHeadless() returns true.
- * @exception SecurityException If this thread is not allowed to initiate
- * a print job request.
- */
- public abstract PrintJob getPrintJob(Frame frame, String title,
- Properties props);
-
- /**
- * Returns a instance of <code>PrintJob</code> for the specified
- * arguments.
- *
- * @param frame The window initiating the print job.
- * @param title The print job title.
- * @param jobAttr A set of job attributes which will control the print job.
- * @param pageAttr A set of page attributes which will control the print job.
- *
- * @exception NullPointerException If frame is null, and either jobAttr is null
- * or jobAttr.getDialog() returns JobAttributes.DialogType.NATIVE.
- * @exception IllegalArgumentException If pageAttrspecifies differing cross
- * feed and feed resolutions, or when GraphicsEnvironment.isHeadless() returns
- * true.
- * @exception SecurityException If this thread is not allowed to initiate
- * a print job request.
- *
- * @since 1.3
- */
- public PrintJob getPrintJob(Frame frame, String title,
- JobAttributes jobAttr, PageAttributes pageAttr)
- {
- // FIXME: it is possible this check may be removed
- // if this method, when written, always delegates to
- // getPrintJob(Frame, String, Properties).
- SecurityManager sm;
- sm = System.getSecurityManager();
- if (sm != null)
- sm.checkPrintJobAccess();
-
- return null;
- }
-
- /**
- * Causes a "beep" tone to be generated.
- */
- public abstract void beep();
-
- /**
- * Returns the system clipboard.
- *
- * @return THe system clipboard.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public abstract Clipboard getSystemClipboard();
-
- /**
- * Gets the singleton instance of the system selection as a
- * Clipboard object. The system selection contains the selected text
- * of the last component/widget that had focus and a text selection.
- * The default implementation returns null.
- *
- * @return The Clipboard holding the system (text) selection or null
- * if the Toolkit or system doesn't support a selection clipboard.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * is true.
- * @exception SecurityException If the current security manager
- * checkSystemClipboardAccess() doesn't allow access.
- *
- * @since 1.4
- */
- public Clipboard getSystemSelection()
- {
- return null;
- }
-
- /**
- * Returns the accelerator key mask for menu shortcuts. The default is
- * <code>Event.CTRL_MASK</code>. A toolkit must override this method
- * to change the default.
- *
- * @return The key mask for the menu accelerator key.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public int getMenuShortcutKeyMask()
- {
- return Event.CTRL_MASK;
- }
-
- /**
- * Returns whether the given locking key on the keyboard is currently in its
- * "on" state.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- * @exception IllegalArgumentException If keyCode is not one of the valid keys.
- * @exception UnsupportedOperationException If the host system doesn't allow
- * getting the state of this key programmatically, or if the keyboard doesn't
- * have this key.
- */
- public boolean getLockingKeyState(int keyCode)
- {
- if (AWTUtilities.isValidKey(keyCode))
- throw new UnsupportedOperationException
- ("cannot get locking state of key code " + keyCode);
-
- throw new IllegalArgumentException("invalid key code " + keyCode);
- }
-
- /**
- * Sets the state of the given locking key on the keyboard.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- * @exception IllegalArgumentException If keyCode is not one of the valid keys.
- * @exception UnsupportedOperationException If the host system doesn't allow
- * getting the state of this key programmatically, or if the keyboard doesn't
- * have this key.
- */
- public void setLockingKeyState(int keyCode, boolean on)
- {
- if (keyCode != KeyEvent.VK_CAPS_LOCK
- && keyCode != KeyEvent.VK_NUM_LOCK
- && keyCode != KeyEvent.VK_SCROLL_LOCK)
- throw new IllegalArgumentException();
-
- throw new UnsupportedOperationException();
- }
-
- /**
- * Returns the native container object of the specified component. This
- * method is necessary because the parent component might be a lightweight
- * component.
- *
- * @param component The component to fetch the native container for.
- *
- * @return The native container object for this component.
- */
- protected static Container getNativeContainer(Component component)
- {
- component = component.getParent();
- while (true)
- {
- if (component == null)
- return null;
- if (! (component instanceof Container))
- {
- component = component.getParent();
- continue;
- }
- if (component.getPeer() instanceof LightweightPeer)
- {
- ...
[truncated message content] |
|
From: <ls...@us...> - 2008-07-29 18:38:44
|
Revision: 4369
http://jnode.svn.sourceforge.net/jnode/?rev=4369&view=rev
Author: lsantha
Date: 2008-07-29 18:38:38 +0000 (Tue, 29 Jul 2008)
Log Message:
-----------
Improved boot messages.
Modified Paths:
--------------
trunk/core/src/core/org/jnode/plugin/Plugin.java
trunk/core/src/core/org/jnode/plugin/manager/DefaultPluginManager.java
trunk/core/src/core/org/jnode/work/WorkPlugin.java
trunk/core/src/driver/org/jnode/driver/DefaultDeviceManager.java
trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java
Modified: trunk/core/src/core/org/jnode/plugin/Plugin.java
===================================================================
--- trunk/core/src/core/org/jnode/plugin/Plugin.java 2008-07-29 17:04:56 UTC (rev 4368)
+++ trunk/core/src/core/org/jnode/plugin/Plugin.java 2008-07-29 18:38:38 UTC (rev 4369)
@@ -102,7 +102,7 @@
}
if (!started) {
if (descriptor.hasCustomPluginClass()) {
- BootLog.debug("__Starting " + descriptor.getId());
+ BootLog.debug("Starting plugin: " + descriptor.getId());
}
started = true;
try {
Modified: trunk/core/src/core/org/jnode/plugin/manager/DefaultPluginManager.java
===================================================================
--- trunk/core/src/core/org/jnode/plugin/manager/DefaultPluginManager.java 2008-07-29 17:04:56 UTC (rev 4368)
+++ trunk/core/src/core/org/jnode/plugin/manager/DefaultPluginManager.java 2008-07-29 18:38:38 UTC (rev 4369)
@@ -162,7 +162,6 @@
while (!isStartPluginsFinished() && (now - start < START_TIMEOUT)) {
try {
if (++loop == 10) {
- System.out.print('.');
loop = 0;
}
Thread.sleep(100);
Modified: trunk/core/src/core/org/jnode/work/WorkPlugin.java
===================================================================
--- trunk/core/src/core/org/jnode/work/WorkPlugin.java 2008-07-29 17:04:56 UTC (rev 4368)
+++ trunk/core/src/core/org/jnode/work/WorkPlugin.java 2008-07-29 18:38:38 UTC (rev 4369)
@@ -124,7 +124,6 @@
* @see org.jnode.work.WorkManager#add(org.jnode.work.Work)
*/
public final synchronized void add(Work work) {
- log.debug("#free workers: " + getFreeProcessors());
workCounter++;
queue.add(work);
}
Modified: trunk/core/src/driver/org/jnode/driver/DefaultDeviceManager.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/DefaultDeviceManager.java 2008-07-29 17:04:56 UTC (rev 4368)
+++ trunk/core/src/driver/org/jnode/driver/DefaultDeviceManager.java 2008-07-29 18:38:38 UTC (rev 4369)
@@ -41,8 +41,7 @@
*
* @author epr
*/
-public final class DefaultDeviceManager extends AbstractDeviceManager
- implements ExtensionPointListener {
+public final class DefaultDeviceManager extends AbstractDeviceManager implements ExtensionPointListener {
/**
* finder extension-point
@@ -162,8 +161,6 @@
* @param element
*/
private void configureFinder(List<DeviceFinder> finders, ConfigurationElement element) {
- BootLog.debug("Configure finder: " + element);
-
final String elementName = element.getName();
if (!elementName.equals("finder")) {
BootLog.warn("Ignoring unrecognised descriptor element: " + elementName);
@@ -173,8 +170,8 @@
final String className = element.getAttribute("class");
if (className != null) {
try {
- final Class cls = Thread.currentThread()
- .getContextClassLoader().loadClass(className);
+ BootLog.debug("Configuring finder: " + className);
+ final Class cls = Thread.currentThread().getContextClassLoader().loadClass(className);
final DeviceFinder finder = (DeviceFinder) cls.newInstance();
finders.add(finder);
} catch (ClassNotFoundException ex) {
@@ -184,8 +181,7 @@
} catch (InstantiationException ex) {
BootLog.error("Cannot instantiate finder class " + className);
} catch (ClassCastException ex) {
- BootLog.error("Finder class " + className
- + " does not implement the DeviceFinder interface");
+ BootLog.error("Finder class " + className + " does not implement the DeviceFinder interface");
}
}
}
@@ -198,8 +194,6 @@
* @param element
*/
private void configureMapper(List<DeviceToDriverMapper> mappers, ConfigurationElement element) {
- BootLog.debug("Configure mapper: " + element);
-
final String elementName = element.getName();
if (!elementName.equals("mapper")) {
BootLog.warn("Ignoring unrecognised descriptor element: " + elementName);
@@ -209,8 +203,8 @@
final String className = element.getAttribute("class");
if (className != null) {
try {
- final Class cls = Thread.currentThread()
- .getContextClassLoader().loadClass(className);
+ BootLog.debug("Configuring mapper: " + className);
+ final Class cls = Thread.currentThread().getContextClassLoader().loadClass(className);
final DeviceToDriverMapper mapper = newMapperInstance(cls, element);
mappers.add(mapper);
} catch (ClassNotFoundException ex) {
@@ -220,10 +214,7 @@
} catch (InstantiationException ex) {
BootLog.error("Cannot instantiate mapper class " + className, ex);
} catch (ClassCastException ex) {
- BootLog
- .error("Mapper class "
- + className
- + " does not implement the DeviceToDriverMapper interface");
+ BootLog.error("Mapper class " + className + " does not implement the DeviceToDriverMapper interface");
}
} else {
BootLog.error("class attribute required in mapper");
Modified: trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java 2008-07-29 17:04:56 UTC (rev 4368)
+++ trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsoleManager.java 2008-07-29 18:38:38 UTC (rev 4369)
@@ -207,14 +207,11 @@
* @param console
*/
public synchronized void focus(Console console) {
- log.debug("focus(" + console.getConsoleName() + ")");
if (this.current != null && this.current != console) {
- log.debug("Sending focusLost to " + current.getConsoleName());
this.current.focusLost(new FocusEvent(FocusEvent.FOCUS_LOST));
}
this.current = console;
if (this.current != null) {
- log.debug("Sending focusGained to " + current.getConsoleName());
current.focusGained(new FocusEvent(FocusEvent.FOCUS_GAINED));
}
}
@@ -338,7 +335,6 @@
}
public void registerConsole(Console console) {
- log.debug("registerConsole(" + console.getConsoleName() + ")");
consoles.put(console.getConsoleName(), console);
if (current == null) {
current = console;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-08-03 07:55:42
|
Revision: 4387
http://jnode.svn.sourceforge.net/jnode/?rev=4387&view=rev
Author: fduminy
Date: 2008-08-03 07:55:38 +0000 (Sun, 03 Aug 2008)
Log Message:
-----------
fix for bugs happening while halting JNode :
- log4j complaining about not being properly configured
- AbstractInputDriver's queue still trying to get events from the closed queue
Modified Paths:
--------------
trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java
trunk/core/src/core/org/jnode/util/Queue.java
trunk/core/src/driver/org/jnode/driver/input/AbstractInputDriver.java
Modified: trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java
===================================================================
--- trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java 2008-08-02 19:25:44 UTC (rev 4386)
+++ trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java 2008-08-03 07:55:38 UTC (rev 4387)
@@ -24,11 +24,12 @@
import java.awt.event.KeyEvent;
import java.io.PrintStream;
import java.util.Enumeration;
+
import javax.naming.NameNotFoundException;
+
import org.apache.log4j.Appender;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Level;
-import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.jnode.driver.console.ConsoleManager;
@@ -98,7 +99,9 @@
* @see org.jnode.plugin.Plugin#stopPlugin()
*/
protected void stopPlugin() throws PluginException {
- LogManager.resetConfiguration();
+ // Using LogManager.resetConfiguration() or LogManager.shutdown()
+ // can't avoid log4j WARN message about log4j not being properly configured.
+ // So, simply do nothing
}
}
Modified: trunk/core/src/core/org/jnode/util/Queue.java
===================================================================
--- trunk/core/src/core/org/jnode/util/Queue.java 2008-08-02 19:25:44 UTC (rev 4386)
+++ trunk/core/src/core/org/jnode/util/Queue.java 2008-08-03 07:55:38 UTC (rev 4387)
@@ -170,5 +170,13 @@
this.closed = true;
notifyAll();
}
+
+ /**
+ * Is this queue closed.
+ * @return
+ */
+ public boolean isClosed() {
+ return closed;
+ }
}
Modified: trunk/core/src/driver/org/jnode/driver/input/AbstractInputDriver.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/input/AbstractInputDriver.java 2008-08-02 19:25:44 UTC (rev 4386)
+++ trunk/core/src/driver/org/jnode/driver/input/AbstractInputDriver.java 2008-08-03 07:55:38 UTC (rev 4387)
@@ -148,6 +148,12 @@
final byte scancode = buf.get(0);
E event = handleScancode(scancode);
if ((event != null) && !event.isConsumed()) {
+ if (eventQueue.isClosed()) {
+ // the queue is closed : it usually happen while JNode is halting
+ // simply stop processing the events
+ break;
+ }
+
eventQueue.add(event);
}
} catch (Throwable ex) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2008-08-03 21:50:43
|
Revision: 4396
http://jnode.svn.sourceforge.net/jnode/?rev=4396&view=rev
Author: fduminy
Date: 2008-08-03 21:50:40 +0000 (Sun, 03 Aug 2008)
Log Message:
-----------
kernel cleanup :
- removed unneeded native method Unsafe.getVbeInfos() (using multiboot_vbe kernel data)
- removed unneeded multiboot_vbe kernel data (+its copying code, which contained a bug)
- improved comments in assembly code
Modified Paths:
--------------
trunk/core/src/core/org/jnode/vm/x86/UnsafeX86.java
trunk/core/src/native/x86/i386.h
trunk/core/src/native/x86/kernel.asm
trunk/core/src/native/x86/unsafex86.asm
Modified: trunk/core/src/core/org/jnode/vm/x86/UnsafeX86.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/x86/UnsafeX86.java 2008-08-03 16:26:28 UTC (rev 4395)
+++ trunk/core/src/core/org/jnode/vm/x86/UnsafeX86.java 2008-08-03 21:50:40 UTC (rev 4396)
@@ -83,8 +83,6 @@
*/
static final native int getMultibootMMapLength();
- public static final native Address getVbeInfos();
-
public static final native Address getVbeControlInfos();
public static final native Address getVbeModeInfos();
Modified: trunk/core/src/native/x86/kernel.asm
===================================================================
--- trunk/core/src/native/x86/kernel.asm 2008-08-03 16:26:28 UTC (rev 4395)
+++ trunk/core/src/native/x86/kernel.asm 2008-08-03 21:50:40 UTC (rev 4396)
@@ -100,29 +100,16 @@
test dword [multiboot_info+MBI_FLAGS],MBF_VBE
jz vbe_info_done ; no vbe info, jump to end
- ; Copy vbe infos
- ; Get start address
- mov esi,[multiboot_info+MBI_VBECTRLINFO]
- ; Get destination address
- mov edi,multiboot_vbe
- ; Copy the VBE_ESIZE bytes
- mov ecx,VBE_ESIZE
+ ; Copy VBE control informations
+ mov esi,[multiboot_info+MBI_VBECTRLINFO] ; Get start address
+ mov edi,vbe_control_info ; Get destination address
+ mov ecx,VBECTRLINFO_SIZE ; Copy the VBECTRLINFO_SIZE bytes
rep movsb
-
- ; Get start address
- mov esi,[multiboot_info+MBI_VBECTRLINFO]
- ; Get destination address
- mov edi,vbe_control_info
- ; Copy the VBECTRLINFO_SIZE bytes
- mov ecx,VBECTRLINFO_SIZE
- rep movsb
- ; Get start address
- mov esi,[multiboot_info+MBI_VBEMODEINFO]
- ; Get destination address
- mov edi,vbe_mode_info
- ; Copy the VBEMODEINFO_SIZE bytes
- mov ecx,VBEMODEINFO_SIZE
+ ; Copy VBE mode informations
+ mov esi,[multiboot_info+MBI_VBEMODEINFO] ; Get start address
+ mov edi,vbe_mode_info ; Get destination address
+ mov ecx,VBEMODEINFO_SIZE ; Copy the VBEMODEINFO_SIZE bytes
rep movsb
vbe_info_done:
@@ -314,10 +301,7 @@
dd 0 ; Entries
times (MBI_MMAP_MAX * MBMMAP_ESIZE) db 0
-; vbe informations
-multiboot_vbe:
- times (VBE_ESIZE) db 0
-
+; vbe informations in multiboot header
vbe_control_info:
times (VBECTRLINFO_SIZE) db 0
Modified: trunk/core/src/native/x86/unsafex86.asm
===================================================================
--- trunk/core/src/native/x86/unsafex86.asm 2008-08-03 16:26:28 UTC (rev 4395)
+++ trunk/core/src/native/x86/unsafex86.asm 2008-08-03 21:50:40 UTC (rev 4396)
@@ -82,11 +82,6 @@
mov eax,[multiboot_mmap]
ret
-; Address getVbeInfos();
-GLABEL Q53org5jnode2vm3x869UnsafeX8623getVbeInfos2e2829Lorg2fvmmagic2funboxed2fAddress3b
- mov AAX,multiboot_vbe
- ret
-
; Address getVbeControlInfos();
GLABEL Q53org5jnode2vm3x869UnsafeX8623getVbeControlInfos2e2829Lorg2fvmmagic2funboxed2fAddress3b
mov AAX,vbe_control_info
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-08-23 09:33:55
|
Revision: 4484
http://jnode.svn.sourceforge.net/jnode/?rev=4484&view=rev
Author: lsantha
Date: 2008-08-23 09:33:49 +0000 (Sat, 23 Aug 2008)
Log Message:
-----------
Moved time2millis from RTC to TimeUtils for wider reusability.
Modified Paths:
--------------
trunk/core/src/core/org/jnode/util/TimeUtils.java
trunk/core/src/driver/org/jnode/driver/system/cmos/def/RTC.java
Modified: trunk/core/src/core/org/jnode/util/TimeUtils.java
===================================================================
--- trunk/core/src/core/org/jnode/util/TimeUtils.java 2008-08-22 20:12:44 UTC (rev 4483)
+++ trunk/core/src/core/org/jnode/util/TimeUtils.java 2008-08-23 09:33:49 UTC (rev 4484)
@@ -57,4 +57,29 @@
}
}
}
+
+ /**
+ * Converts Gregorian date to milliseconds since 1970-01-01 00:00:00 .
+ *
+ * @param year the year
+ * @param mon the month 1..12
+ * @param day the day of month 1..31
+ * @param hours hours of day 0..23
+ * @param mins minutes 0..59
+ * @param secs seconds 0..59
+ * @return the milliseconds since 1970-01-01 00:00:00
+ */
+ public static long time2millis(int year, int mon, int day, int hours, int mins, int secs) {
+ if (0 >= (mon -= 2)) { /* 1..12 -> 11,12,1..10 */
+ mon += 12; /* Puts Feb last since it has leap day */
+ year -= 1;
+ }
+
+ return ((((
+ ((long) (year / 4 - year / 100 + year / 400 + 367 * mon / 12 + day) + year * 365 - 719499)) /* days */
+ * 24l + hours) /* hours */
+ * 60l + mins) /* minutes */
+ * 60l + secs) /* seconds */
+ * 1000l; /* milliseconds */
+ }
}
Modified: trunk/core/src/driver/org/jnode/driver/system/cmos/def/RTC.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/system/cmos/def/RTC.java 2008-08-22 20:12:44 UTC (rev 4483)
+++ trunk/core/src/driver/org/jnode/driver/system/cmos/def/RTC.java 2008-08-23 09:33:49 UTC (rev 4484)
@@ -24,6 +24,7 @@
import org.jnode.driver.system.cmos.CMOSConstants;
import org.jnode.driver.system.cmos.CMOSService;
import org.jnode.util.BCDUtils;
+import org.jnode.util.TimeUtils;
import org.jnode.vm.RTCService;
/**
@@ -146,31 +147,6 @@
* @see java.util.Calendar#setTimeInMillis(long)
*/
public long getTime() {
- return time2millis(getYear(), getMonth(), getDay(), getHours(), getMinutes(), getSeconds());
+ return TimeUtils.time2millis(getYear(), getMonth(), getDay(), getHours(), getMinutes(), getSeconds());
}
-
- /**
- * Converts Gregorian date to milliseconds since 1970-01-01 00:00:00 .
- *
- * @param year the year
- * @param mon the month 1..12
- * @param day the day of month 1..31
- * @param hours hours of day 0..23
- * @param mins minutes 0..59
- * @param secs seconds 0..59
- * @return the milliseconds since 1970-01-01 00:00:00
- */
- static long time2millis(int year, int mon, int day, int hours, int mins, int secs) {
- if (0 >= (mon -= 2)) { /* 1..12 -> 11,12,1..10 */
- mon += 12; /* Puts Feb last since it has leap day */
- year -= 1;
- }
-
- return ((((
- ((long) (year / 4 - year / 100 + year / 400 + 367 * mon / 12 + day) + year * 365 - 719499)) /* days */
- * 24l + hours) /* hours */
- * 60l + mins) /* minutes */
- * 60l + secs) /* seconds */
- * 1000l; /* milliseconds */
- }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cr...@us...> - 2008-09-30 12:00:29
|
Revision: 4592
http://jnode.svn.sourceforge.net/jnode/?rev=4592&view=rev
Author: crawley
Date: 2008-09-30 12:00:11 +0000 (Tue, 30 Sep 2008)
Log Message:
-----------
This checkin adds some infrastructure for 'status links' and
corrects a mis-named public method in the Isolate class. I've renamed
VmDataLink / DataLinkImpl to VmLink / LinkImpl because they also need
to support status links.
Modified Paths:
--------------
trunk/core/src/classpath/ext/javax/isolate/Isolate.java
trunk/core/src/classpath/ext/javax/isolate/Link.java
trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
trunk/core/src/core/org/jnode/vm/isolate/link/LinkLinkMessage.java
trunk/core/src/core/org/jnode/vm/isolate/link/LinkMessageFactory.java
Added Paths:
-----------
trunk/core/src/core/org/jnode/vm/isolate/link/LinkImpl.java
trunk/core/src/core/org/jnode/vm/isolate/link/VmLink.java
Removed Paths:
-------------
trunk/core/src/core/org/jnode/vm/isolate/link/DataLinkImpl.java
trunk/core/src/core/org/jnode/vm/isolate/link/VmDataLink.java
Modified: trunk/core/src/classpath/ext/javax/isolate/Isolate.java
===================================================================
--- trunk/core/src/classpath/ext/javax/isolate/Isolate.java 2008-09-30 11:54:14 UTC (rev 4591)
+++ trunk/core/src/classpath/ext/javax/isolate/Isolate.java 2008-09-30 12:00:11 UTC (rev 4592)
@@ -147,14 +147,13 @@
/**
* Gets a new Link associated with this Isolate from which the current
- * isolate can receive events.
+ * isolate can receive status link messages.
*
* @return
* @throws ClosedLinkException
*/
- public Link newEventLink() throws ClosedLinkException {
- // TODO implement me
- return null;
+ public Link newStatusLink() throws ClosedLinkException {
+ return impl.newStatusLink(currentIsolate().impl);
}
/**
Modified: trunk/core/src/classpath/ext/javax/isolate/Link.java
===================================================================
--- trunk/core/src/classpath/ext/javax/isolate/Link.java 2008-09-30 11:54:14 UTC (rev 4591)
+++ trunk/core/src/classpath/ext/javax/isolate/Link.java 2008-09-30 12:00:11 UTC (rev 4592)
@@ -24,7 +24,7 @@
import java.io.IOException;
import java.io.InterruptedIOException;
-import org.jnode.vm.isolate.link.VmDataLink;
+import org.jnode.vm.isolate.link.VmLink;
/**
* @author Ewout Prangsma (ep...@us...)
@@ -228,6 +228,6 @@
*/
public static Link newLink(Isolate sender, Isolate receiver)
throws ClosedLinkException {
- return VmDataLink.newLink(sender.getImpl(), receiver.getImpl());
+ return VmLink.newLink(sender.getImpl(), receiver.getImpl());
}
}
Modified: trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2008-09-30 11:54:14 UTC (rev 4591)
+++ trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2008-09-30 12:00:11 UTC (rev 4592)
@@ -54,7 +54,7 @@
import org.jnode.vm.annotation.SharedStatics;
import org.jnode.vm.classmgr.VmIsolatedStatics;
import org.jnode.vm.classmgr.VmType;
-import org.jnode.vm.isolate.link.VmDataLink;
+import org.jnode.vm.isolate.link.VmLink;
/**
* VM specific implementation of the Isolate class.
@@ -122,9 +122,14 @@
/**
* Links passed to the start of this isolate
*/
- private VmDataLink[] dataLinks;
+ private VmLink[] dataLinks;
/**
+ * Status links created by newStatusLink()
+ */
+ private LinkedList<VmLink> statusLinks = new LinkedList<VmLink>();
+
+ /**
* The isolate-specific default IO context
*/
private final IOContext vmIoContext = new VmIOContext();
@@ -344,7 +349,7 @@
public final void exit(Isolate isolate, int status) {
testIsolate(isolate);
//todo handle demon threads
- if(threadGroup.activeCount() > 0 || threadGroup.activeGroupCount() > 0)
+ if (threadGroup.activeCount() > 0 || threadGroup.activeGroupCount() > 0)
return;
try {
@@ -352,7 +357,7 @@
} catch (Throwable t) {
t.printStackTrace();
}
- state = State.EXITED;
+ changeState(State.EXITED);
StaticData.isolates.remove(this);
}
@@ -375,7 +380,7 @@
} catch (Throwable t) {
t.printStackTrace();
}
- this.state = State.TERMINATED;
+ changeState(State.TERMINATED);
StaticData.isolates.remove(this);
}
@@ -428,14 +433,14 @@
* Gets the links passed to the start of the current isolate.
*/
public static Link[] getLinks() {
- final VmDataLink[] vmLinks = currentIsolate().dataLinks;
+ final VmLink[] vmLinks = currentIsolate().dataLinks;
if ((vmLinks == null) || (vmLinks.length == 0)) {
return new Link[0];
} else {
Link[] links = new Link[vmLinks.length];
int i = 0;
- for (VmDataLink vmLink : vmLinks) {
+ for (VmLink vmLink : vmLinks) {
links[i++] = vmLink.asLink();
}
return links;
@@ -449,7 +454,7 @@
* @throws IsolateStartupException
*/
@PrivilegedActionPragma
- public final void start(Isolate isolate, Link[] links)
+ public synchronized final void start(Isolate isolate, Link[] links)
throws IsolateStartupException {
testIsolate(isolate);
// The creator of this isolate must be the same as the current isolate
@@ -461,10 +466,9 @@
synchronized (this) {
// The state must be CREATED
if (state != State.CREATED) {
- throw new IllegalStateException(
- "Isolate has already been started");
+ throw new IllegalStateException("Isolate has already been started");
}
- this.state = State.STARTING;
+ changeState(State.STARTING);
}
// Save starter
@@ -473,13 +477,13 @@
// Save links
this.dataLinks = null;
if (links != null) {
- VmDataLink[] vmLinks = new VmDataLink[links.length];
+ VmLink[] vmLinks = new VmLink[links.length];
int i = 0;
for (Link link : links) {
if (!link.isOpen()) {
throw new IsolateStartupException("Link is closed");
}
- vmLinks[i] = VmDataLink.fromLink(link);
+ vmLinks[i] = VmLink.fromLink(link);
}
this.dataLinks = vmLinks;
}
@@ -514,7 +518,7 @@
piManager, stdout, stderr, stdin);
// Update the state of this isolate.
- this.state = State.STARTED;
+ changeState(State.STARTED);
// Start the main thread.
mainThread.start();
@@ -750,4 +754,35 @@
BootableHashMap getIsolateLocalMap() {
return isolateLocalMap;
}
+
+ /**
+ * Create and return a new status link for this isolate and the supplied
+ * receiver isolate.
+ * @param receiver the receiver for the link.
+ * @return the link.
+ */
+ public synchronized Link newStatusLink(VmIsolate receiver) {
+ Link link = VmLink.newLink(this, receiver);
+ VmLink vmLink = VmLink.fromLink(link);
+ statusLinks.add(vmLink);
+ if (state == State.TERMINATED) {
+ // The spec says that we should immediately send a link message
+ // if the isolate is already 'EXITED'.
+ sendStatus(vmLink, state);
+ }
+ return link;
+ }
+
+ private synchronized void changeState(State newState) {
+ if (state != newState) {
+ this.state = newState;
+ for (VmLink link : statusLinks) {
+ sendStatus(link, this.state);
+ }
+ }
+ }
+
+ private void sendStatus(VmLink link, State state) {
+ // TODO implement.
+ }
}
Deleted: trunk/core/src/core/org/jnode/vm/isolate/link/DataLinkImpl.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/link/DataLinkImpl.java 2008-09-30 11:54:14 UTC (rev 4591)
+++ trunk/core/src/core/org/jnode/vm/isolate/link/DataLinkImpl.java 2008-09-30 12:00:11 UTC (rev 4592)
@@ -1,98 +0,0 @@
-/*
- * $Id$
- */
-package org.jnode.vm.isolate.link;
-
-import java.io.IOException;
-import java.io.InterruptedIOException;
-
-import javax.isolate.ClosedLinkException;
-import javax.isolate.Isolate;
-import javax.isolate.Link;
-import javax.isolate.LinkMessage;
-
-final class DataLinkImpl extends Link {
-
- private final VmDataLink vmLink;
-
- /**
- * Constructor
- *
- * @param vmLink
- */
- DataLinkImpl(VmDataLink vmLink) {
- this.vmLink = vmLink;
- }
-
- final VmDataLink getImpl() {
- return vmLink;
- }
-
- /**
- * @see javax.isolate.Link#close()
- */
- @Override
- public void close() {
- vmLink.close();
- }
-
- /**
- * @see javax.isolate.Link#Equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object other) {
- if (other instanceof DataLinkImpl) {
- return (((DataLinkImpl) other).vmLink == this.vmLink);
- }
- return false;
- }
-
- /**
- * @see javax.isolate.Link#getReceiver()
- */
- @Override
- public Isolate getReceiver() {
- return vmLink.getReceiver().getIsolate();
- }
-
- /**
- * @see javax.isolate.Link#getSender()
- */
- @Override
- public Isolate getSender() {
- return vmLink.getSender().getIsolate();
- }
-
- /**
- * @see javax.isolate.Link#isOpen()
- */
- @Override
- public boolean isOpen() {
- return vmLink.isOpen();
- }
-
- /**
- * @see javax.isolate.Link#receive()
- */
- @Override
- public LinkMessage receive()
- throws ClosedLinkException, IllegalStateException, InterruptedIOException, IOException {
- return vmLink.receive();
- }
-
- /**
- * @see javax.isolate.Link#send(javax.isolate.LinkMessage)
- */
- @Override
- public void send(LinkMessage message) throws ClosedLinkException, InterruptedIOException, IOException {
- vmLink.send(message);
- }
-
- /**
- * @see javax.isolate.Link#toString()
- */
- @Override
- public String toString() {
- return vmLink.toString();
- }
-}
Added: trunk/core/src/core/org/jnode/vm/isolate/link/LinkImpl.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/link/LinkImpl.java (rev 0)
+++ trunk/core/src/core/org/jnode/vm/isolate/link/LinkImpl.java 2008-09-30 12:00:11 UTC (rev 4592)
@@ -0,0 +1,98 @@
+/*
+ * $Id: DataLinkImpl.java 4552 2008-09-11 11:38:42Z crawley $
+ */
+package org.jnode.vm.isolate.link;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+
+import javax.isolate.ClosedLinkException;
+import javax.isolate.Isolate;
+import javax.isolate.Link;
+import javax.isolate.LinkMessage;
+
+final class LinkImpl extends Link {
+
+ private final VmLink vmLink;
+
+ /**
+ * Constructor
+ *
+ * @param vmLink
+ */
+ LinkImpl(VmLink vmLink) {
+ this.vmLink = vmLink;
+ }
+
+ final VmLink getImpl() {
+ return vmLink;
+ }
+
+ /**
+ * @see javax.isolate.Link#close()
+ */
+ @Override
+ public void close() {
+ vmLink.close();
+ }
+
+ /**
+ * @see javax.isolate.Link#Equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object other) {
+ if (other instanceof LinkImpl) {
+ return (((LinkImpl) other).vmLink == this.vmLink);
+ }
+ return false;
+ }
+
+ /**
+ * @see javax.isolate.Link#getReceiver()
+ */
+ @Override
+ public Isolate getReceiver() {
+ return vmLink.getReceiver().getIsolate();
+ }
+
+ /**
+ * @see javax.isolate.Link#getSender()
+ */
+ @Override
+ public Isolate getSender() {
+ return vmLink.getSender().getIsolate();
+ }
+
+ /**
+ * @see javax.isolate.Link#isOpen()
+ */
+ @Override
+ public boolean isOpen() {
+ return vmLink.isOpen();
+ }
+
+ /**
+ * @see javax.isolate.Link#receive()
+ */
+ @Override
+ public LinkMessage receive()
+ throws ClosedLinkException, IllegalStateException, InterruptedIOException, IOException {
+ return vmLink.receive();
+ }
+
+ /**
+ * @see javax.isolate.Link#send(javax.isolate.LinkMessage)
+ */
+ @Override
+ public void send(LinkMessage message) throws ClosedLinkException, InterruptedIOException, IOException {
+ vmLink.send(message);
+ }
+
+ /**
+ * @see javax.isolate.Link#toString()
+ */
+ @Override
+ public String toString() {
+ return vmLink.toString();
+ }
+}
Modified: trunk/core/src/core/org/jnode/vm/isolate/link/LinkLinkMessage.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/link/LinkLinkMessage.java 2008-09-30 11:54:14 UTC (rev 4591)
+++ trunk/core/src/core/org/jnode/vm/isolate/link/LinkLinkMessage.java 2008-09-30 12:00:11 UTC (rev 4592)
@@ -8,14 +8,14 @@
final class LinkLinkMessage extends LinkMessageImpl {
- private final VmDataLink value;
+ private final VmLink value;
/**
* Message constructor
*
* @param value
*/
- LinkLinkMessage(VmDataLink link) {
+ LinkLinkMessage(VmLink link) {
this.value = link;
}
Modified: trunk/core/src/core/org/jnode/vm/isolate/link/LinkMessageFactory.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/link/LinkMessageFactory.java 2008-09-30 11:54:14 UTC (rev 4591)
+++ trunk/core/src/core/org/jnode/vm/isolate/link/LinkMessageFactory.java 2008-09-30 12:00:11 UTC (rev 4592)
@@ -51,7 +51,7 @@
* @return
*/
public static LinkMessage newLinkMessage(Link link) {
- return new LinkLinkMessage(((DataLinkImpl) link).getImpl());
+ return new LinkLinkMessage(((LinkImpl) link).getImpl());
}
/**
Deleted: trunk/core/src/core/org/jnode/vm/isolate/link/VmDataLink.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/link/VmDataLink.java 2008-09-30 11:54:14 UTC (rev 4591)
+++ trunk/core/src/core/org/jnode/vm/isolate/link/VmDataLink.java 2008-09-30 12:00:11 UTC (rev 4592)
@@ -1,272 +0,0 @@
-/*
- * $Id$
- */
-package org.jnode.vm.isolate.link;
-
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.util.LinkedList;
-import java.util.Queue;
-
-import javax.isolate.ClosedLinkException;
-import javax.isolate.Link;
-import javax.isolate.LinkMessage;
-
-import org.jnode.vm.isolate.VmIsolate;
-import org.jnode.vm.isolate.VmIsolateLocal;
-
-/**
- * Shared implementation of javax.isolate.Link
- *
- * @author Ewout Prangsma (ep...@us...)
- */
-public final class VmDataLink {
-
- private final VmIsolateLocal<DataLinkImpl> linkHolder = new VmIsolateLocal<DataLinkImpl>();
-
- private final Queue<LinkMessageImpl> messages = new LinkedList<LinkMessageImpl>();
-
- private boolean closed = false;
-
- private VmIsolate sender;
-
- private VmIsolate receiver;
-
- /**
- * Create a new data link between the given isolates.
- *
- * @param sender
- * @param receiver
- * @return
- */
- public static Link newLink(VmIsolate sender, VmIsolate receiver) {
- if (sender == receiver) {
- throw new IllegalArgumentException("sender == receiver");
- }
- VmDataLink vmLink = new VmDataLink(sender, receiver);
- return vmLink.asLink();
- }
-
- public static VmDataLink fromLink(Link link) {
- return ((DataLinkImpl) link).getImpl();
- }
-
- /**
- * @param sender
- * @param receiver
- */
- VmDataLink(VmIsolate sender, VmIsolate receiver) {
- this.sender = sender;
- this.receiver = receiver;
- }
-
- /**
- * Gets this shared link as Link instance.
- *
- * @return
- */
- public final Link asLink() {
- final DataLinkImpl link = linkHolder.get();
- if (link == null) {
- linkHolder.set(new DataLinkImpl(this));
- return linkHolder.get();
- } else {
- return link;
- }
- }
-
- /**
- * Close this link.
- */
- final void close() {
- if (!this.closed) {
- final VmIsolate current = VmIsolate.currentIsolate();
- if ((current != receiver) && (current != sender)) {
- throw new IllegalStateException(
- "Only sender or receiver can close this link");
- }
- this.closed = true;
- synchronized (this) {
- notifyAll();
- }
- }
- }
-
- /**
- * Is this link currently open.
- *
- * @return
- */
- final boolean isOpen() {
- return !closed;
- }
-
- /**
- * @return the receiver
- */
- final VmIsolate getReceiver() {
- return receiver;
- }
-
- /**
- * @return the sender
- */
- final VmIsolate getSender() {
- return sender;
- }
-
- /**
- * Receives a copy of a message sent on this Link.
- * <p/>
- * The current thread will block in this method until a sender is available.
- * When the sender and receiver rendezvous, the message will then be
- * transferred. If multiple threads invoke this method on the same object,
- * only one thread will receive any message at rendezvous and the other
- * threads will contend for subsequent access to the rendezvous point. A
- * normal return indicates that the message was received successfully. If an
- * exception occured on the sender side, no rendezvous will occur, and no
- * object will be transferred; the receiver will wait for the next
- * successful send. If an exception occurs on the receive, the sender will
- * see a successful transfer.
- * <p/>
- * This method never returns null.
- * <p/>
- * If the sending isolate becomes terminated after this method is invoked
- * but before it returns, the link will be closed, a ClosedLinkException
- * will be thrown, any subsequent attempts to use receive() will result in a
- * ClosedLinkException, and any Isolate objects corresponding to the receive
- * side of the link will reflect a terminated state.
- * <p/>
- * If invoked on a closed Link, this method will throw a
- * ClosedLinkException.
- * <p/>
- * If close() is invoked on the link while a thread is blocked in receive(),
- * receive() will throw a ClosedLinkException. No message will have been
- * transferred in that case.
- * <p/>
- * If Thread.interrupt() is invoked on a thread that has not yet completed
- * an invocation of this method, the results are undefined. An
- * InterruptedIOException may or may not be thrown; if not, control will
- * return from the method with a valid LinkMessage object. However, even if
- * InterruptedIOException is thrown, rendezvous and data transfer from the
- * sending isolate may have occurred. In particular, undetected message loss
- * between sender and receiver may occur.
- * <p/>
- * If a failure occurs due to the object being transferred between isolates
- * an IOException may be thrown in the receiver. For example, if a message
- * containing a large buffer is sent and the receiver has insufficient heap
- * memory for the buffer or if construction of a link in the receiver
- * isolate fails, an IOException will be thrown. The sender will see a
- * successful transfer in these cases.
- * <p/>
- * If the current isolate is not a receiver on this Link an
- * IllegalStateException will be thrown. The receiver will not rendezvous
- * with a sender in this case.
- *
- * @return
- */
- final LinkMessage receive() throws ClosedLinkException,
- IllegalStateException, InterruptedIOException, IOException {
- if (VmIsolate.currentIsolate() != receiver) {
- // Current isolate is not the receiver
- throw new IllegalStateException();
- }
- if (this.closed) {
- throw new ClosedLinkException();
- }
- final LinkMessageImpl message;
- synchronized (this) {
- while (messages.isEmpty()) {
- if (this.closed) {
- throw new ClosedLinkException();
- }
- try {
- wait();
- } catch (InterruptedException ex) {
- throw new InterruptedIOException();
- }
- }
- message = messages.poll();
- }
- message.notifyReceived();
- return message.CloneMessage();
- }
-
- /**
- * Sends the given message on this Link.
- * <p/>
- * The current thread will block in this method until a receiver is
- * available. When the sender and receiver rendezvous, the message will then
- * be transferred. A normal return indicates that the message was
- * transferred. If an exception occurs on the sender side, no rendezvous
- * will occur and no object will be transferred. But if an exception occurs
- * on the receive(), the sender will see a successful transfer.
- * <p/>
- * If the receiving isolate becomes terminated after this method is invoked
- * but before it returns, the link will be closed, a ClosedLinkException
- * will be thrown, any subsequent attempts to use send() will result in a
- * ClosedLinkException, and any Isolate objects corresponding to the receive
- * side of the link will reflect a terminated state.
- * <p/>
- * If invoked on a closed link, this method will throw a
- * ClosedLinkException.
- * <p/>
- * If close() is invoked on this Link while a thread is blocked in send(),
- * send() will throw a ClosedLinkException. No message will have been
- * transferred in that case.
- * <p/>
- * If Thread.interrupt() is invoked on a thread that has not yet completed
- * an invocation of this method, the results are undefined. An
- * InterruptedIOException may or may not be thrown; however, even if not,
- * control will return from the method. Rendezvous and data transfer to the
- * receiving isolate may or may not have occurred. In particular, undetected
- * message loss between sender and receiver may occur.
- * <p/>
- * If a failure occurs during the transfer an IOException may be thrown in
- * the sender and the object will not be sent. A transfer may succeed from
- * the sender's point of view, but cause an independent IOException in the
- * receiver. For example, if a message containing a large buffer is sent and
- * the receiver has insufficient heap memory for the buffer or if
- * construction of a link in the receiver isolate fails, an IOException will
- * be thrown in the receiver after the transfer completes.
- * <p/>
- * A ClosedLinkException will be thrown if the given LinkMessage contains a
- * closed Link, Socket, or ServerSocket. No object will be transferred in
- * this case.
- * <p/>
- * If the current isolate is not a sender on this Link, an
- * UnsupportedOperationException will be thrown. No object will be sent in
- * this case.
- *
- * @param message
- * @throws ClosedLinkException
- * @throws InterruptedIOException
- * @throws IOException
- */
- final void send(LinkMessage message) throws ClosedLinkException,
- InterruptedIOException, IOException {
- if (VmIsolate.currentIsolate() != sender) {
- // Current isolate is not a sender
- throw new UnsupportedOperationException();
- }
- if (this.closed) {
- throw new ClosedLinkException();
- }
- final LinkMessageImpl messageImpl = (LinkMessageImpl) message;
- synchronized (this) {
- if (this.closed) {
- throw new ClosedLinkException();
- }
- // Send message
- messages.add(messageImpl);
- notifyAll();
- }
-
- // Wait for the message to be picked up by the receiver
- try {
- messageImpl.waitUntilReceived();
- } catch (InterruptedException ex) {
- throw new InterruptedIOException();
- }
- }
-}
Added: trunk/core/src/core/org/jnode/vm/isolate/link/VmLink.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/link/VmLink.java (rev 0)
+++ trunk/core/src/core/org/jnode/vm/isolate/link/VmLink.java 2008-09-30 12:00:11 UTC (rev 4592)
@@ -0,0 +1,295 @@
+/*
+ * $Id: VmDataLink.java 4552 2008-09-11 11:38:42Z crawley $
+ */
+package org.jnode.vm.isolate.link;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.util.LinkedList;
+import java.util.Queue;
+
+import javax.isolate.ClosedLinkException;
+import javax.isolate.Link;
+import javax.isolate.LinkMessage;
+
+import org.jnode.vm.isolate.VmIsolate;
+import org.jnode.vm.isolate.VmIsolateLocal;
+
+/**
+ * Shared implementation of javax.isolate.Link
+ *
+ * @author Ewout Prangsma (ep...@us...)
+ */
+public final class VmLink {
+
+ private final VmIsolateLocal<LinkImpl> linkHolder = new VmIsolateLocal<LinkImpl>();
+
+ private final Queue<LinkMessageImpl> messages = new LinkedList<LinkMessageImpl>();
+
+ private boolean closed = false;
+
+ private VmIsolate sender;
+
+ private VmIsolate receiver;
+
+ /**
+ * Create a new data link between the given isolates.
+ *
+ * @param sender
+ * @param receiver
+ * @return
+ */
+ public static Link newLink(VmIsolate sender, VmIsolate receiver) {
+ if (sender == receiver) {
+ throw new IllegalArgumentException("sender == receiver");
+ }
+ VmLink vmLink = new VmLink(sender, receiver);
+ return vmLink.asLink();
+ }
+
+ public static VmLink fromLink(Link link) {
+ return ((LinkImpl) link).getImpl();
+ }
+
+ /**
+ * @param sender
+ * @param receiver
+ */
+ VmLink(VmIsolate sender, VmIsolate receiver) {
+ this.sender = sender;
+ this.receiver = receiver;
+ }
+
+ /**
+ * Gets this shared link as Link instance.
+ *
+ * @return
+ */
+ public final Link asLink() {
+ final LinkImpl link = linkHolder.get();
+ if (link == null) {
+ linkHolder.set(new LinkImpl(this));
+ return linkHolder.get();
+ } else {
+ return link;
+ }
+ }
+
+ /**
+ * Close this link.
+ */
+ final void close() {
+ if (!this.closed) {
+ final VmIsolate current = VmIsolate.currentIsolate();
+ if ((current != receiver) && (current != sender)) {
+ throw new IllegalStateException(
+ "Only sender or receiver can close this link");
+ }
+ this.closed = true;
+ synchronized (this) {
+ notifyAll();
+ }
+ }
+ }
+
+ /**
+ * Is this link currently open.
+ *
+ * @return
+ */
+ final boolean isOpen() {
+ return !closed;
+ }
+
+ /**
+ * @return the receiver
+ */
+ final VmIsolate getReceiver() {
+ return receiver;
+ }
+
+ /**
+ * @return the sender
+ */
+ final VmIsolate getSender() {
+ return sender;
+ }
+
+ /**
+ * Receives a copy of a message sent on this Link.
+ * <p/>
+ * The current thread will block in this method until a sender is available.
+ * When the sender and receiver rendezvous, the message will then be
+ * transferred. If multiple threads invoke this method on the same object,
+ * only one thread will receive any message at rendezvous and the other
+ * threads will contend for subsequent access to the rendezvous point. A
+ * normal return indicates that the message was received successfully. If an
+ * exception occured on the sender side, no rendezvous will occur, and no
+ * object will be transferred; the receiver will wait for the next
+ * successful send. If an exception occurs on the receive, the sender will
+ * see a successful transfer.
+ * <p/>
+ * This method never returns null.
+ * <p/>
+ * If the sending isolate becomes terminated after this method is invoked
+ * but before it returns, the link will be closed, a ClosedLinkException
+ * will be thrown, any subsequent attempts to use receive() will result in a
+ * ClosedLinkException, and any Isolate objects corresponding to the receive
+ * side of the link will reflect a terminated state.
+ * <p/>
+ * If invoked on a closed Link, this method will throw a
+ * ClosedLinkException.
+ * <p/>
+ * If close() is invoked on the link while a thread is blocked in receive(),
+ * receive() will throw a ClosedLinkException. No message will have been
+ * transferred in that case.
+ * <p/>
+ * If Thread.interrupt() is invoked on a thread that has not yet completed
+ * an invocation of this method, the results are undefined. An
+ * InterruptedIOException may or may not be thrown; if not, control will
+ * return from the method with a valid LinkMessage object. However, even if
+ * InterruptedIOException is thrown, rendezvous and data transfer from the
+ * sending isolate may have occurred. In particular, undetected message loss
+ * between sender and receiver may occur.
+ * <p/>
+ * If a failure occurs due to the object being transferred between isolates
+ * an IOException may be thrown in the receiver. For exam...
[truncated message content] |
|
From: <ls...@us...> - 2008-10-12 20:00:56
|
Revision: 4626
http://jnode.svn.sourceforge.net/jnode/?rev=4626&view=rev
Author: lsantha
Date: 2008-10-12 20:00:40 +0000 (Sun, 12 Oct 2008)
Log Message:
-----------
Prorgess with isolates: clarification of exit reason, initial system exit support, child isolates.
Modified Paths:
--------------
trunk/core/src/classpath/ext/javax/isolate/Isolate.java
trunk/core/src/classpath/ext/javax/isolate/IsolateStatus.java
trunk/core/src/classpath/vm/java/lang/VMRuntime.java
trunk/core/src/core/org/jnode/vm/isolate/IsolateStatusImpl.java
trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
trunk/core/src/core/org/jnode/vm/scheduler/VmThread.java
trunk/core/src/test/org/jnode/test/core/StatusLinkTest.java
Modified: trunk/core/src/classpath/ext/javax/isolate/Isolate.java
===================================================================
--- trunk/core/src/classpath/ext/javax/isolate/Isolate.java 2008-10-12 10:33:26 UTC (rev 4625)
+++ trunk/core/src/classpath/ext/javax/isolate/Isolate.java 2008-10-12 20:00:40 UTC (rev 4626)
@@ -21,24 +21,25 @@
package javax.isolate;
+import gnu.java.security.action.GetPropertiesAction;
+import java.security.AccessController;
import java.util.Properties;
-import java.security.AccessController;
-
import org.jnode.vm.isolate.VmIsolate;
-import gnu.java.security.action.GetPropertiesAction;
/**
* @author Ewout Prangsma (ep...@us...)
*/
public final class Isolate {
- /** The actual isolate implementation */
+ /**
+ * The actual isolate implementation
+ */
private final VmIsolate impl;
//todo hide this constructor
/**
* Constructor for the root isolate.
- *
+ *
* @param impl the JNode speciffic isolate implementation
*/
public Isolate(VmIsolate impl) {
@@ -47,7 +48,7 @@
/**
* Initialize this instance.
- *
+ *
* @param mainClass
* @param args
*/
@@ -57,7 +58,7 @@
/**
* Initialize this instance.
- *
+ *
* @param mainClass
* @param args
* @param properties
@@ -80,7 +81,7 @@
/**
* Gets the isolate that is running the current thread.
- *
+ *
* @return
*/
public static Isolate currentIsolate() {
@@ -89,7 +90,7 @@
/**
* If this object equal to the given object.
- *
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object other) {
@@ -98,7 +99,7 @@
/**
* Request normal termination of this isolate.
- *
+ *
* @param status
*/
public void exit(int status) {
@@ -107,17 +108,17 @@
/**
* Force termination of this isolate.
- *
+ *
* @param status
*/
public void halt(int status) {
- impl.halt(this, status);
+ impl.halt(status);
}
/**
* Gets a new Link associated with this Isolate from which the current
* isolate can receive status link messages.
- *
+ *
* @return
* @throws ClosedLinkException
*/
@@ -127,7 +128,7 @@
/**
* Start this isolate.
- *
+ *
* @param links
* @throws IsolateStartupException
*/
@@ -141,43 +142,46 @@
* terminated. New isolates may have been constructed or existing ones terminated by the time method returns.
*
* @return the active Isolate objects present at the time of the call
- *
* @throws SecurityException if a security manager is present and permission to query isolates is denied
*/
public static Isolate[] getIsolates() {
- //todo implement it
- throw new UnsupportedOperationException();
+ VmIsolate[] children = currentIsolate().impl.getChildren();
+ int c_nr = children.length;
+ Isolate[] ret = new Isolate[c_nr];
+ for (int i = 0; i < c_nr; i++)
+ ret[i] = children[i].getIsolate();
+
+ return ret;
}
/**
* Returns the name of the main class of this isolate.
- *
+ *
* @return the name of the main class of this isolate
*/
public String getMainClassName() {
- return impl.getMainClassName();
+ return impl.getMainClassName();
}
/**
* Returns the current state of the isolate.
*
* @return the current state of an isolate
- *
* @throws IllegalStateException if called before the isolate is started
- * @throws SecurityException if a security manager is present and permission to query isolates is denied
+ * @throws SecurityException if a security manager is present and permission to query isolates is denied
*/
- public IsolateStatus.State getState() {
+ public IsolateStatus.State getState() {
return impl.getIsolateState();
}
-
+
/**
* Retrieves a copy of the Link array passed to start() by the current
* isolate's creator. Modification of this array will have no effect on
* subsequent invocation of this method.
- *
+ * <p/>
* This method never returns null: it will return a zero-length array if
* this isolate's creator passed null to start().
- *
+ *
* @return
*/
public static Link[] getLinks() {
@@ -187,7 +191,7 @@
//todo hide this method
/**
* Gets the implementation instance.
- *
+ *
* @return
*/
final VmIsolate getImpl() {
Modified: trunk/core/src/classpath/ext/javax/isolate/IsolateStatus.java
===================================================================
--- trunk/core/src/classpath/ext/javax/isolate/IsolateStatus.java 2008-10-12 10:33:26 UTC (rev 4625)
+++ trunk/core/src/classpath/ext/javax/isolate/IsolateStatus.java 2008-10-12 20:00:40 UTC (rev 4626)
@@ -18,49 +18,75 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package javax.isolate;
+import org.jnode.vm.annotation.SharedStatics;
+
/**
+ * Represents isolate status, capturing such information as isolate state, exit code, and exit reason.
+ * State transitions in the isolate life cycle generate LinkMessages containing instances of this class
+ * which are sent over status links (but can be then forwarded over any link). If the isolate state is EXITED,
+ * the corresponding exit code and exit reason are contained in IsolateStatus.
+ *
* @author Ewout Prangsma (ep...@us...)
+ * @author Levente S\u00e1ntha
*/
public class IsolateStatus {
/**
* Defines the state of an Isolate.
- *
+ *
* @author Ewout Prangsma (ep...@us...)
*/
+ @SharedStatics
public static enum State {
- /** Isolate is starting */
+ /**
+ * Isolate is starting
+ */
STARTING,
- /** Isolate is started */
+ /**
+ * Isolate is started
+ */
STARTED,
- /** Isolate is exiting */
+ /**
+ * Isolate is exiting
+ */
EXITING,
- /** Isolate has exited */
+ /**
+ * Isolate has exited
+ */
EXITED,
- /** State is not known */
- UNKNOWN;
+ /**
+ * State is not known
+ */
+ UNKNOWN
}
/**
* Provides the reason for the termination of an isolate.
- *
+ *
* @author Ewout Prangsma (ep...@us...)
*/
+ @SharedStatics
public static enum ExitReason {
- /** The last non-deamon thread exited */
+ /**
+ * The last non-deamon thread exited
+ */
IMPLICIT_EXIT,
- /** Another isolate invoked Isolate.exit */
+ /**
+ * Another isolate invoked Isolate.exit
+ */
OTHER_EXIT,
- /** Another isolate invoed Isolated.halt */
+ /**
+ * Another isolate invoed Isolated.halt
+ */
OTHER_HALT,
/**
@@ -74,55 +100,91 @@
*/
SELF_HALT,
- /** The last non-deamon thread exited due to an uncaught exception */
- UNCAUGHT_EXCEPTION;
+ /**
+ * The last non-deamon thread exited due to an uncaught exception
+ */
+ UNCAUGHT_EXCEPTION
}
-
+
private final ExitReason exitReason;
private final State state;
private final int exitCode;
-
+
/**
* Initialize this instance.
+ *
* @param state
* @param exitReason
* @param exitCode
*/
protected IsolateStatus(State state, ExitReason exitReason, int exitCode) {
+ if (state == null)
+ throw new IllegalArgumentException();
+
+ if (state.equals(State.EXITED) && exitReason == null)
+ throw new IllegalArgumentException();
+
this.state = state;
this.exitReason = exitReason;
this.exitCode = exitCode;
}
-
+
/**
- * Are this and the given object equal.
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object other) {
- return super.equals(other);
- }
-
- /**
* Gets the exit reason.
+ *
* @return
*/
public ExitReason getExitReason() {
return exitReason;
}
-
+
/**
* Gets the exit code.
+ *
* @return
*/
public int getExitCode() {
return exitCode;
}
-
+
/**
* Gets the state of the isolate.
+ *
* @return
*/
public State getState() {
return state;
}
+
+ /**
+ * @param o
+ * @return
+ */
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof IsolateStatus)) return false;
+
+ IsolateStatus that = (IsolateStatus) o;
+
+ if (!state.equals(that.state)) return false;
+
+ if (state.equals(State.EXITED)) {
+ if (exitCode != that.exitCode) return false;
+ if (exitReason != that.exitReason) return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * @return
+ */
+ public int hashCode() {
+ int result = state.hashCode();
+ if (state.equals(State.EXITED)) {
+ result = 31 * result + exitReason.hashCode();
+ result = 31 * result + exitCode;
+ }
+ return result;
+ }
}
Modified: trunk/core/src/classpath/vm/java/lang/VMRuntime.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/VMRuntime.java 2008-10-12 10:33:26 UTC (rev 4625)
+++ trunk/core/src/classpath/vm/java/lang/VMRuntime.java 2008-10-12 20:00:40 UTC (rev 4626)
@@ -28,6 +28,8 @@
import org.jnode.vm.VmProcess;
import org.jnode.vm.VmSystem;
import org.jnode.vm.VmExit;
+import org.jnode.vm.isolate.VmIsolate;
+import javax.isolate.Isolate;
/**
* VMRuntime represents the interface to the Virtual Machine.
@@ -153,7 +155,11 @@
* @param status the status to end the process with
*/
static void exit(int status) {
- throw new VmExit(status);
+ if(VmIsolate.getRoot() == VmIsolate.currentIsolate()){
+ throw new VmExit(status);
+ } else {
+ VmIsolate.currentIsolate().systemExit(Isolate.currentIsolate(), status);
+ }
}
/**
Modified: trunk/core/src/core/org/jnode/vm/isolate/IsolateStatusImpl.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/IsolateStatusImpl.java 2008-10-12 10:33:26 UTC (rev 4625)
+++ trunk/core/src/core/org/jnode/vm/isolate/IsolateStatusImpl.java 2008-10-12 20:00:40 UTC (rev 4626)
@@ -9,10 +9,15 @@
* @author Levente S\u00e1ntha
*/
public class IsolateStatusImpl extends IsolateStatus implements Cloneable {
- public IsolateStatusImpl(State state, ExitReason exitReason, int exitCode) {
- super(state, exitReason, exitCode);
+
+ public IsolateStatusImpl(State state) {
+ super(state, null, 0);
}
+ public IsolateStatusImpl(ExitReason exitReason, int exitCode) {
+ super(State.EXITED, exitReason, exitCode);
+ }
+
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
@@ -30,7 +35,7 @@
public String toString() {
State s = getState();
if (s.equals(State.EXITED)) {
- return getState() + "(" + getExitReason() + "," + getExitCode();
+ return getState() + "(" + getExitReason() + "," + getExitCode() + ")";
} else {
return getState().toString();
}
Modified: trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2008-10-12 10:33:26 UTC (rev 4625)
+++ trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2008-10-12 20:00:40 UTC (rev 4626)
@@ -153,6 +153,8 @@
*/
private BootableHashMap<VmIsolateLocal<?>, ?> isolateLocalMap = new BootableHashMap<VmIsolateLocal<?>, Object>();
+ private List<VmIsolate> children = new LinkedList<VmIsolate>();
+
/**
* Isolate states.
*
@@ -369,23 +371,49 @@
return isolate;
}
+ public final void exit(Isolate isolate, int status) {
+ exit0(isolate, status);
+ }
+
+ public final void systemExit(Isolate isolate, int status) {
+ //only this isolate may call this method
+ testIsolate(isolate);
+
+ this.exitReason = IsolateStatus.ExitReason.SELF_EXIT;
+ this.exitCode = status;
+
+ int ac = threadGroup.activeCount();
+ if (ac > 0) {
+ Thread[] ta = new Thread[ac];
+ int rc = threadGroup.enumerate(ta);
+ Thread current = Thread.currentThread();
+ boolean found = false;
+ for (int i = 0; i < rc; i++) {
+ Thread thread = ta[i];
+ if (current != thread) {
+ thread.getVmThread().stopForced(null);
+ } else {
+ found = true;
+ }
+ }
+ if (found) {
+ current.getVmThread().stop(null);
+ }
+ }
+ }
+
/**
* Request normal termination of this isolate.
*
* @param status
*/
- public final void exit(Isolate isolate, int status) {
- testIsolate(isolate);
+ public final void exit0(Isolate isolate, int status) {
+ //testIsolate(isolate);
//todo handle demon threads
if (threadGroup.activeCount() > 0 || threadGroup.activeGroupCount() > 0)
return;
changeState(State.EXITING);
- try {
- threadGroup.destroy();
- } catch (Throwable t) {
- t.printStackTrace();
- }
this.exitCode = status;
if (currentIsolate() == this) {
@@ -395,18 +423,60 @@
this.exitReason = IsolateStatus.ExitReason.OTHER_EXIT;
}
- changeState(State.EXITED);
- StaticData.isolates.remove(this);
+ doExit();
}
/**
+ * Request normal termination of this isolate.
+ *
+ * @param status
+ */
+ public final void implicitExit(int status) {
+ //on this isolate may call this method
+ testIsolate(currentIsolate().isolate);
+
+ //todo handle demon threads
+ if (threadGroup.activeCount() > 0 || threadGroup.activeGroupCount() > 0)
+ return;
+
+ changeState(State.EXITING);
+
+ if (exitReason == null) {
+ exitReason = IsolateStatus.ExitReason.IMPLICIT_EXIT;
+ this.exitCode = status;
+ }
+
+ doExit();
+ }
+
+ /**
+ * Request normal termination of this isolate.
+ *
+ * @param status
+ */
+ public final void uncaughtExceptionExit() {
+ //on this isolate may call this method
+ testIsolate(currentIsolate().isolate);
+
+ //todo handle demon threads
+ if (threadGroup.activeCount() > 0 || threadGroup.activeGroupCount() > 0)
+ return;
+
+ changeState(State.EXITING);
+
+ exitReason = IsolateStatus.ExitReason.UNCAUGHT_EXCEPTION;
+ this.exitCode = -1;
+
+ doExit();
+ }
+
+ /**
* Force termination of this isolate.
*
* @param status
*/
@SuppressWarnings("deprecation")
- public final void halt(Isolate isolate, int status) {
- testIsolate(isolate);
+ public final void halt(int status) {
changeState(State.EXITING);
switch (state) {
case EXITING:
@@ -414,19 +484,28 @@
break;
}
+ if (currentIsolate() == this) {
+ this.exitReason = IsolateStatus.ExitReason.SELF_HALT;
+ } else {
+ this.exitReason = IsolateStatus.ExitReason.OTHER_HALT;
+ }
+
+ this.exitCode = status;
+
+ doExit();
+ }
+
+ private void doExit() {
try {
threadGroup.destroy();
} catch (Throwable t) {
t.printStackTrace();
}
- this.exitCode = status;
- if (currentIsolate() == this) {
- this.exitReason = IsolateStatus.ExitReason.SELF_HALT;
- } else {
- this.exitReason = IsolateStatus.ExitReason.OTHER_HALT;
- }
+
+ this.creator.removeChild(this);
+ StaticData.isolates.remove(this);
+
changeState(State.EXITED);
- StaticData.isolates.remove(this);
}
/**
@@ -677,6 +756,8 @@
// Update the state of this isolate.
changeState(State.STARTED);
+ //add to parent
+ this.creator.addChild(this);
// Run main method.
mainMethod.invoke(null, new Object[]{args});
@@ -842,10 +923,21 @@
private void sendStatus(VmLink link, IsolateStatus.State state) {
if (state.equals(IsolateStatus.State.EXITED)) {
- org.jnode.vm.Unsafe.debugStackTrace();
- link.sendStatus(new StatusLinkMessage(new IsolateStatusImpl(state, exitReason, exitCode)));
+ link.sendStatus(new StatusLinkMessage(new IsolateStatusImpl(exitReason, exitCode)));
} else {
- link.sendStatus(new StatusLinkMessage(new IsolateStatusImpl(state, null, -1)));
+ link.sendStatus(new StatusLinkMessage(new IsolateStatusImpl(state)));
}
}
+
+ private synchronized void addChild(VmIsolate child) {
+ this.children.add(child);
+ }
+
+ private synchronized void removeChild(VmIsolate child) {
+ this.children.remove(child);
+ }
+
+ public synchronized VmIsolate[] getChildren() {
+ return this.children.toArray(new VmIsolate[children.size()]);
+ }
}
Modified: trunk/core/src/core/org/jnode/vm/scheduler/VmThread.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/scheduler/VmThread.java 2008-10-12 10:33:26 UTC (rev 4625)
+++ trunk/core/src/core/org/jnode/vm/scheduler/VmThread.java 2008-10-12 20:00:40 UTC (rev 4626)
@@ -32,6 +32,7 @@
import org.jnode.vm.VmStackReader;
import org.jnode.vm.VmSystem;
import org.jnode.vm.VmSystemObject;
+import org.jnode.vm.isolate.VmIsolate;
import org.jnode.vm.annotation.Inline;
import org.jnode.vm.annotation.Internal;
import org.jnode.vm.annotation.KernelSpace;
@@ -47,7 +48,6 @@
import org.jnode.vm.memmgr.VmHeapManager;
import org.vmmagic.pragma.UninterruptiblePragma;
import org.vmmagic.unboxed.Address;
-import javax.isolate.Isolate;
/**
* VM thread implementation
@@ -390,7 +390,10 @@
if (javaThread != null) {
javaThread.onExit();
//exit the current isolate if needed
- Isolate.currentIsolate().exit(0);
+ if (ex instanceof ThreadDeath)
+ VmIsolate.currentIsolate().implicitExit(0);
+ else
+ VmIsolate.currentIsolate().uncaughtExceptionExit();
// Notify joining threads
synchronized (javaThread) {
javaThread.notifyAll();
@@ -407,6 +410,26 @@
* @param ex
* @throws UninterruptiblePragma
*/
+ public final void stopForced(Throwable ex) throws UninterruptiblePragma {
+ this.stopping = true;
+ if (javaThread != null) {
+ javaThread.onExit();
+ // Notify joining threads
+ synchronized (javaThread) {
+ javaThread.notifyAll();
+ }
+ }
+
+ // Do the low level stop uninterrupted
+ doStop();
+ }
+
+ /**
+ * Stop the thread permanently.
+ *
+ * @param ex
+ * @throws UninterruptiblePragma
+ */
@Uninterruptible
private final void doStop() {
final VmProcessor proc = VmMagic.currentProcessor();
@@ -722,17 +745,22 @@
*/
@LoadStatics
protected static final void runThread(VmThread thread) {
+ Throwable t = null;
try {
thread.asThread().run();
} catch (Throwable ex) {
try {
+ t = ex;
ex.printStackTrace();
} catch (Throwable ex2) {
/* Ignore */
}
} finally {
try {
- thread.stop(new ThreadDeath());
+ if (t == null)
+ thread.stop(new ThreadDeath());
+ else
+ thread.stop(t);
} catch (Throwable ex) {
/* Ignore */
while (true) {
Modified: trunk/core/src/test/org/jnode/test/core/StatusLinkTest.java
===================================================================
--- trunk/core/src/test/org/jnode/test/core/StatusLinkTest.java 2008-10-12 10:33:26 UTC (rev 4625)
+++ trunk/core/src/test/org/jnode/test/core/StatusLinkTest.java 2008-10-12 20:00:40 UTC (rev 4626)
@@ -4,7 +4,6 @@
package org.jnode.test.core;
import java.io.IOException;
-import java.io.InterruptedIOException;
import javax.isolate.Isolate;
import javax.isolate.IsolateStartupException;
import javax.isolate.IsolateStatus;
@@ -13,7 +12,7 @@
public class StatusLinkTest {
- public static void main(String[] args) throws IsolateStartupException, InterruptedIOException, IOException {
+ public static void main(String[] args) throws IsolateStartupException, IOException {
String clsName = ChildClass.class.getName();
Isolate child = new Isolate(clsName);
Link link = child.newStatusLink();
@@ -34,6 +33,7 @@
LinkMessage msg = link.receive();
if (msg.containsStatus()) {
IsolateStatus is = msg.extractStatus();
+ System.out.println("Isolate status: " + is);
if (is.getState().equals(IsolateStatus.State.EXITED)) {
System.out.println("Message: state=" + is.getState() + " code=" + is.getExitCode() +
" reason=" + is.getExitReason());
@@ -57,6 +57,23 @@
System.out.println("Child: started");
System.out.println("Child: sleeping 3 seconds");
Thread.sleep(3000);
+ //if(true)
+ // throw new RuntimeException();
+ new Thread(new Runnable() {
+ public void run() {
+ try {
+ System.out.println("Child thread: started");
+ System.out.println("Child thread: sleeping 3 seconds");
+ Thread.sleep(3000);
+ if (true)
+ throw new RuntimeException();
+ System.out.println("Child thread: exiting");
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+ }).start();
+
System.out.println("Child: exiting");
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-10-15 20:18:47
|
Revision: 4637
http://jnode.svn.sourceforge.net/jnode/?rev=4637&view=rev
Author: lsantha
Date: 2008-10-15 20:18:40 +0000 (Wed, 15 Oct 2008)
Log Message:
-----------
Imroved external isolate stopping and extended StatusLinkTest.
Modified Paths:
--------------
trunk/core/src/classpath/ext/javax/isolate/Isolate.java
trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
trunk/core/src/core/org/jnode/vm/scheduler/VmScheduler.java
trunk/core/src/core/org/jnode/vm/scheduler/VmThread.java
trunk/core/src/test/org/jnode/test/core/StatusLinkTest.java
Modified: trunk/core/src/classpath/ext/javax/isolate/Isolate.java
===================================================================
--- trunk/core/src/classpath/ext/javax/isolate/Isolate.java 2008-10-15 18:57:18 UTC (rev 4636)
+++ trunk/core/src/classpath/ext/javax/isolate/Isolate.java 2008-10-15 20:18:40 UTC (rev 4637)
@@ -103,7 +103,7 @@
* @param status
*/
public void exit(int status) {
- impl.exit(this, status);
+ impl.isolateExit(status);
}
/**
Modified: trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2008-10-15 18:57:18 UTC (rev 4636)
+++ trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2008-10-15 20:18:40 UTC (rev 4637)
@@ -371,17 +371,32 @@
return isolate;
}
- public final void exit(Isolate isolate, int status) {
- exit0(isolate, status);
+ public final void isolateExit(int status) {
+ changeState(State.EXITING);
+
+ this.exitCode = status;
+ if (currentIsolate() == this) {
+ this.exitReason = IsolateStatus.ExitReason.SELF_EXIT;
+ } else {
+ this.exitReason = IsolateStatus.ExitReason.OTHER_EXIT;
+ }
+
+ stopAllThreads();
}
public final void systemExit(Isolate isolate, int status) {
//only this isolate may call this method
testIsolate(isolate);
+ changeState(State.EXITING);
+
this.exitReason = IsolateStatus.ExitReason.SELF_EXIT;
this.exitCode = status;
+ stopAllThreads();
+ }
+
+ private void stopAllThreads() {
int ac = threadGroup.activeCount();
if (ac > 0) {
Thread[] ta = new Thread[ac];
@@ -397,33 +412,13 @@
}
}
if (found) {
- current.getVmThread().stop(null);
+ current.getVmThread().stop(new ThreadDeath());
+ } else {
+ doExit();
}
- }
- }
-
- /**
- * Request normal termination of this isolate.
- *
- * @param status
- */
- public final void exit0(Isolate isolate, int status) {
- //testIsolate(isolate);
- //todo handle demon threads
- if (threadGroup.activeCount() > 0 || threadGroup.activeGroupCount() > 0)
- return;
-
- changeState(State.EXITING);
-
- this.exitCode = status;
- if (currentIsolate() == this) {
- //todo implement: IMPLICIT_EXIT, UNCAUGHT_EXCEPTION
- this.exitReason = IsolateStatus.ExitReason.SELF_EXIT;
} else {
- this.exitReason = IsolateStatus.ExitReason.OTHER_EXIT;
+ //todo analyze this case
}
-
- doExit();
}
/**
@@ -439,9 +434,8 @@
if (threadGroup.activeCount() > 0 || threadGroup.activeGroupCount() > 0)
return;
- changeState(State.EXITING);
-
if (exitReason == null) {
+ changeState(State.EXITING);
exitReason = IsolateStatus.ExitReason.IMPLICIT_EXIT;
this.exitCode = status;
}
@@ -451,8 +445,6 @@
/**
* Request normal termination of this isolate.
- *
- * @param status
*/
public final void uncaughtExceptionExit() {
//on this isolate may call this method
Modified: trunk/core/src/core/org/jnode/vm/scheduler/VmScheduler.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/scheduler/VmScheduler.java 2008-10-15 18:57:18 UTC (rev 4636)
+++ trunk/core/src/core/org/jnode/vm/scheduler/VmScheduler.java 2008-10-15 20:18:40 UTC (rev 4637)
@@ -124,6 +124,10 @@
allThreadsLock.lock();
try {
allThreadsQueue.remove(thread);
+ //todo recent change, more testing needed
+ //remove the thread from readyQueue and sleepQueue too
+ readyQueue.remove(thread);
+ sleepQueue.remove(thread);
} finally {
allThreadsLock.unlock();
}
Modified: trunk/core/src/core/org/jnode/vm/scheduler/VmThread.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/scheduler/VmThread.java 2008-10-15 18:57:18 UTC (rev 4636)
+++ trunk/core/src/core/org/jnode/vm/scheduler/VmThread.java 2008-10-15 20:18:40 UTC (rev 4637)
@@ -390,10 +390,11 @@
if (javaThread != null) {
javaThread.onExit();
//exit the current isolate if needed
- if (ex instanceof ThreadDeath)
+ if (ex instanceof ThreadDeath) {
VmIsolate.currentIsolate().implicitExit(0);
- else
+ } else {
VmIsolate.currentIsolate().uncaughtExceptionExit();
+ }
// Notify joining threads
synchronized (javaThread) {
javaThread.notifyAll();
Modified: trunk/core/src/test/org/jnode/test/core/StatusLinkTest.java
===================================================================
--- trunk/core/src/test/org/jnode/test/core/StatusLinkTest.java 2008-10-15 18:57:18 UTC (rev 4636)
+++ trunk/core/src/test/org/jnode/test/core/StatusLinkTest.java 2008-10-15 20:18:40 UTC (rev 4637)
@@ -3,23 +3,51 @@
*/
package org.jnode.test.core;
-import java.io.IOException;
import javax.isolate.Isolate;
-import javax.isolate.IsolateStartupException;
import javax.isolate.IsolateStatus;
import javax.isolate.Link;
import javax.isolate.LinkMessage;
+import javax.isolate.ClosedLinkException;
+import javax.isolate.IsolateStartupException;
public class StatusLinkTest {
- public static void main(String[] args) throws IsolateStartupException, IOException {
- String clsName = ChildClass.class.getName();
- Isolate child = new Isolate(clsName);
- Link link = child.newStatusLink();
- new Thread(new StatusMonitor(link)).start();
+ public static void main(String[] args) throws Exception {
+
+ runChild(ChildClass1.class);
+
+ runChild(ChildClass2.class);
+
+ runChild(ChildClass3.class);
+
+ runChild(ChildClass4.class);
+
+ runChild(ChildClass5.class);
+
+ runChild(ChildClass6.class);
+
+ Isolate child = new Isolate(ChildClass7.class.getName());
+ new Thread(new StatusMonitor(child.newStatusLink()), "status-monitor").start();
child.start();
+
+ try {
+ Thread.sleep(100);
+ } finally {
+ child.exit(0);
+ }
}
+ private static void runChild(Class<?> clazz)
+ throws ClosedLinkException, IsolateStartupException, InterruptedException {
+ Isolate child;
+ Thread moni;
+ child = new Isolate(clazz.getName());
+ moni = new Thread(new StatusMonitor(child.newStatusLink()), "status-monitor");
+ moni.start();
+ child.start();
+ moni.join();
+ }
+
public static class StatusMonitor implements Runnable {
private final Link link;
@@ -33,13 +61,10 @@
LinkMessage msg = link.receive();
if (msg.containsStatus()) {
IsolateStatus is = msg.extractStatus();
- System.out.println("Isolate status: " + is);
+ System.out.println("Got status message: " + is);
+ //org.jnode.vm.Unsafe.debug("Got status message: " + is + "\n");
if (is.getState().equals(IsolateStatus.State.EXITED)) {
- System.out.println("Message: state=" + is.getState() + " code=" + is.getExitCode() +
- " reason=" + is.getExitReason());
break;
- } else {
- System.out.println("Message: state=" + is.getState());
}
} else {
System.out.println("Unknown message: " + msg);
@@ -51,30 +76,140 @@
}
}
- public static class ChildClass {
+ public static class ChildClass1 {
+ public static void main(String[] args) throws InterruptedException {
+ System.out.println("Child: started");
+ System.out.println("Child: sleeping 2 seconds");
+ Thread.sleep(2000);
+ System.out.println("Child: exiting");
+ }
+ }
+ public static class ChildClass2 {
public static void main(String[] args) throws InterruptedException {
System.out.println("Child: started");
- System.out.println("Child: sleeping 3 seconds");
- Thread.sleep(3000);
- //if(true)
- // throw new RuntimeException();
new Thread(new Runnable() {
public void run() {
try {
System.out.println("Child thread: started");
- System.out.println("Child thread: sleeping 3 seconds");
- Thread.sleep(3000);
- if (true)
- throw new RuntimeException();
+ System.out.println("Child thread: sleeping 2 seconds");
+ Thread.sleep(2000);
System.out.println("Child thread: exiting");
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
- }).start();
+ }, "child-thread2").start();
+ System.out.println("Child: exiting");
+ }
+ }
+ public static class ChildClass3 {
+ public static void main(String[] args) throws InterruptedException {
+ System.out.println("Child: started");
+ new Thread(new Runnable() {
+ public void run() {
+ try {
+ System.out.println("Child thread: started");
+ System.out.println("Child thread: sleeping 2 seconds");
+ Thread.sleep(2000);
+ System.out.println("Child thread: throwing an exception");
+ throw new RuntimeException();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+ }, "child-thread3").start();
+
System.out.println("Child: exiting");
}
}
+
+ public static class ChildClass4 {
+ public static void main(String[] args) throws InterruptedException {
+ System.out.println("Child: started");
+ new Thread(new Runnable() {
+ public void run() {
+ try {
+ System.out.println("Child thread: started");
+ System.out.println("Child thread: sleeping 2 seconds");
+ Thread.sleep(2000);
+ System.out.println("Child thread: calling System.exit()");
+ System.exit(0);
+ System.out.println("Child thread: exiting");
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+ }, "child-thread4").start();
+
+ System.out.println("Child: exiting");
+ }
+ }
+
+ public static class ChildClass5 {
+ public static void main(String[] args) throws InterruptedException {
+ System.out.println("Child: started");
+ new Thread(new Runnable() {
+ public void run() {
+ try {
+ System.out.println("Child thread: started");
+ System.out.println("Child thread: sleeping 2 seconds");
+ Thread.sleep(2000);
+ System.out.println("Child thread: callng Runtime.halt()");
+ Runtime.getRuntime().halt(0);
+ System.out.println("Child thread: exiting");
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+ }, "child-thread5").start();
+
+ System.out.println("Child: exiting");
+ }
+ }
+
+ public static class ChildClass6 {
+ public static void main(String[] args) throws InterruptedException {
+ System.out.println("Child: started");
+ new Thread(new Runnable() {
+ public void run() {
+ try {
+ System.out.println("Child thread: started");
+ System.out.println("Child thread: sleeping 2 seconds");
+ Thread.sleep(2000);
+ System.out.println("Child thread: calling Isolate.exit()");
+ Isolate.currentIsolate().exit(0);
+ System.out.println("Child thread: exiting");
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+ }, "child-thread6").start();
+
+ System.out.println("Child: exiting");
+ }
+ }
+
+ public static class ChildClass7 {
+ public static void main(String[] args) throws InterruptedException {
+ System.out.println("Child: started");
+ new Thread(new Runnable() {
+ public void run() {
+ System.out.println("Child thread: started");
+ System.out.println("Child thread: working ...");
+ for(int i = 0; i < 100000; i ++) {
+ // System.out.println("Child thread: " + i);
+ Math.sin(i);
+ if(i % 100 == 0) {
+ //org.jnode.vm.Unsafe.debug("i=" + i + "\n");
+ System.out.println("i=" + i);
+ }
+ }
+ System.out.println("Child thread: exiting");
+ }
+ }, "child-thread7").start();
+ System.out.println("Child: exiting");
+ }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-10-26 21:52:37
|
Revision: 4654
http://jnode.svn.sourceforge.net/jnode/?rev=4654&view=rev
Author: lsantha
Date: 2008-10-26 21:52:06 +0000 (Sun, 26 Oct 2008)
Log Message:
-----------
Clarified isolate exit reason.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/lang/VMRuntime.java
trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
trunk/core/src/test/org/jnode/test/core/StatusLinkTest.java
Modified: trunk/core/src/classpath/vm/java/lang/VMRuntime.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/VMRuntime.java 2008-10-26 21:38:26 UTC (rev 4653)
+++ trunk/core/src/classpath/vm/java/lang/VMRuntime.java 2008-10-26 21:52:06 UTC (rev 4654)
@@ -18,7 +18,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 java.lang;
import java.io.File;
@@ -162,6 +162,19 @@
}
}
+ /**
+ * Native method that actually shuts down the virtual machine.
+ *
+ * @param status the status to end the process with
+ */
+ static void halt(int status) {
+ if(VmIsolate.getRoot() == VmIsolate.currentIsolate()){
+ throw new VmExit(status);
+ } else {
+ VmIsolate.currentIsolate().systemHalt(Isolate.currentIsolate(), status);
+ }
+ }
+
/**
* Load a file. If it has already been loaded, do nothing. The name has
* already been mapped to a true filename.
@@ -181,7 +194,7 @@
* it to the path.
* XXX This method is being replaced by System.mapLibraryName.
*
- * @param pathname the path
+ * @param libname the path
* @param libname the short version of the library name
* @return the full filename
*/
Modified: trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2008-10-26 21:38:26 UTC (rev 4653)
+++ trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2008-10-26 21:52:06 UTC (rev 4654)
@@ -384,6 +384,19 @@
stopAllThreads();
}
+ public final void isolateHalt(int status) {
+ changeState(State.EXITING);
+
+ this.exitCode = status;
+ if (currentIsolate() == this) {
+ this.exitReason = IsolateStatus.ExitReason.SELF_HALT;
+ } else {
+ this.exitReason = IsolateStatus.ExitReason.OTHER_HALT;
+ }
+
+ stopAllThreads();
+ }
+
public final void systemExit(Isolate isolate, int status) {
//only this isolate may call this method
testIsolate(isolate);
@@ -396,6 +409,18 @@
stopAllThreads();
}
+ public final void systemHalt(Isolate isolate, int status) {
+ //only this isolate may call this method
+ testIsolate(isolate);
+
+ changeState(State.EXITING);
+
+ this.exitReason = IsolateStatus.ExitReason.SELF_HALT;
+ this.exitCode = status;
+
+ stopAllThreads();
+ }
+
private void stopAllThreads() {
int ac = threadGroup.activeCount();
if (ac > 0) {
@@ -407,7 +432,7 @@
Thread thread = ta[i];
if (current != thread) {
thread.getVmThread().stopForced(null);
- } else {
+ } else {
found = true;
}
}
@@ -417,7 +442,8 @@
doExit();
}
} else {
- //todo analyze this case
+ //todo analyze this case
+ doExit();
}
}
@@ -746,6 +772,10 @@
}
});
+ //create the appcontext for this isolate
+ //todo improve this
+ Class.forName("sun.awt.SunToolkit").getMethod("createNewAppContext").invoke(null);
+
// Update the state of this isolate.
changeState(State.STARTED);
//add to parent
Modified: trunk/core/src/test/org/jnode/test/core/StatusLinkTest.java
===================================================================
--- trunk/core/src/test/org/jnode/test/core/StatusLinkTest.java 2008-10-26 21:38:26 UTC (rev 4653)
+++ trunk/core/src/test/org/jnode/test/core/StatusLinkTest.java 2008-10-26 21:52:06 UTC (rev 4654)
@@ -35,17 +35,27 @@
} finally {
child.exit(0);
}
+
+ child = new Isolate(ChildClass7.class.getName());
+ new Thread(new StatusMonitor(child.newStatusLink()), "status-monitor").start();
+ child.start();
+
+ try {
+ Thread.sleep(100);
+ } finally {
+ child.halt(0);
+ }
+
}
- private static void runChild(Class<?> clazz)
+ private static Isolate runChild(Class<?> clazz)
throws ClosedLinkException, IsolateStartupException, InterruptedException {
- Isolate child;
- Thread moni;
- child = new Isolate(clazz.getName());
- moni = new Thread(new StatusMonitor(child.newStatusLink()), "status-monitor");
+ Isolate child = new Isolate(clazz.getName());
+ Thread moni = new Thread(new StatusMonitor(child.newStatusLink()), "status-monitor");
moni.start();
child.start();
moni.join();
+ return child;
}
public static class StatusMonitor implements Runnable {
@@ -198,12 +208,12 @@
public void run() {
System.out.println("Child thread: started");
System.out.println("Child thread: working ...");
- for(int i = 0; i < 100000; i ++) {
+ for (int i = 0; i < 100000; i++) {
// System.out.println("Child thread: " + i);
Math.sin(i);
- if(i % 100 == 0) {
- //org.jnode.vm.Unsafe.debug("i=" + i + "\n");
- System.out.println("i=" + i);
+ if (i % 100 == 0) {
+ org.jnode.vm.Unsafe.debug("i=" + i + "\n");
+ //System.out.println("i=" + i);
}
}
System.out.println("Child thread: exiting");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-11-09 12:24:56
|
Revision: 4691
http://jnode.svn.sourceforge.net/jnode/?rev=4691&view=rev
Author: lsantha
Date: 2008-11-09 12:24:49 +0000 (Sun, 09 Nov 2008)
Log Message:
-----------
Support for releasing owned monitors on thread stop. Internal execution methods on behalf of an isolate. Improved isolate termination.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/lang/Thread.java
trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
trunk/core/src/core/org/jnode/vm/scheduler/Monitor.java
trunk/core/src/core/org/jnode/vm/scheduler/MonitorManager.java
trunk/core/src/core/org/jnode/vm/scheduler/VmScheduler.java
trunk/core/src/core/org/jnode/vm/scheduler/VmThread.java
trunk/core/src/test/org/jnode/test/core/StatusLinkTest.java
Added Paths:
-----------
trunk/core/src/core/org/jnode/vm/isolate/IsolateThreadFactory.java
Modified: trunk/core/src/classpath/vm/java/lang/Thread.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/Thread.java 2008-11-09 10:31:21 UTC (rev 4690)
+++ trunk/core/src/classpath/vm/java/lang/Thread.java 2008-11-09 12:24:49 UTC (rev 4691)
@@ -408,9 +408,14 @@
* @param name
*/
protected Thread(ThreadGroup group, Runnable target, String name, VmIsolatedStatics isolatedStatics) {
+ /*
if (!(this instanceof IsolateThread)) {
throw new SecurityException("Constructor can only be called from IsolateThread");
}
+ */
+ if (!(this.getClass().getName().startsWith("org.jnode.vm.isolate"))) {
+ throw new SecurityException("Constructor can only be called from IsolateThread");
+ }
if (group == null) {
throw new InternalError("Isolate thread has invalid group: " + name);
}
Added: trunk/core/src/core/org/jnode/vm/isolate/IsolateThreadFactory.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/IsolateThreadFactory.java (rev 0)
+++ trunk/core/src/core/org/jnode/vm/isolate/IsolateThreadFactory.java 2008-11-09 12:24:49 UTC (rev 4691)
@@ -0,0 +1,212 @@
+package org.jnode.vm.isolate;
+
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.jnode.vm.classmgr.VmIsolatedStatics;
+import org.jnode.vm.Vm;
+import org.jnode.vm.VmSystem;
+import org.jnode.plugin.PluginManager;
+import org.jnode.naming.InitialNaming;
+import javax.naming.NameNotFoundException;
+import javax.isolate.IsolateStartupException;
+
+class IsolateThreadFactory implements ThreadFactory {
+ final ThreadGroup group;
+ final AtomicInteger threadNumber = new AtomicInteger(1);
+ final VmIsolatedStatics isolatedStatics;
+ final String namePrefix;
+
+ IsolateThreadFactory(final VmIsolate isolate) {
+ group = isolate.getThreadGroup();
+ namePrefix = "isolate-" + isolate.getId() + "-executor-";
+ isolatedStatics = isolate.getIsolatedStaticsTable();
+ }
+
+ public Thread newThread(final Runnable r) {
+ class IsolateFactoryThread extends Thread {
+ IsolateFactoryThread(ThreadGroup group, String name, VmIsolatedStatics isolatedStatics) {
+ super(group, r, name, isolatedStatics);
+ }
+ }
+
+ Thread t = new IsolateFactoryThread(group, namePrefix + threadNumber.getAndIncrement(), isolatedStatics){
+ public void start() {
+ org.jnode.vm.Unsafe.debug("factory 1 thread start() " + this.getName() +"\n");
+// getVmThread().switchToIsolate(isolatedStatics);
+ super.start();
+ }
+ };
+ /*
+ PluginManager piManager;
+ try {
+ piManager = InitialNaming.lookup(PluginManager.NAME);
+ } catch (NameNotFoundException ex) {
+ throw new RuntimeException("Cannot find PluginManager", ex);
+ }
+ */
+ //t.setContextClassLoader(piManager.getRegistry().getPluginsClassLoader());
+// if (t.isDaemon())
+ // t.setDaemon(false);
+ // if (t.getPriority() != Thread.NORM_PRIORITY)
+ // t.setPriority(Thread.NORM_PRIORITY + 2);
+ return t;
+ }
+}
+
+
+
+
+class IsolateThreadFactory2 implements ThreadFactory {
+ final ThreadGroup group;
+ final AtomicInteger threadNumber = new AtomicInteger(1);
+ final VmIsolatedStatics isolatedStatics;
+ final String namePrefix;
+ private final Thread factoryThread;
+ private Thread newThread;
+ private final Object lock = new Object();
+ private Runnable runnable;
+
+ IsolateThreadFactory2(final VmIsolate isolate) {
+ group = isolate.getThreadGroup();
+ namePrefix = "isolate-" + isolate.getId() + "-executor-";
+ isolatedStatics = isolate.getIsolatedStaticsTable();
+ factoryThread = new Thread(group, new Runnable(){
+ public void run() {
+ while(true) {
+ synchronized (lock) {
+ try {
+ while(runnable == null) {
+ lock.wait();
+ }
+
+ newThread = new Thread(group, runnable, namePrefix + threadNumber.getAndIncrement()){
+ public void start() {
+ org.jnode.vm.Unsafe.debug("factory thread start() " + this.getName() +"\n");
+ super.start();
+ }
+ };
+ runnable = null;
+ lock.notifyAll();
+ } catch (InterruptedException x) {
+ break;
+ }
+ }
+ }
+ }
+ },"isolate-" + isolate.getId() + "-thread-factory-");
+ factoryThread.start();
+ }
+
+ public synchronized Thread newThread(final Runnable r) {
+ Thread ret;
+ org.jnode.vm.Unsafe.debug("IsolateThreadFactory2.newThread() called\n");
+ org.jnode.vm.Unsafe.debugStackTrace();
+ synchronized (lock) {
+ newThread = null;
+ runnable = r;
+ lock.notifyAll();
+ while(newThread == null) {
+ try {
+ lock.wait();
+ } catch (InterruptedException x) {
+ break;
+ }
+ }
+ ret = newThread;
+ newThread = null;
+ lock.notifyAll();
+ }
+ org.jnode.vm.Unsafe.debug("IsolateThreadFactory2.newThread() returned\n");
+
+ return ret;
+ }
+}
+
+/* `
+package org.jnode.vm.isolate;
+
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.jnode.vm.classmgr.VmIsolatedStatics;
+
+class IsolateThreadFactory implements ThreadFactory {
+ final ThreadGroup group;
+ final AtomicInteger threadNumber = new AtomicInteger(1);
+ final VmIsolatedStatics isolatedStatics;
+ final String namePrefix;
+
+ IsolateThreadFactory(final VmIsolate isolate) {
+ group = isolate.getThreadGroup();
+ namePrefix = "isolate-" + isolate.getId() + "-executor-";
+ isolatedStatics = isolate.getIsolatedStaticsTable();
+ }
+
+ public Thread newThread(final Runnable r) {
+
+ org.jnode.vm.Unsafe.debug("newThread Called - 0\n");
+ Thread t = new IsolateFactoryThread(group, r, namePrefix + threadNumber.getAndIncrement(), null);
+ org.jnode.vm.Unsafe.debug("newThread thread created - 0\n");
+// if (t.isDaemon())
+ // t.setDaemon(false);
+ // if (t.getPriority() != Thread.NORM_PRIORITY)
+ // t.setPriority(Thread.NORM_PRIORITY + 2);
+ return t;
+ }
+}
+
+class IsolateThreadFactory2 implements ThreadFactory {
+ final ThreadGroup group;
+ final AtomicInteger threadNumber = new AtomicInteger(1);
+ final VmIsolatedStatics isolatedStatics;
+ final String namePrefix;
+ private final Thread factoryThread;
+ private Thread newThread;
+ private final Object lock = new Object();
+ private boolean flag = false;
+
+ IsolateThreadFactory2(final VmIsolate isolate) {
+ group = isolate.getThreadGroup();
+ namePrefix = "isolate-" + isolate.getId() + "-executor-";
+ isolatedStatics = isolate.getIsolatedStaticsTable();
+ factoryThread = new Thread(new Runnable(){
+ public void run() {
+ while(true) {
+ synchronized (lock) {
+ try {
+ while(!flag) {
+ lock.wait();
+
+ }
+
+ newThread = new IsolateFactoryThread(group, null, namePrefix + threadNumber.getAndIncrement(), null);
+ } catch (Exception x) {
+ x.printStackTrace();
+ }
+ }
+ }
+ }
+ },"isolate-" + isolate.getId() + "-thread-factory-");
+ factoryThread.start();
+ }
+
+ public Thread newThread(final Runnable r) {
+
+ org.jnode.vm.Unsafe.debug("newThread Called - 0\n");
+ Thread t = new IsolateFactoryThread(group, r, namePrefix + threadNumber.getAndIncrement(), null);
+ org.jnode.vm.Unsafe.debug("newThread thread created - 0\n");
+// if (t.isDaemon())
+ // t.setDaemon(false);
+ // if (t.getPriority() != Thread.NORM_PRIORITY)
+ // t.setPriority(Thread.NORM_PRIORITY + 2);
+ return t;
+ }
+}
+
+
+class IsolateFactoryThread extends Thread {
+ IsolateFactoryThread(ThreadGroup group, Runnable r, String name, VmIsolatedStatics isolatedStatics) {
+ super(group, r, name, isolatedStatics);
+ }
+ }
+
+*/
\ No newline at end of file
Modified: trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2008-11-09 10:31:21 UTC (rev 4690)
+++ trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2008-11-09 12:24:49 UTC (rev 4691)
@@ -48,6 +48,7 @@
import org.jnode.vm.VmIOContext;
import org.jnode.vm.VmMagic;
import org.jnode.vm.VmSystem;
+import org.jnode.vm.scheduler.VmThread;
import org.jnode.vm.annotation.MagicPermission;
import org.jnode.vm.annotation.PrivilegedActionPragma;
import org.jnode.vm.annotation.SharedStatics;
@@ -153,7 +154,7 @@
*/
private BootableHashMap<VmIsolateLocal<?>, ?> isolateLocalMap = new BootableHashMap<VmIsolateLocal<?>, Object>();
- private List<VmIsolate> children = new LinkedList<VmIsolate>();
+ private final List<VmIsolate> children = new LinkedList<VmIsolate>();
/**
* Isolate states.
@@ -235,7 +236,9 @@
static final VmIsolate getRoot() {
if (rootIsolate == null) {
- rootIsolate = new VmIsolate();
+ rootIsolate = new VmIsolate(null/*Thread.currentThread().getVmThread().getIsolatedStatics()*/);
+// org.jnode.vm.Unsafe.debug("getRoot() istatics: " + rootIsolate.isolatedStaticsTable + "\n");
+// org.jnode.vm.Unsafe.debugStackTrace();
}
return rootIsolate;
}
@@ -265,7 +268,7 @@
/**
* Constructor for the root isolate.
*/
- private VmIsolate() {
+ private VmIsolate(VmIsolatedStatics isolatedStatics) {
this.id = StaticData.nextId();
this.isolate = new Isolate(this);
this.mainClass = null;
@@ -274,7 +277,7 @@
this.state = State.STARTED;
this.threadGroup = getRootThreadGroup();
this.creator = null;
- this.isolatedStaticsTable = null;
+ this.isolatedStaticsTable = isolatedStatics;
// Initialize currentHolder
IsolatedStaticData.current = this;
@@ -301,6 +304,14 @@
this.isolatedStaticsTable = new VmIsolatedStatics(VmMagic.currentProcessor().getIsolatedStatics(),
arch, new Unsafe.UnsafeObjectResolver());
this.creator = currentIsolate();
+ if(getRoot().executor == null && isRoot()) {
+ //initialize the root executor on the creation of the first child
+ getRoot().invokeAndWait(new Runnable(){
+ public void run() {
+ //org.jnode.vm.Unsafe.debug("Root executor ready\n");
+ }
+ });
+ }
StaticData.isolates.add(this);
}
@@ -381,7 +392,9 @@
this.exitReason = IsolateStatus.ExitReason.OTHER_EXIT;
}
- stopAllThreads();
+ disposeAppContext(this.exitReason == IsolateStatus.ExitReason.SELF_EXIT);
+
+ //stopAllThreads();
}
public final void isolateHalt(int status) {
@@ -394,7 +407,9 @@
this.exitReason = IsolateStatus.ExitReason.OTHER_HALT;
}
- stopAllThreads();
+ disposeAppContext(this.exitReason == IsolateStatus.ExitReason.SELF_HALT);
+
+ //stopAllThreads();
}
public final void systemExit(Isolate isolate, int status) {
@@ -406,7 +421,9 @@
this.exitReason = IsolateStatus.ExitReason.SELF_EXIT;
this.exitCode = status;
- stopAllThreads();
+ disposeAppContext(true);
+
+ //stopAllThreads();
}
public final void systemHalt(Isolate isolate, int status) {
@@ -418,11 +435,14 @@
this.exitReason = IsolateStatus.ExitReason.SELF_HALT;
this.exitCode = status;
- stopAllThreads();
+ disposeAppContext(true);
+
+ //stopAllThreads();
}
private void stopAllThreads() {
- // FIXME - this is probably unsafe because any of the threads being killed could
+ // TODO - investigate it
+ // TODO - this is probably unsafe because any of the threads being killed could
// be in the middle of updating a critical system data structure. I'm also
// unsure of the order in which we are killing the threads here. It might be
// better to kill the isolate's main thread first to give it the chance to
@@ -431,8 +451,6 @@
if (ac > 0) {
Thread[] ta = new Thread[ac];
int rc = threadGroup.enumerate(ta);
- // FIXME - notwithstanding the above comments, is the 'current' thread the
- // same one as the isolate's main thread? (Stephen Crawley - 2008-11-08)
Thread current = Thread.currentThread();
boolean found = false;
for (int i = 0; i < rc; i++) {
@@ -459,11 +477,11 @@
*
* @param status
*/
- public final void implicitExit(int status) {
+ public final void implicitExit(VmThread vmThread, int status) {
//on this isolate may call this method
testIsolate(currentIsolate().isolate);
- // FIXME - handle demon threads
+ // TODO - handle demon threads
if (threadGroup.activeCount() > 0 || threadGroup.activeGroupCount() > 0)
return;
@@ -473,7 +491,14 @@
this.exitCode = status;
}
- doExit();
+ if(vmThread.getName().indexOf("-AWT-stopper") > - 1) {
+ doExit();
+ } else {
+ disposeAppContext(true);
+ }
+
+ //doExit();
+ ///stopAllThreads();
}
/**
@@ -483,7 +508,7 @@
//on this isolate may call this method
testIsolate(currentIsolate().isolate);
- // FIXME - handle demon threads
+ // TODO - handle demon threads
if (threadGroup.activeCount() > 0 || threadGroup.activeGroupCount() > 0)
return;
@@ -492,13 +517,18 @@
exitReason = IsolateStatus.ExitReason.UNCAUGHT_EXCEPTION;
this.exitCode = -1;
- doExit();
+ disposeAppContext(true);
+
+ //doExit();
+
+ //stopAllThreads();
}
/**
* Force termination of this isolate.
*
* @param status
+ * @deprecated
*/
@SuppressWarnings("deprecation")
public final void halt(int status) {
@@ -522,7 +552,8 @@
private void doExit() {
try {
- threadGroup.destroy();
+ if(!threadGroup.isDestroyed())
+ threadGroup.destroy();
} catch (Throwable t) {
t.printStackTrace();
}
@@ -639,8 +670,7 @@
}
// Create a new ThreadGroup
- this.threadGroup = new ThreadGroup(StaticData.getRoot().threadGroup,
- mainClass);
+ this.threadGroup = new ThreadGroup(StaticData.getRoot().threadGroup, mainClass);
// Find plugin manager
PluginManager piManager;
@@ -677,7 +707,7 @@
private Thread executorThread;
*/
- public void invokeAndWait(final Runnable task) {
+// public void invokeAndWait(final Runnable task) {
//TODO implement VmIsolate.invokeAndWait(Runnable)
/*
if(this == StaticData.rootIsolate){
@@ -700,7 +730,7 @@
}
}
*/
- }
+// }
/*
private class TaskExecutor implements Runnable{
public void run() {
@@ -735,7 +765,161 @@
}
*/
+
+ private java.util.concurrent.ExecutorService executor;
+
/**
+ * Execute a task within this isolate and wait for completion.
+ *
+ * @param task the task as a Runnable object
+ */
+ public synchronized void invokeAndWait(final Runnable task) {
+ if(executor == null) {
+ executor = java.util.concurrent.Executors.newSingleThreadExecutor(new IsolateThreadFactory2(this));
+ }
+ if(task == null)
+ return;
+
+ try {
+ if(executor.submit(task).get() != null) {
+ throw new RuntimeException("Execution failed!");
+ }
+ } catch (Exception x) {
+ throw new RuntimeException(x);
+ }
+ }
+
+ /**
+ * Execute a task asynchronously within this isolate.
+ *
+ * @param task the task as a Runnable object
+ */
+ public synchronized void invokeLater(final Runnable task) {
+ org.jnode.vm.Unsafe.debug("invokeLater Called - 0\n");
+ if(executor == null) {
+ executor = java.util.concurrent.Executors.newSingleThreadExecutor(new IsolateThreadFactory(this));
+ org.jnode.vm.Unsafe.debug("invokeAndWait executor created - 0\n");
+ }
+ if(task == null)
+ return;
+
+ try {
+ org.jnode.vm.Unsafe.debug("invokeAndWait submitting task - 0\n");
+ executor.submit(task);
+ } catch (Exception x) {
+ throw new RuntimeException(x);
+ }
+ }
+
+ boolean isEDT(){
+ if(appContext == null)
+ return false;
+
+
+ try {
+ Object eq = appContext.getClass().getMethod("get", Object.class).
+ invoke(appContext, appContext.getClass().getField("EVENT_QUEUE_KEY").get(null));
+ if(eq == null)
+ return false;
+
+ org.jnode.vm.Unsafe.debug("isEDT - 1\n");
+
+ Object t = eq.getClass().getField("dispatchThread").get(eq);
+ if(t == null)
+ return false;
+
+ org.jnode.vm.Unsafe.debug("isEDT edt=" + t + "\n");
+ org.jnode.vm.Unsafe.debug("isEDT currenThread=" + Thread.currentThread() + "\n");
+
+ return t == Thread.currentThread();
+ }catch (Exception x) {
+ throw new RuntimeException(x);
+ }
+ /*
+ try {
+ return (Boolean) Class.forName("java.awt.EventQueue").
+ getMethod("isDispatchThread").invoke(null);
+ } catch (Exception x) {
+ throw new RuntimeException(x);
+
+ }
+ */
+ // return false;
+ }
+
+ private Object appContext;
+
+ private void disposeAppContext(boolean intraIsolate) {
+ if(appSupport != null) {
+ appSupport.stop(intraIsolate);
+ } else {
+ stopAllThreads();
+ }
+ }
+
+ /**
+ *
+ * @param intraIsolate
+ * @deprecated
+ */
+ private void disposeAppContext_old(boolean intraIsolate) {
+ final Object appContext;
+ final boolean is_edt;
+ synchronized (this) {
+ is_edt = isEDT();
+ appContext = this.appContext;
+ this.appContext = null;
+ }
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled - 000\n");
+ org.jnode.vm.Unsafe.debugStackTrace();
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled - 000 " + intraIsolate + "\n");
+ if(appContext != null) {
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled - 0001\n");
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled - 0002\n");
+ if(intraIsolate && is_edt) {
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled - 0003\n");
+ Thread t = new Thread(new Runnable() {
+ public void run() {
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled - 00\n");
+ getRoot().invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled - 01\n");
+ appContext.getClass().getMethod("dispose").invoke(appContext);
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled - 02\n");
+ } catch (Exception x) {
+ x.printStackTrace();
+ }
+ }
+ });
+ stopAllThreads();
+ doExit();
+ }
+ }, "isolate-" + getId() + "-AWT-stopper");
+ t.start();
+ } else {
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled - 0004\n");
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled - 0\n");
+ getRoot().invokeAndWait(new Runnable(){
+ public void run() {
+ try {
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled - 1\n");
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled appcontext: " + appContext + "\n");
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled appcontext.getClass(): " + appContext.getClass() + "\n");
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled appcontext.getClass().dispose: " + appContext.getClass().getMethod("dispose") + "\n");
+ appContext.getClass().getMethod("dispose").invoke(appContext);
+ org.jnode.vm.Unsafe.debug("disposeAppContextCalled - 2\n");
+ }catch (Exception x) {
+ x.printStackTrace();
+ }
+ }
+ });
+ stopAllThreads();
+ }
+ }
+ }
+
+ /**
* Run this isolate. This method is called from IsolateThread.
*/
@PrivilegedActionPragma
@@ -781,7 +965,9 @@
//create the appcontext for this isolate
// TODO - improve this
- Class.forName("sun.awt.SunToolkit").getMethod("createNewAppContext").invoke(null);
+ //appContext = Class.forName("sun.awt.SunToolkit").getMethod("createNewAppContext").invoke(null);
+ this.appSupport = new AppSupport(this);
+ this.appSupport.start();
// Update the state of this isolate.
changeState(State.STARTED);
@@ -812,6 +998,8 @@
} catch (Throwable ex2) {
Unsafe.debug("Exception in catch block.. giving up: ");
Unsafe.debug(ex2.getMessage());
+ } finally {
+ systemHalt(isolate, -1);
}
}
}
@@ -958,15 +1146,158 @@
}
}
- private synchronized void addChild(VmIsolate child) {
- this.children.add(child);
+ private void addChild(VmIsolate child) {
+ synchronized (children) {
+ children.add(child);
+ }
}
- private synchronized void removeChild(VmIsolate child) {
- this.children.remove(child);
+ private void removeChild(VmIsolate child) {
+ synchronized (children) {
+ children.remove(child);
+ }
}
- public synchronized VmIsolate[] getChildren() {
- return this.children.toArray(new VmIsolate[children.size()]);
+ public VmIsolate[] getChildren() {
+ synchronized (children) {
+ return children.toArray(new VmIsolate[children.size()]);
+ }
}
+
+ public ThreadGroup getThreadGroup() {
+ if(threadGroup == null) {
+ throw new IllegalStateException("Isolate not available");
+ }
+ return threadGroup;
+ }
+
+ private AppSupport appSupport;
+
+ @SharedStatics
+ private static class AppSupport {
+ private static boolean awtSupport;
+ static {
+ try {
+ Class.forName("java.awt.Toolkit");
+ awtSupport = true;
+ } catch (ClassNotFoundException x) {
+ awtSupport = false;
+ }
+ }
+
+ private final VmIsolate vmIsolate;
+ private Object appContext;
+
+ AppSupport(VmIsolate vmIsolate) {
+ this.vmIsolate = vmIsolate;
+ }
+
+ boolean isAWTReady() {
+ if(!awtSupport)
+ return false;
+
+ try {
+ return Class.forName("java.awt.Toolkit").getField("toolkit").get(null) != null;
+ } catch (Exception x) {
+ return false;
+ }
+ }
+
+ void start() throws Exception {
+ if(isAWTReady()) {
+ synchronized (this) {
+ appContext = Class.forName("sun.awt.SunToolkit").getMethod("createNewAppContext").invoke(null);
+ }
+ }
+ }
+
+ void stop(boolean intraIsolate) {
+ boolean done = false;
+ if(awtSupport) {
+ synchronized (this) {
+ if(appContext != null) {
+ disposeAppContext(intraIsolate);
+ done = true;
+ }
+ }
+ }
+
+ if(!done) {
+ vmIsolate.stopAllThreads();
+ vmIsolate.doExit();
+ }
+ }
+
+ boolean isEDT(){
+ if(appContext == null)
+ return false;
+
+
+ try {
+ Object eq = appContext.getClass().getMethod("get", Object.class).
+ invoke(appContext, appContext.getClass().getField("EVENT_QUEUE_KEY").get(null));
+ if(eq == null)
+ return false;
+
+ Object t = eq.getClass().getField("dispatchThread").get(eq);
+ if(t == null)
+ return false;
+
+ return t == Thread.currentThread();
+ }catch (Exception x) {
+ throw new RuntimeException(x);
+ }
+ /*
+ try {
+ return (Boolean) Class.forName("java.awt.EventQueue").
+ getMethod("isDispatchThread").invoke(null);
+ } catch (Exception x) {
+ throw new RuntimeException(x);
+
+ }
+ */
+ // return false;
+ }
+
+ private void disposeAppContext(boolean intraIsolate) {
+ final Object appContext;
+ final boolean is_edt;
+ synchronized (this) {
+ is_edt = isEDT();
+ appContext = this.appContext;
+ this.appContext = null;
+ }
+ if(appContext != null) {
+ if(intraIsolate && is_edt) {
+ Thread t = new Thread(new Runnable() {
+ public void run() {
+ getRoot().invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ appContext.getClass().getMethod("dispose").invoke(appContext);
+ } catch (Exception x) {
+ x.printStackTrace();
+ }
+ }
+ });
+ vmIsolate.stopAllThreads();
+ vmIsolate.doExit();
+ }
+ }, "isolate-" + vmIsolate.getId() + "-AWT-stopper");
+ t.start();
+ } else {
+ getRoot().invokeAndWait(new Runnable(){
+ public void run() {
+ try {
+ appContext.getClass().getMethod("dispose").invoke(appContext);
+ }catch (Exception x) {
+ x.printStackTrace();
+ }
+ }
+ });
+ vmIsolate.stopAllThreads();
+ }
+ }
+ }
+ }
}
Modified: trunk/core/src/core/org/jnode/vm/scheduler/Monitor.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/scheduler/Monitor.java 2008-11-09 10:31:21 UTC (rev 4690)
+++ trunk/core/src/core/org/jnode/vm/scheduler/Monitor.java 2008-11-09 12:24:49 UTC (rev 4691)
@@ -67,6 +67,11 @@
private final VmThreadQueue.ScheduleQueue notifyQueue;
/**
+ * The previous monitor in a thread bound monitor chain
+ */
+ private Monitor previous;
+
+ /**
* Create a new instance
*/
public Monitor() {
@@ -86,6 +91,7 @@
Monitor(VmThread owner, int lockCount) {
this.monitorLock = 0;
th...
[truncated message content] |
|
From: <ls...@us...> - 2008-12-08 14:51:53
|
Revision: 4783
http://jnode.svn.sourceforge.net/jnode/?rev=4783&view=rev
Author: lsantha
Date: 2008-12-08 14:51:34 +0000 (Mon, 08 Dec 2008)
Log Message:
-----------
Integrated java.lang.reflect.Array from OpenJDK.
Added Paths:
-----------
trunk/core/src/classpath/java/java/lang/reflect/CPArray.java
trunk/core/src/openjdk/java/java/lang/reflect/Array.java
trunk/core/src/openjdk/vm/java/lang/reflect/NativeArray.java
Added: trunk/core/src/classpath/java/java/lang/reflect/CPArray.java
===================================================================
--- trunk/core/src/classpath/java/java/lang/reflect/CPArray.java (rev 0)
+++ trunk/core/src/classpath/java/java/lang/reflect/CPArray.java 2008-12-08 14:51:34 UTC (rev 4783)
@@ -0,0 +1,656 @@
+/* java.lang.reflect.Array - manipulate arrays by reflection
+ Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.lang.reflect;
+
+/**
+ * Array holds static helper functions that allow you to create and
+ * manipulate arrays by reflection. Operations know how to perform widening
+ * conversions, but throw {@link IllegalArgumentException} if you attempt
+ * a narrowing conversion. Also, when accessing primitive arrays, this
+ * class performs object wrapping and unwrapping as necessary.<p>
+ *
+ * <B>Note:</B> This class returns and accepts types as Classes, even
+ * primitive types; there are Class types defined that represent each
+ * different primitive type. They are <code>java.lang.Boolean.TYPE,
+ * java.lang.Byte.TYPE,</code>, also available as <code>boolean.class,
+ * byte.class</code>, etc. These are not to be confused with the
+ * classes <code>java.lang.Boolean, java.lang.Byte</code>, etc., which are
+ * real classes. Note also that the shorthand <code>Object[].class</code>
+ * is a convenient way to get array Classes.<p>
+ *
+ * <B>Performance note:</B> This class performs best when it does not have
+ * to convert primitive types. The further along the chain it has to convert,
+ * the worse performance will be. You're best off using the array as whatever
+ * type it already is, and then converting the result. You will do even
+ * worse if you do this and use the generic set() function.
+ *
+ * @author John Keiser
+ * @author Eric Blake (eb...@em...)
+ * @author Per Bothner (bo...@cy...)
+ * @see java.lang.Boolean#TYPE
+ * @see java.lang.Byte#TYPE
+ * @see java.lang.Short#TYPE
+ * @see java.lang.Character#TYPE
+ * @see java.lang.Integer#TYPE
+ * @see java.lang.Long#TYPE
+ * @see java.lang.Float#TYPE
+ * @see java.lang.Double#TYPE
+ * @since 1.1
+ * @status updated to 1.4
+ */
+public final class CPArray
+{
+
+ /**
+ * This class is uninstantiable.
+ */
+ private CPArray()
+ {
+ }
+
+ /**
+ * Creates a new single-dimensioned array.
+ * @param componentType the type of the array to create
+ * @param length the length of the array to create
+ * @return the created array, cast to an Object
+ * @throws NullPointerException if <code>componentType</code> is null
+ * @throws IllegalArgumentException if <code>componentType</code> is
+ * <code>Void.TYPE</code>
+ * @throws NegativeArraySizeException when length is less than 0
+ * @throws OutOfMemoryError if memory allocation fails
+ */
+ public static Object newInstance(Class<?> componentType, int length)
+ {
+ if (! componentType.isPrimitive())
+ return VMArray.createObjectArray(componentType, length);
+ if (componentType == boolean.class)
+ return new boolean[length];
+ if (componentType == byte.class)
+ return new byte[length];
+ if (componentType == char.class)
+ return new char[length];
+ if (componentType == short.class)
+ return new short[length];
+ if (componentType == int.class)
+ return new int[length];
+ if (componentType == long.class)
+ return new long[length];
+ if (componentType == float.class)
+ return new float[length];
+ if (componentType == double.class)
+ return new double[length];
+ // assert componentType == void.class
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Creates a new multi-dimensioned array. The new array has the same
+ * component type as the argument class, and the number of dimensions
+ * in the new array is the sum of the dimensions of the argument class
+ * and the length of the argument dimensions. Virtual Machine limitations
+ * forbid too many dimensions (usually 255 is the maximum); but even
+ * 50 dimensions of 2 elements in each dimension would exceed your memory
+ * long beforehand!
+ *
+ * @param componentType the type of the array to create.
+ * @param dimensions the dimensions of the array to create. Each element
+ * in <code>dimensions</code> makes another dimension of the new
+ * array. Thus, <code>Array.newInstance(java.lang.Boolean,
+ * new int[]{1,2,3})</code> is the same as
+ * <code>new java.lang.Boolean[1][2][3]</code>
+ * @return the created array, cast to an Object
+ * @throws NullPointerException if componentType or dimension is null
+ * @throws IllegalArgumentException if the the size of
+ * <code>dimensions</code> is 0 or exceeds the maximum number of
+ * array dimensions in the VM; or if componentType is Void.TYPE
+ * @throws NegativeArraySizeException when any of the dimensions is less
+ * than 0
+ * @throws OutOfMemoryError if memory allocation fails
+ */
+ public static Object newInstance(Class<?> componentType, int[] dimensions)
+ {
+ if (dimensions.length <= 0)
+ throw new IllegalArgumentException ("Empty dimensions array.");
+ return createMultiArray(componentType, dimensions,
+ dimensions.length - 1);
+ }
+
+ /**
+ * Gets the array length.
+ * @param array the array
+ * @return the length of the array
+ * @throws IllegalArgumentException if <code>array</code> is not an array
+ * @throws NullPointerException if <code>array</code> is null
+ */
+ public static int getLength(Object array)
+ {
+ if (array instanceof Object[])
+ return ((Object[]) array).length;
+ if (array instanceof boolean[])
+ return ((boolean[]) array).length;
+ if (array instanceof byte[])
+ return ((byte[]) array). length;
+ if (array instanceof char[])
+ return ((char[]) array).length;
+ if (array instanceof short[])
+ return ((short[]) array).length;
+ if (array instanceof int[])
+ return ((int[]) array).length;
+ if (array instanceof long[])
+ return ((long[]) array).length;
+ if (array instanceof float[])
+ return ((float[]) array).length;
+ if (array instanceof double[])
+ return ((double[]) array).length;
+ if (array == null)
+ throw new NullPointerException();
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Gets an element of an array. Primitive elements will be wrapped in
+ * the corresponding class type.
+ *
+ * @param array the array to access
+ * @param index the array index to access
+ * @return the element at <code>array[index]</code>
+ * @throws IllegalArgumentException if <code>array</code> is not an array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #getBoolean(Object, int)
+ * @see #getByte(Object, int)
+ * @see #getChar(Object, int)
+ * @see #getShort(Object, int)
+ * @see #getInt(Object, int)
+ * @see #getLong(Object, int)
+ * @see #getFloat(Object, int)
+ * @see #getDouble(Object, int)
+ */
+ public static Object get(Object array, int index)
+ {
+ if (array instanceof Object[])
+ return ((Object[]) array)[index];
+ if (array instanceof boolean[])
+ return ((boolean[]) array)[index] ? Boolean.TRUE : Boolean.FALSE;
+ if (array instanceof byte[])
+ return new Byte(((byte[]) array)[index]);
+ if (array instanceof char[])
+ return new Character(((char[]) array)[index]);
+ if (array instanceof short[])
+ return new Short(((short[]) array)[index]);
+ if (array instanceof int[])
+ return new Integer(((int[]) array)[index]);
+ if (array instanceof long[])
+ return new Long(((long[]) array)[index]);
+ if (array instanceof float[])
+ return new Float(((float[]) array)[index]);
+ if (array instanceof double[])
+ return new Double(((double[]) array)[index]);
+ if (array == null)
+ throw new NullPointerException();
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Gets an element of a boolean array.
+ *
+ * @param array the array to access
+ * @param index the array index to access
+ * @return the boolean element at <code>array[index]</code>
+ * @throws IllegalArgumentException if <code>array</code> is not a boolean
+ * array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #get(Object, int)
+ */
+ public static boolean getBoolean(Object array, int index)
+ {
+ if (array instanceof boolean[])
+ return ((boolean[]) array)[index];
+ if (array == null)
+ throw new NullPointerException();
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Gets an element of a byte array.
+ *
+ * @param array the array to access
+ * @param index the array index to access
+ * @return the byte element at <code>array[index]</code>
+ * @throws IllegalArgumentException if <code>array</code> is not a byte
+ * array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #get(Object, int)
+ */
+ public static byte getByte(Object array, int index)
+ {
+ if (array instanceof byte[])
+ return ((byte[]) array)[index];
+ if (array == null)
+ throw new NullPointerException();
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Gets an element of a char array.
+ *
+ * @param array the array to access
+ * @param index the array index to access
+ * @return the char element at <code>array[index]</code>
+ * @throws IllegalArgumentException if <code>array</code> is not a char
+ * array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #get(Object, int)
+ */
+ public static char getChar(Object array, int index)
+ {
+ if (array instanceof char[])
+ return ((char[]) array)[index];
+ if (array == null)
+ throw new NullPointerException();
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Gets an element of a short array.
+ *
+ * @param array the array to access
+ * @param index the array index to access
+ * @return the short element at <code>array[index]</code>
+ * @throws IllegalArgumentException if <code>array</code> is not a byte
+ * or char array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #get(Object, int)
+ */
+ public static short getShort(Object array, int index)
+ {
+ if (array instanceof short[])
+ return ((short[]) array)[index];
+ return getByte(array, index);
+ }
+
+ /**
+ * Gets an element of an int array.
+ *
+ * @param array the array to access
+ * @param index the array index to access
+ * @return the int element at <code>array[index]</code>
+ * @throws IllegalArgumentException if <code>array</code> is not a byte,
+ * char, short, or int array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #get(Object, int)
+ */
+ public static int getInt(Object array, int index)
+ {
+ if (array instanceof int[])
+ return ((int[]) array)[index];
+ if (array instanceof char[])
+ return ((char[]) array)[index];
+ return getShort(array, index);
+ }
+
+ /**
+ * Gets an element of a long array.
+ *
+ * @param array the array to access
+ * @param index the array index to access
+ * @return the long element at <code>array[index]</code>
+ * @throws IllegalArgumentException if <code>array</code> is not a byte,
+ * char, short, int, or long array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #get(Object, int)
+ */
+ public static long getLong(Object array, int index)
+ {
+ if (array instanceof long[])
+ return ((long[]) array)[index];
+ return getInt(array, index);
+ }
+
+ /**
+ * Gets an element of a float array.
+ *
+ * @param array the array to access
+ * @param index the array index to access
+ * @return the float element at <code>array[index]</code>
+ * @throws IllegalArgumentException if <code>array</code> is not a byte,
+ * char, short, int, long, or float array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #get(Object, int)
+ */
+ public static float getFloat(Object array, int index)
+ {
+ if (array instanceof float[])
+ return ((float[]) array)[index];
+ return getLong(array, index);
+ }
+
+ /**
+ * Gets an element of a double array.
+ *
+ * @param array the array to access
+ * @param index the array index to access
+ * @return the double element at <code>array[index]</code>
+ * @throws IllegalArgumentException if <code>array</code> is not a byte,
+ * char, short, int, long, float, or double array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #get(Object, int)
+ */
+ public static double getDouble(Object array, int index)
+ {
+ if (array instanceof double[])
+ return ((double[]) array)[index];
+ return getFloat(array, index);
+ }
+
+ /**
+ * Sets an element of an array. If the array is primitive, then the new
+ * value is unwrapped and widened.
+ *
+ * @param array the array to set a value of
+ * @param index the array index to set the value to
+ * @param value the value to set
+ * @throws IllegalArgumentException if <code>array</code> is not an array,
+ * or the array is primitive and unwrapping value fails, or the
+ * value is not assignable to the array component type
+ * @throws NullPointerException if array is null, or if array is primitive
+ * and value is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #setBoolean(Object, int, boolean)
+ * @see #setByte(Object, int, byte)
+ * @see #setChar(Object, int, char)
+ * @see #setShort(Object, int, short)
+ * @see #setInt(Object, int, int)
+ * @see #setLong(Object, int, long)
+ * @see #setFloat(Object, int, float)
+ * @see #setDouble(Object, int, double)
+ */
+ public static void set(Object array, int index, Object value)
+ {
+ if (array instanceof Object[])
+ {
+ // Too bad the API won't let us throw the easier ArrayStoreException!
+ if (value != null
+ && ! array.getClass().getComponentType().isInstance(value))
+ throw new IllegalArgumentException();
+ ((Object[]) array)[index] = value;
+ }
+ else if (value instanceof Byte)
+ setByte(array, index, ((Byte) value).byteValue());
+ else if (value instanceof Short)
+ setShort(array, index, ((Short) value).shortValue());
+ else if (value instanceof Integer)
+ setInt(array, index, ((Integer) value).intValue());
+ else if (value instanceof Long)
+ setLong(array, index, ((Long) value).longValue());
+ else if (value instanceof Float)
+ setFloat(array, index, ((Float) value).floatValue());
+ else if (value instanceof Double)
+ setDouble(array, index, ((Double) value).doubleValue());
+ else if (value instanceof Character)
+ setChar(array, index, ((Character) value).charValue());
+ else if (value instanceof Boolean)
+ setBoolean(array, index, ((Boolean) value).booleanValue());
+ else if (array == null)
+ throw new NullPointerException();
+ else
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Sets an element of a boolean array.
+ *
+ * @param array the array to set a value of
+ * @param index the array index to set the value to
+ * @param value the value to set
+ * @throws IllegalArgumentException if <code>array</code> is not a boolean
+ * array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #set(Object, int, Object)
+ */
+ public static void setBoolean(Object array, int index, boolean value)
+ {
+ if (array instanceof boolean[])
+ ((boolean[]) array)[index] = value;
+ else if (array == null)
+ throw new NullPointerException();
+ else
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Sets an element of a byte array.
+ *
+ * @param array the array to set a value of
+ * @param index the array index to set the value to
+ * @param value the value to set
+ * @throws IllegalArgumentException if <code>array</code> is not a byte,
+ * short, int, long, float, or double array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #set(Object, int, Object)
+ */
+ public static void setByte(Object array, int index, byte value)
+ {
+ if (array instanceof byte[])
+ ((byte[]) array)[index] = value;
+ else
+ setShort(array, index, value);
+ }
+
+ /**
+ * Sets an element of a char array.
+ *
+ * @param array the array to set a value of
+ * @param index the array index to set the value to
+ * @param value the value to set
+ * @throws IllegalArgumentException if <code>array</code> is not a char,
+ * int, long, float, or double array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #set(Object, int, Object)
+ */
+ public static void setChar(Object array, int index, char value)
+ {
+ if (array instanceof char[])
+ ((char[]) array)[index] = value;
+ else
+ setInt(array, index, value);
+ }
+
+ /**
+ * Sets an element of a short array.
+ *
+ * @param array the array to set a value of
+ * @param index the array index to set the value to
+ * @param value the value to set
+ * @throws IllegalArgumentException if <code>array</code> is not a short,
+ * int, long, float, or double array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #set(Object, int, Object)
+ */
+ public static void setShort(Object array, int index, short value)
+ {
+ if (array instanceof short[])
+ ((short[]) array)[index] = value;
+ else
+ setInt(array, index, value);
+ }
+
+ /**
+ * Sets an element of an int array.
+ *
+ * @param array the array to set a value of
+ * @param index the array index to set the value to
+ * @param value the value to set
+ * @throws IllegalArgumentException if <code>array</code> is not an int,
+ * long, float, or double array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #set(Object, int, Object)
+ */
+ public static void setInt(Object array, int index, int value)
+ {
+ if (array instanceof int[])
+ ((int[]) array)[index] = value;
+ else
+ setLong(array, index, value);
+ }
+
+ /**
+ * Sets an element of a long array.
+ *
+ * @param array the array to set a value of
+ * @param index the array index to set the value to
+ * @param value the value to set
+ * @throws IllegalArgumentException if <code>array</code> is not a long,
+ * float, or double array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #set(Object, int, Object)
+ */
+ public static void setLong(Object array, int index, long value)
+ {
+ if (array instanceof long[])
+ ((long[]) array)[index] = value;
+ else
+ setFloat(array, index, value);
+ }
+
+ /**
+ * Sets an element of a float array.
+ *
+ * @param array the array to set a value of
+ * @param index the array index to set the value to
+ * @param value the value to set
+ * @throws IllegalArgumentException if <code>array</code> is not a float
+ * or double array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #set(Object, int, Object)
+ */
+ public static void setFloat(Object array, int index, float value)
+ {
+ if (array instanceof float[])
+ ((float[]) array)[index] = value;
+ else
+ setDouble(array, index, value);
+ }
+
+ /**
+ * Sets an element of a double array.
+ *
+ * @param array the array to set a value of
+ * @param index the array index to set the value to
+ * @param value the value to set
+ * @throws IllegalArgumentException if <code>array</code> is not a double
+ * array
+ * @throws NullPointerException if <code>array</code> is null
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds
+ * @see #set(Object, int, Object)
+ */
+ public static void setDouble(Object array, int index, double value)
+ {
+ if (array instanceof double[])
+ ((double[]) array)[index] = value;
+ else if (array == null)
+ throw new NullPointerException();
+ else
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Dynamically and recursively create a multi-dimensioned array of objects.
+ *
+ * @param type guaranteed to be a valid object type
+ * @param dimensions the dimensions of the array
+ * @param index index of the current dimension to build
+ * @return the new multi-dimensioned array
+ * @throws NegativeArraySizeException if any entry of dimensions is negative
+ * @throws OutOfMemoryError if memory allocation fails
+ */
+ // This would be faster if implemented natively, using the multianewarray
+ // bytecode instead of this recursive call
+ private static Object createMultiArray(Class type, int[] dimensions,
+ int index)
+ {
+ if (index == 0)
+ return newInstance(type, dimensions[0]);
+
+ Object toAdd = createMultiArray(type, dimensions, index - 1);
+ Class thisType = toAdd.getClass();
+ Object[] retval
+ = (Object[]) VMArray.createObjectArray(thisType, dimensions[index]);
+ if (dimensions[index] > 0)
+ retval[0] = toAdd;
+ int i = dimensions[index];
+ while (--i > 0)
+ retval[i] = createMultiArray(type, dimensions, index - 1);
+ return retval;
+ }
+
+}
Added: trunk/core/src/openjdk/java/java/lang/reflect/Array.java
===================================================================
--- trunk/core/src/openjdk/java/java/lang/reflect/Array.java (rev 0)
+++ trunk/core/src/openjdk/java/java/lang/reflect/Array.java 2008-12-08 14:51:34 UTC (rev 4783)
@@ -0,0 +1,485 @@
+/*
+ * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code 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 General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.lang.reflect;
+
+/**
+ * The {@code Array} class provides static methods to dynamically create and
+ * access Java arrays.
+ *
+ * <p>{@code Array} permits widening conversions to occur during a get or set
+ * operation, but throws an {@code IllegalArgumentException} if a narrowing
+ * conversion would occur.
+ *
+ * @author Nakul Saraiya
+ */
+public final
+class Array {
+
+ /**
+ * Constructor. Class Array is not instantiable.
+ */
+ private Array() {}
+
+ /**
+ * Creates a new array with the specified component type and
+ * length.
+ * Invoking this method is equivalent to creating an array
+ * as follows:
+ * <blockquote>
+ * <pre>
+ * int[] x = {length};
+ * Array.newInstance(componentType, x);
+ * </pre>
+ * </blockquote>
+ *
+ * @param componentType the {@code Class} object representing the
+ * component type of the new array
+ * @param length the length of the new array
+ * @return the new array
+ * @exception NullPointerException if the specified
+ * {@code componentType} parameter is null
+ * @exception IllegalArgumentException if componentType is {@link Void#TYPE}
+ * @exception NegativeArraySizeException if the specified {@code length}
+ * is negative
+ */
+ public static Object newInstance(Class<?> componentType, int length)
+ throws NegativeArraySizeException {
+ return newArray(componentType, length);
+ }
+
+ /**
+ * Creates a new array
+ * with the specified component type and dimensions.
+ * If {@code componentType}
+ * represents a non-array class or interface, the new array
+ * has {@code dimensions.length} dimensions and
+ * {@code componentType} as its component type. If
+ * {@code componentType} represents an array class, the
+ * number of dimensions of the new array is equal to the sum
+ * of {@code dimensions.length} and the number of
+ * dimensions of {@code componentType}. In this case, the
+ * component type of the new array is the component type of
+ * {@code componentType}.
+ *
+ * <p>The number of dimensions of the new array must not
+ * exceed the number of array dimensions supported by the
+ * implementation (typically 255).
+ *
+ * @param componentType the {@code Class} object representing the component
+ * type of the new array
+ * @param dimensions an array of {@code int} representing the dimensions of
+ * the new array
+ * @return the new array
+ * @exception NullPointerException if the specified
+ * {@code componentType} argument is null
+ * @exception IllegalArgumentException if the specified {@code dimensions}
+ * argument is a zero-dimensional array, or if the number of
+ * requested dimensions exceeds the limit on the number of array dimensions
+ * supported by the implementation (typically 255), or if componentType
+ * is {@link Void#TYPE}.
+ * @exception NegativeArraySizeException if any of the components in
+ * the specified {@code dimensions} argument is negative.
+ */
+ public static Object newInstance(Class<?> componentType, int... dimensions)
+ throws IllegalArgumentException, NegativeArraySizeException {
+ return multiNewArray(componentType, dimensions);
+ }
+
+ /**
+ * Returns the length of the specified array object, as an {@code int}.
+ *
+ * @param array the array
+ * @return the length of the array
+ * @exception IllegalArgumentException if the object argument is not
+ * an array
+ */
+ public static native int getLength(Object array)
+ throws IllegalArgumentException;
+
+ /**
+ * Returns the value of the indexed component in the specified
+ * array object. The value is automatically wrapped in an object
+ * if it has a primitive type.
+ *
+ * @param array the array
+...
[truncated message content] |
|
From: <ls...@us...> - 2008-12-13 21:11:18
|
Revision: 4786
http://jnode.svn.sourceforge.net/jnode/?rev=4786&view=rev
Author: lsantha
Date: 2008-12-13 21:11:12 +0000 (Sat, 13 Dec 2008)
Log Message:
-----------
Intgerated java.lang.reflect.Field from OpenJDK.
Modified Paths:
--------------
trunk/core/src/core/org/jnode/vm/classmgr/VmConstantPool.java
trunk/core/src/core/org/jnode/vm/classmgr/VmField.java
trunk/core/src/openjdk/vm/sun/misc/NativeUnsafe.java
trunk/core/src/openjdk/vm/sun/misc/UnsafeHelper.java
trunk/core/src/openjdk/vm/sun/reflect/NativeReflection.java
Added Paths:
-----------
trunk/core/src/openjdk/java/java/lang/reflect/Field.java
trunk/core/src/openjdk/vm/sun/misc/NativeGC.java
trunk/core/src/openjdk/vm/sun/misc/NativeNativeSignalHandler.java
trunk/core/src/openjdk/vm/sun/misc/NativePerf.java
trunk/core/src/openjdk/vm/sun/misc/NativeSignal.java
trunk/core/src/openjdk/vm/sun/misc/NativeVMSupport.java
trunk/core/src/openjdk/vm/sun/misc/NativeVersion.java
trunk/core/src/openjdk/vm/sun/reflect/NativeNativeConstructorAccessorImpl.java
trunk/core/src/openjdk/vm/sun/reflect/NativeNativeMethodAccessorImpl.java
Removed Paths:
-------------
trunk/core/src/classpath/vm/java/lang/reflect/Field.java
Deleted: trunk/core/src/classpath/vm/java/lang/reflect/Field.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/reflect/Field.java 2008-12-13 04:47:08 UTC (rev 4785)
+++ trunk/core/src/classpath/vm/java/lang/reflect/Field.java 2008-12-13 21:11:12 UTC (rev 4786)
@@ -1,783 +0,0 @@
-/* java.lang.reflect.Field - reflection of Java fields
- Copyright (C) 1998, 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath 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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang.reflect;
-
-import gnu.java.lang.ClassHelper;
-import gnu.java.lang.reflect.FieldSignatureParser;
-
-import org.jnode.vm.VmReflection;
-import org.jnode.vm.classmgr.VmField;
-import java.lang.annotation.Annotation;
-
-/**
- * The Field class represents a member variable of a class. It also allows
- * dynamic access to a member, via reflection. This works for both
- * static and instance fields. Operations on Field objects know how to
- * do widening conversions, but throw {@link IllegalArgumentException} if
- * a narrowing conversion would be necessary. You can query for information
- * on this Field regardless of location, but get and set access may be limited
- * by Java language access controls. If you can't do it in the compiler, you
- * can't normally do it here either.<p>
- *
- * <B>Note:</B> This class returns and accepts types as Classes, even
- * primitive types; there are Class types defined that represent each
- * different primitive type. They are <code>java.lang.Boolean.TYPE,
- * java.lang.Byte.TYPE,</code>, also available as <code>boolean.class,
- * byte.class</code>, etc. These are not to be confused with the
- * classes <code>java.lang.Boolean, java.lang.Byte</code>, etc., which are
- * real classes.<p>
- *
- * Also note that this is not a serializable class. It is entirely feasible
- * to make it serializable using the Externalizable interface, but this is
- * on Sun, not me.
- *
- * @author John Keiser
- * @author Eric Blake <eb...@em...>
- * @see Member
- * @see Class
- * @see Class#getField(String)
- * @see Class#getDeclaredField(String)
- * @see Class#getFields()
- * @see Class#getDeclaredFields()
- * @since 1.1
- * @status updated to 1.4
- */
-public final class Field
-extends AccessibleObject implements Member
-{
- private final VmField vmField;
-
- private static final int FIELD_MODIFIERS
- = Modifier.FINAL | Modifier.PRIVATE | Modifier.PROTECTED
- | Modifier.PUBLIC | Modifier.STATIC | Modifier.TRANSIENT
- | Modifier.VOLATILE;
-
- /**
- * This class is uninstantiable except natively.
- */
- public Field(VmField vmField) {
- this.vmField = vmField;
- }
-
- public Field(Class declaringClass, String name, Class type, int modifiers, int slot, String signature, byte[] annotations) {
- //todo implement it
- throw new UnsupportedOperationException();
- }
-
- /**
- * Gets the class that declared this field, or the class where this field
- * is a non-inherited member.
- * @return the class that declared this member
- */
- public Class<?> getDeclaringClass()
- {
- return vmField.getDeclaringClass().asClass();
- }
-
- /**
- * Gets the name of this field.
- *
- * @return the name of this field
- */
- public String getName() {
- return vmField.getName();
- }
-
- /**
- * Return the raw modifiers for this field.
- * @return the field's modifiers
- */
- public int getModifiersInternal() {
- return vmField.getModifiers();
- }
-
- /**
- * Gets the modifiers this field uses. Use the <code>Modifier</code>
- * class to interpret the values. A field can only have a subset of the
- * following modifiers: public, private, protected, static, final,
- * transient, and volatile.
- *
- * @return an integer representing the modifiers to this Member
- * @see Modifier
- */
- public int getModifiers()
- {
- return getModifiersInternal() & FIELD_MODIFIERS;
- }
-
- /**
- * Return true if this field is synthetic, false otherwise.
- * @since 1.5
- */
- public boolean isSynthetic()
- {
- return (getModifiersInternal() & Modifier.SYNTHETIC) != 0;
- }
-
- /**
- * Return true if this field represents an enum constant,
- * false otherwise.
- * @since 1.5
- */
- public boolean isEnumConstant()
- {
- return (getModifiersInternal() & Modifier.ENUM) != 0;
- }
-
- /**
- * Gets the type of this field.
- *
- * @return the type of this field
- */
- public Class getType() {
- return vmField.getType().asClass();
- }
-
- /**
- * Compare two objects to see if they are semantically equivalent.
- * Two Fields are semantically equivalent if they have the same declaring
- * class, name, and type. Since you can't creat a Field except through
- * the VM, this is just the == relation.
- *
- * @param o the object to compare to
- * @return <code>true</code> if they are equal; <code>false</code> if not
- */
- public boolean equals(Object o)
- {
- if (!(o instanceof Field))
- return false;
- Field that = (Field)o;
- if (this.getDeclaringClass() != that.getDeclaringClass())
- return false;
- if (!this.getName().equals(that.getName()))
- return false;
- if (this.getType() != that.getType())
- return false;
- return true;
- }
-
- /**
- * Get the hash code for the Field. The Field hash code is the hash code
- * of its name XOR'd with the hash code of its class name.
- *
- * @return the hash code for the object.
- */
- public int hashCode()
- {
- return getDeclaringClass().getName().hashCode() ^ getName().hashCode();
- }
-
- /**
- * Get a String representation of the Field. A Field's String
- * representation is "<modifiers> <type>
- * <class>.<fieldname>".<br> Example:
- * <code>public transient boolean gnu.parse.Parser.parseComplete</code>
- *
- * @return the String representation of the Field
- */
- public String toString() {
- // 64 is a reasonable buffer initial size for field
- StringBuilder sb = new StringBuilder(64);
- sb.append(Modifier.toString(getModifiers())).append(' ');
- sb.append(ClassHelper.getUserName(getType())).append(' ');
- sb.append(getDeclaringClass().getName()).append('.');
- sb.append(getName());
- return sb.toString();
- }
-
- public String toGenericString()
- {
- StringBuilder sb = new StringBuilder(64);
- sb.append(Modifier.toString(getModifiers())).append(' ');
- sb.append(getGenericType()).append(' ');
- sb.append(getDeclaringClass().getName()).append('.');
- sb.append(getName());
- return sb.toString();
- }
-
- /**
- * Get the value of this Field. If it is primitive, it will be wrapped
- * in the appropriate wrapper type (boolean = java.lang.Boolean).<p>
- *
- * If the field is static, <code>o</code> will be ignored. Otherwise, if
- * <code>o</code> is null, you get a <code>NullPointerException</code>,
- * and if it is incompatible with the declaring class of the field, you
- * get an <code>IllegalArgumentException</code>.<p>
- *
- * Next, if this Field enforces access control, your runtime context is
- * evaluated, and you may have an <code>IllegalAccessException</code> if
- * you could not access this field in similar compiled code. If the field
- * is static, and its class is uninitialized, you trigger class
- * initialization, which may end in a
- * <code>ExceptionInInitializerError</code>.<p>
- *
- * Finally, the field is accessed, and primitives are wrapped (but not
- * necessarily in new objects). This method accesses the field of the
- * declaring class, even if the instance passed in belongs to a subclass
- * which declares another field to hide this one.
- *
- * @param o the object to get the value of this Field from
- * @return the value of the Field
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if <code>o</code> is not an instance of
- * the class or interface declaring this field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #getBoolean(Object)
- * @see #getByte(Object)
- * @see #getChar(Object)
- * @see #getShort(Object)
- * @see #getInt(Object)
- * @see #getLong(Object)
- * @see #getFloat(Object)
- * @see #getDouble(Object)
- */
- public Object get(Object o) throws IllegalAccessException {
- if (vmField.isPrimitive()) {
- switch (vmField.getSignature().charAt(0)) {
- case 'Z':
- return Boolean.valueOf(VmReflection.getBoolean(vmField, o));
- case 'B':
- return new Byte(VmReflection.getByte(vmField, o));
- case 'C':
- return new Character(VmReflection.getChar(vmField, o));
- case 'S':
- return new Short(VmReflection.getShort(vmField, o));
- case 'I':
- return new Integer(VmReflection.getInt(vmField, o));
- case 'J':
- return new Long(VmReflection.getLong(vmField, o));
- case 'F':
- return new Float(VmReflection.getFloat(vmField, o));
- case 'D':
- return new Double(VmReflection.getDouble(vmField, o));
- default:
- throw new IllegalArgumentException("Unknown primitive type");
- }
- } else {
- return VmReflection.getObject(vmField, o);
- }
- }
-
- /**
- * Get the value of this boolean Field. If the field is static,
- * <code>o</code> will be ignored.
- *
- * @param o the object to get the value of this Field from
- * @return the value of the Field
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a boolean field of
- * <code>o</code>, or if <code>o</code> is not an instance of the
- * declaring class of this field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #get(Object)
- */
- public boolean getBoolean(Object o) throws IllegalAccessException {
- return VmReflection.getBoolean(vmField, o);
- }
-
- /**
- * Get the value of this byte Field. If the field is static,
- * <code>o</code> will be ignored.
- *
- * @param o the object to get the value of this Field from
- * @return the value of the Field
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a byte field of
- * <code>o</code>, or if <code>o</code> is not an instance of the
- * declaring class of this field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #get(Object)
- */
- public byte getByte(Object o) throws IllegalAccessException {
- return VmReflection.getByte(vmField, o);
- }
-
- /**
- * Get the value of this Field as a char. If the field is static,
- * <code>o</code> will be ignored.
- *
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a char field of
- * <code>o</code>, or if <code>o</code> is not an instance
- * of the declaring class of this field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #get(Object)
- */
- public char getChar(Object o) throws IllegalAccessException {
- return VmReflection.getChar(vmField, o);
- }
-
- /**
- * Get the value of this Field as a short. If the field is static,
- * <code>o</code> will be ignored.
- *
- * @param o the object to get the value of this Field from
- * @return the value of the Field
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a byte or short
- * field of <code>o</code>, or if <code>o</code> is not an instance
- * of the declaring class of this field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #get(Object)
- */
- public short getShort(Object o) throws IllegalAccessException {
- return VmReflection.getShort(vmField, o);
- }
-
- /**
- * Get the value of this Field as an int. If the field is static,
- * <code>o</code> will be ignored.
- *
- * @param o the object to get the value of this Field from
- * @return the value of the Field
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a byte, short, char, or
- * int field of <code>o</code>, or if <code>o</code> is not an
- * instance of the declaring class of this field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #get(Object)
- */
- public int getInt(Object o) throws IllegalAccessException {
- return VmReflection.getInt(vmField, o);
- }
-
- /**
- * Get the value of this Field as a long. If the field is static,
- * <code>o</code> will be ignored.
- *
- * @param o the object to get the value of this Field from
- * @return the value of the Field
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a byte, short, char, int,
- * or long field of <code>o</code>, or if <code>o</code> is not an
- * instance of the declaring class of this field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #get(Object)
- */
- public long getLong(Object o) throws IllegalAccessException {
- return VmReflection.getLong(vmField, o);
- }
-
- /**
- * Get the value of this Field as a float. If the field is static,
- * <code>o</code> will be ignored.
- *
- * @param o the object to get the value of this Field from
- * @return the value of the Field
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a byte, short, char, int,
- * long, or float field of <code>o</code>, or if <code>o</code> is
- * not an instance of the declaring class of this field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #get(Object)
- */
- public float getFloat(Object o) throws IllegalAccessException {
- return VmReflection.getFloat(vmField, o);
- }
-
- /**
- * Get the value of this Field as a double. If the field is static,
- * <code>o</code> will be ignored.
- *
- * @param o the object to get the value of this Field from
- * @return the value of the Field
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a byte, short, char, int,
- * long, float, or double field of <code>o</code>, or if
- * <code>o</code> is not an instance of the declaring class of this
- * field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #get(Object)
- */
- public double getDouble(Object o) throws IllegalAccessException {
- return VmReflection.getDouble(vmField, o);
- }
-
- /**
- * Set the value of this Field. If it is a primitive field, the value
- * will be unwrapped from the passed object (boolean = java.lang.Boolean).<p>
- *
- * If the field is static, <code>o</code> will be ignored. Otherwise, if
- * <code>o</code> is null, you get a <code>NullPointerException</code>,
- * and if it is incompatible with the declaring class of the field, you
- * get an <code>IllegalArgumentException</code>.<p>
- *
- * Next, if this Field enforces access control, your runtime context is
- * evaluated, and you may have an <code>IllegalAccessException</code> if
- * you could not access this field in similar compiled code. This also
- * occurs whether or not there is access control if the field is final.
- * If the field is primitive, and unwrapping your argument fails, you will
- * get an <code>IllegalArgumentException</code>; likewise, this error
- * happens if <code>value</code> cannot be cast to the correct object type.
- * If the field is static, and its class is uninitialized, you trigger class
- * initialization, which may end in a
- * <code>ExceptionInInitializerError</code>.<p>
- *
- * Finally, the field is set with the widened value. This method accesses
- * the field of the declaring class, even if the instance passed in belongs
- * to a subclass which declares another field to hide this one.
- *
- * @param o the object to set this Field on
- * @param value the value to set this Field to
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if <code>value</code> cannot be
- * converted by a widening conversion to the underlying type of
- * the Field, or if <code>o</code> is not an instance of the class
- * declaring this field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #setBoolean(Object, boolean)
- * @see #setByte(Object, byte)
- * @see #setChar(Object, char)
- * @see #setShort(Object, short)
- * @see #setInt(Object, int)
- * @see #setLong(Object, long)
- * @see #setFloat(Object, float)
- * @see #setDouble(Object, double)
- */
- public void set(Object o, Object value) throws IllegalAccessException {
- if (vmField.isPrimitive()) {
- switch (vmField.getSignature().charAt(0)) {
- case 'Z':
- VmReflection.setBoolean(vmField, o, ((Boolean) value).booleanValue());
- break;
- case 'B':
- VmReflection.setByte(vmField, o, ((Byte) value).byteValue());
- break;
- case 'C':
- VmReflection.setChar(vmField, o, ((Character) value).charValue());
- break;
- case 'S':
- VmReflection.setShort(vmField, o, ((Short) value).shortValue());
- break;
- case 'I':
- VmReflection.setInt(vmField, o, ((Integer) value).intValue());
- break;
- case 'J':
- VmReflection.setLong(vmField, o, ((Long) value).longValue());
- break;
- case 'F':
- VmReflection.setFloat(vmField, o, ((Float) value).floatValue());
- break;
- case 'D':
- VmReflection.setDouble(vmField, o, ((Double) value).doubleValue());
- break;
- default:
- throw new IllegalArgumentException("Unknown primitive type");
- }
- } else {
- VmReflection.setObject(vmField, o, value);
- }
- }
-
- /**
- * Set this boolean Field. If the field is static, <code>o</code> will be
- * ignored.
- *
- * @param o the object to set this Field on
- * @param value the value to set this Field to
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a boolean field, or if
- * <code>o</code> is not an instance of the class declaring this
- * field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #set(Object, Object)
- */
- public void setBoolean(Object o, boolean value)
- throws IllegalAccessException {
- VmReflection.setBoolean(vmField, o, value);
- }
-
- /**
- * Set this byte Field. If the field is static, <code>o</code> will be
- * ignored.
- *
- * @param o the object to set this Field on
- * @param value the value to set this Field to
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a byte, short, int, long,
- * float, or double field, or if <code>o</code> is not an instance
- * of the class declaring this field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #set(Object, Object)
- */
- public void setByte(Object o, byte value) throws IllegalAccessException {
- VmReflection.setByte(vmField, o, value);
- }
-
- /**
- * Set this char Field. If the field is static, <code>o</code> will be
- * ignored.
- *
- * @param o the object to set this Field on
- * @param value the value to set this Field to
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a char, int, long,
- * float, or double field, or if <code>o</code> is not an instance
- * of the class declaring this field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #set(Object, Object)
- */
- public void setChar(Object o, char value) throws IllegalAccessException {
- VmReflection.setChar(vmField, o, value);
- }
-
- /**
- * Set this short Field. If the field is static, <code>o</code> will be
- * ignored.
- *
- * @param o the object to set this Field on
- * @param value the value to set this Field to
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a short, int, long,
- * float, or double field, or if <code>o</code> is not an instance
- * of the class declaring this field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #set(Object, Object)
- */
- public void setShort(Object o, short value) throws IllegalAccessException {
- VmReflection.setShort(vmField, o, value);
- }
-
- /**
- * Set this int Field. If the field is static, <code>o</code> will be
- * ignored.
- *
- * @param o the object to set this Field on
- * @param value the value to set this Field to
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not an int, long, float, or
- * double field, or if <code>o</code> is not an instance of the
- * class declaring this field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #set(Object, Object)
- */
- public void setInt(Object o, int value) throws IllegalAccessException {
- VmReflection.setInt(vmField, o, value);
- }
-
- /**
- * Set this long Field. If the field is static, <code>o</code> will be
- * ignored.
- *
- * @param o the object to set this Field on
- * @param value the value to set this Field to
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a long, float, or double
- * field, or if <code>o</code> is not an instance of the class
- * declaring this field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #set(Object, Object)
- */
- public void setLong(Object o, long value) throws IllegalAccessException {
- VmReflection.setLong(vmField, o, value);
- }
-
- /**
- * Set this float Field. If the field is static, <code>o</code> will be
- * ignored.
- *
- * @param o the object to set this Field on
- * @param value the value to set this Field to
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a float or long field, or
- * if <code>o</code> is not an instance of the class declaring this
- * field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
- * @throws ExceptionInInitializerError if accessing a static field triggered
- * class initialization, which then failed
- * @see #set(Object, Object)
- */
- public void setFloat(Object o, float value) throws IllegalAccessException {
- VmReflection.setFloat(vmField, o, value);
- }
-
- /**
- * Set this double Field. If the field is static, <code>o</code> will be
- * ignored.
- *
- * @param o the object to set this Field on
- * @param value the value to set this Field to
- * @throws IllegalAccessException if you could not normally access this field
- * (i.e. it is not public)
- * @throws IllegalArgumentException if this is not a double field, or if
- * <code>o</code> is not an instance of the class declaring this
- * field
- * @throws NullPointerException if <code>o</code> is null and this field
- * requires an instance
-...
[truncated message content] |
|
From: <ls...@us...> - 2008-12-14 22:22:13
|
Revision: 4788
http://jnode.svn.sourceforge.net/jnode/?rev=4788&view=rev
Author: lsantha
Date: 2008-12-14 21:49:21 +0000 (Sun, 14 Dec 2008)
Log Message:
-----------
Intgerated java.lang.reflect.Constructor from OpenJDK.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/lang/Thread.java
trunk/core/src/classpath/vm/java/lang/reflect/Method.java
trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java
trunk/core/src/openjdk/java/java/lang/ThreadGroup.java
trunk/core/src/openjdk/vm/sun/reflect/NativeNativeConstructorAccessorImpl.java
Added Paths:
-----------
trunk/core/src/openjdk/java/java/lang/reflect/Constructor.java
Removed Paths:
-------------
trunk/core/src/classpath/vm/java/lang/reflect/Constructor.java
Modified: trunk/core/src/classpath/vm/java/lang/Thread.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/Thread.java 2008-12-13 21:11:59 UTC (rev 4787)
+++ trunk/core/src/classpath/vm/java/lang/Thread.java 2008-12-14 21:49:21 UTC (rev 4788)
@@ -41,6 +41,7 @@
import java.util.Map;
import java.util.WeakHashMap;
import java.util.HashMap;
+import java.lang.reflect.Constructor;
import org.jnode.security.JNodePermission;
@@ -1365,7 +1366,13 @@
static {
ThreadGroup g = null;
try {
- g = ThreadGroup.class.getDeclaredConstructor().newInstance();
+ /*
+ Constructor<ThreadGroup> constr = ThreadGroup.class.getDeclaredConstructor();
+ constr.setAccessible(true);
+ g = constr.newInstance();
+ constr.setAccessible(false);
+ */
+ g = new ThreadGroup();
}catch (Exception e){
e.printStackTrace();
org.jnode.vm.Unsafe.die("Root ThreadGroup creation failure.");
Deleted: trunk/core/src/classpath/vm/java/lang/reflect/Constructor.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/reflect/Constructor.java 2008-12-13 21:11:59 UTC (rev 4787)
+++ trunk/core/src/classpath/vm/java/lang/reflect/Constructor.java 2008-12-14 21:49:21 UTC (rev 4788)
@@ -1,566 +0,0 @@
-/* java.lang.reflect.Constructor - reflection of Java constructors
- Copyright (C) 1998, 2001, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath 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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang.reflect;
-
-import gnu.java.lang.ClassHelper;
-import java.lang.annotation.Annotation;
-import java.lang.annotation.AnnotationFormatError;
-import java.util.ArrayList;
-
-import org.jnode.vm.VmReflection;
-import org.jnode.vm.classmgr.VmExceptions;
-import org.jnode.vm.classmgr.VmMethod;
-import org.jnode.vm.classmgr.Signature;
-import gnu.java.lang.reflect.MethodSignatureParser;
-
-import java.util.Arrays;
-import sun.reflect.annotation.AnnotationParser;
-import sun.reflect.ConstructorAccessor;
-
-/**
- * The Constructor class represents a constructor of a class. It also allows
- * dynamic creation of an object, via reflection. Invocation on Constructor
- * objects knows how to do widening conversions, but throws
- * {@link IllegalArgumentException} if a narrowing conversion would be
- * necessary. You can query for information on this Constructor regardless
- * of location, but construction access may be limited by Java language
- * access controls. If you can't do it in the compiler, you can't normally
- * do it here either.<p>
- *
- * <B>Note:</B> This class returns and accepts types as Classes, even
- * primitive types; there are Class types defined that represent each
- * different primitive type. They are <code>java.lang.Boolean.TYPE,
- * java.lang.Byte.TYPE,</code>, also available as <code>boolean.class,
- * byte.class</code>, etc. These are not to be confused with the
- * classes <code>java.lang.Boolean, java.lang.Byte</code>, etc., which are
- * real classes.<p>
- *
- * Also note that this is not a serializable class. It is entirely feasible
- * to make it serializable using the Externalizable interface, but this is
- * on Sun, not me.
- *
- * @author John Keiser
- * @author Eric Blake <eb...@em...>
- * @see Member
- * @see Class
- * @see java.lang.Class#getConstructor(Class[])
- * @see java.lang.Class#getDeclaredConstructor(Class[])
- * @see java.lang.Class#getConstructors()
- * @see java.lang.Class#getDeclaredConstructors()
- * @since 1.1
- * @status updated to 1.4
- */
-public final class Constructor<T>
- extends AccessibleObject
- implements GenericDeclaration, Member
-{
- private Class<T> clazz;
- private int slot;
-
- private final VmMethod vmMethod;
- private ArrayList<Class> parameterTypes;
- private ArrayList<Class> exceptionTypes;
-
- private static final int CONSTRUCTOR_MODIFIERS
- = Modifier.PRIVATE | Modifier.PROTECTED | Modifier.PUBLIC;
-
- /**
- * This class is uninstantiable except from native code.
- */
- public Constructor(VmMethod vmMethod) {
- this.vmMethod = vmMethod;
- }
-
- /**
- * Gets the class that declared this constructor.
- * @return the class that declared this member
- */
- public Class<T> getDeclaringClass()
- {
- return (Class<T>) vmMethod.getDeclaringClass().asClass();
- }
-
- /**
- * Gets the name of this constructor (the non-qualified name of the class
- * it was declared in).
- * @return the name of this constructor
- */
- public String getName()
- {
- return getDeclaringClass().getName();
- }
-
- /**
- * Return the raw modifiers for this constructor. In particular
- * this will include the synthetic and varargs bits.
- * @return the constructor's modifiers
- */
- private int getModifiersInternal()
- {
- return vmMethod.getModifiers();
- }
-
- /**
- * Gets the modifiers this constructor uses. Use the <code>Modifier</code>
- * class to interpret the values. A constructor can only have a subset of the
- * following modifiers: public, private, protected.
- *
- * @return an integer representing the modifiers to this Member
- * @see Modifier
- */
- public int getModifiers()
- {
- return getModifiersInternal() & CONSTRUCTOR_MODIFIERS;
- }
-
- /**
- * Return true if this constructor is synthetic, false otherwise.
- * A synthetic member is one which is created by the compiler,
- * and which does not appear in the user's source code.
- * @since 1.5
- */
- public boolean isSynthetic()
- {
- return (getModifiersInternal() & Modifier.SYNTHETIC) != 0;
- }
-
- /**
- * Return true if this is a varargs constructor, that is if
- * the constructor takes a variable number of arguments.
- * @since 1.5
- */
- public boolean isVarArgs()
- {
- return (getModifiersInternal() & Modifier.VARARGS) != 0;
- }
-
- /**
- * Get the parameter list for this constructor, in declaration order. If the
- * constructor takes no parameters, returns a 0-length array (not null).
- *
- * @return a list of the types of the constructor's parameters
- */
- public Class<?>[] getParameterTypes()
- {
- if (parameterTypes == null) {
- int cnt = vmMethod.getNoArguments();
- ArrayList<Class> list = new ArrayList<Class>(cnt);
- for (int i = 0; i < cnt; i++) {
- list.add(vmMethod.getArgumentType(i).asClass());
- }
- parameterTypes = list;
- }
- return (Class[])parameterTypes.toArray(new Class[parameterTypes.size()]);
- }
-
- /**
- * Get the exception types this constructor says it throws, in no particular
- * order. If the constructor has no throws clause, returns a 0-length array
- * (not null).
- *
- * @return a list of the types in the constructor's throws clause
- */
- public Class<?>[] getExceptionTypes() {
- if (exceptionTypes == null) {
- final VmExceptions exceptions = vmMethod.getExceptions();
- final int cnt = exceptions.getLength();
- final ArrayList<Class> list = new ArrayList<Class>(cnt);
- for (int i = 0; i < cnt; i++) {
- list.add(exceptions.getException(i).getResolvedVmClass().asClass());
- }
- exceptionTypes = list;
- }
- return (Class[])exceptionTypes.toArray(new Class[exceptionTypes.size()]);
- }
-
- /**
- * Compare two objects to see if they are semantically equivalent.
- * Two Constructors are semantically equivalent if they have the same
- * declaring class and the same parameter list. This ignores different
- * exception clauses, but since you can't create a Method except through the
- * VM, this is just the == relation.
- *
- * @param o the object to compare to
- * @return <code>true</code> if they are equal; <code>false</code> if not.
- */
- public boolean equals(Object o)
- {
- if (!(o instanceof Constructor))
- return false;
- Constructor that = (Constructor)o;
- if (this.getDeclaringClass() != that.getDeclaringClass())
- return false;
- if (!Arrays.equals(this.getParameterTypes(), that.getParameterTypes()))
- return false;
- return true;
- }
-
- /**
- * Get the hash code for the Constructor. The Constructor hash code is the
- * hash code of the declaring class's name.
- *
- * @return the hash code for the object
- */
- public int hashCode()
- {
- return getDeclaringClass().getName().hashCode();
- }
-
- /**
- * Get a String representation of the Constructor. A Constructor's String
- * representation is "<modifier> <classname>(<paramtypes>)
- * throws <exceptions>", where everything after ')' is omitted if
- * there are no exceptions.<br> Example:
- * <code>public java.io.FileInputStream(java.lang.Runnable)
- * throws java.io.FileNotFoundException</code>
- *
- * @return the String representation of the Constructor
- */
- public String toString() {
- // 128 is a reasonable buffer initial size for constructor
- StringBuilder sb = new StringBuilder(128);
- sb.append(Modifier.toString(getModifiers())).append(' ');
- sb.append(getDeclaringClass().getName()).append('(');
- Class[] c = getParameterTypes();
- if (c.length > 0)
- {
- sb.append(ClassHelper.getUserName(c[0]));
- for (int i = 1; i < c.length; i++)
- sb.append(',').append(ClassHelper.getUserName(c[i]));
- }
- sb.append(')');
- c = getExceptionTypes();
- if (c.length > 0) {
- sb.append(" throws ").append(c[0].getName());
- for (int i = 1; i < c.length; i++)
- sb.append(',').append(c[i].getName());
- }
- return sb.toString();
- }
-
- static <X extends GenericDeclaration>
- void addTypeParameters(StringBuilder sb, TypeVariable<X>[] typeArgs)
- {
- if (typeArgs.length == 0)
- return;
- sb.append('<');
- for (int i = 0; i < typeArgs.length; ++i)
- {
- if (i > 0)
- sb.append(',');
- sb.append(typeArgs[i]);
- }
- sb.append("> ");
- }
-
- public String toGenericString()
- {
- StringBuilder sb = new StringBuilder(128);
- sb.append(Modifier.toString(getModifiers())).append(' ');
- addTypeParameters(sb, getTypeParameters());
- sb.append(getDeclaringClass().getName()).append('(');
- Type[] types = getGenericParameterTypes();
- if (types.length > 0)
- {
- sb.append(types[0]);
- for (int i = 1; i < types.length; ++i)
- sb.append(',').append(types[i]);
- }
- sb.append(')');
- types = getGenericExceptionTypes();
- if (types.length > 0)
- {
- sb.append(" throws ").append(types[0]);
- for (int i = 1; i < types.length; i++)
- sb.append(',').append(types[i]);
- }
- return sb.toString();
- }
-
- /**
- * Create a new instance by invoking the constructor. Arguments are
- * automatically unwrapped and widened, if needed.<p>
- *
- * If this class is abstract, you will get an
- * <code>InstantiationException</code>. If the constructor takes 0
- * arguments, you may use null or a 0-length array for <code>args</code>.<p>
- *
- * If this Constructor enforces access control, your runtime context is
- * evaluated, and you may have an <code>IllegalAccessException</code> if
- * you could not create this object in similar compiled code. If the class
- * is uninitialized, you trigger class initialization, which may end in a
- * <code>ExceptionInInitializerError</code>.<p>
- *
- * Then, the constructor is invoked. If it completes normally, the return
- * value will be the new object. If it completes abruptly, the exception is
- * wrapped in an <code>InvocationTargetException</code>.
- *
- * @param args the arguments to the constructor
- * @return the newly created object
- * @throws IllegalAccessException if the constructor could not normally be
- * called by the Java code (i.e. it is not public)
- * @throws IllegalArgumentException if the number of arguments is incorrect;
- * or if the arguments types are wrong even with a widening
- * conversion
- * @throws InstantiationException if the class is abstract
- * @throws InvocationTargetException if the constructor throws an exception
- * @throws ExceptionInInitializerError if construction triggered class
- * initialization, which then failed
- */
- public T newInstance(Object... args) throws InstantiationException, IllegalAccessException, InvocationTargetException {
- if(constructorAccessor == null)
- return (T) VmReflection.newInstance(vmMethod, args);
- else
- return (T) constructorAccessor.newInstance(args);
- }
-
-
- /**
- * Returns an array of <code>TypeVariable</code> objects that represents
- * the type variables declared by this constructor, in declaration order.
- * An array of size zero is returned if this constructor has no type
- * variables.
- *
- * @return the type variables associated with this constructor.
- * @throws GenericSignatureFormatError if the generic signature does
- * not conform to the format specified in the Virtual Machine
- * specification, version 3.
- * @since 1.5
- */
- public TypeVariable<Constructor<T>>[] getTypeParameters()
- {
- String sig = getSignature();
- if (sig == null)
- return new TypeVariable[0];
- MethodSignatureParser p = new MethodSignatureParser(this, sig);
- return p.getTypeParameters();
- }
-
- /**
- * Return the String in the Signature attribute for this constructor. If there
- * is no Signature attribute, return null.
- */
- String getSignature()
- {
- return vmMethod.getSignature();
- }
-
- /**
- * Returns an array of <code>Type</code> objects that represents
- * the exception types declared by this constructor, in declaration order.
- * An array of size zero is returned if this constructor declares no
- * exceptions.
- *
- * @return the exception types declared by this constructor.
- * @throws GenericSignatureFormatError if the generic signature does
- * not conform to the format specified in the Virtual Machine
- * specification, version 3.
- * @since 1.5
- */
- public Type[] getGenericExceptionTypes()
- {
- String sig = getSignature();
- if (sig == null)
- return getExceptionTypes();
- MethodSignatureParser p = new MethodSignatureParser(this, sig);
- return p.getGenericExceptionTypes();
- }
-
- /**
- * Returns an array of <code>Type</code> objects that represents
- * the parameter list for this constructor, in declaration order.
- * An array of size zero is returned if this constructor takes no
- * parameters.
- *
- * @return a list of the types of the constructor's parameters
- * @throws GenericSignatureFormatError if the generic signature does
- * not conform to the format specified in the Virtual Machine
- * specification, version 3.
- * @since 1.5
- */
- public Type[] getGenericParameterTypes()
- {
- String sig = getSignature();
- if (sig == null)
- return getParameterTypes();
- MethodSignatureParser p = new MethodSignatureParser(this, sig);
- return p.getGenericParameterTypes();
- }
-
-
- /**
- * @see java.lang.reflect.AnnotatedElement#getAnnotation(java.lang.Class)
- */
- public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
- return vmMethod.getAnnotation(annotationClass);
- }
-
- /**
- * @see java.lang.reflect.AnnotatedElement#getAnnotations()
- */
- public Annotation[] getAnnotations() {
- return vmMethod.getAnnotations();
- }
-
- /**
- * @see java.lang.reflect.AnnotatedElement#getDeclaredAnnotations()
- */
- public Annotation[] getDeclaredAnnotations() {
- return vmMethod.getDeclaredAnnotations();
- }
-
-
- /**
- * @see java.lang.reflect.AnnotatedElement#isAnnotationPresent(java.lang.Class)
- */
- public boolean isAnnotationPresent(Class< ? extends Annotation> annotationClass) {
- return vmMethod.isAnnotationPresent(annotationClass);
- }
-
- //jnode openjdk
-
- private byte[] parameterAnnotations;
- /**
- * Returns an array of arrays that represent the annotations on the formal
- * parameters, in declaration order, of the method represented by
- * this <tt>Constructor</tt> object. (Returns an array of length zero if the
- * underlying method is parameterless. If the method has one or more
- * parameters, a nested array of length zero is returned for each parameter
- * with no annotations.) The annotation objects contained in the returned
- * arrays are serializable. The caller of this method is free to modify
- * the returned arrays; it will have no effect on the arrays returned to
- * other callers.
- *
- * @return an array of arrays that represent the annotations on the formal
- * parameters, in declaration order, of the method represented by this
- * Constructor object
- * @since 1.5
- */
- public Annotation[][] getParameterAnnotations() {
- int numParameters = parameterTypes.size();
- if (parameterAnnotations == null)
- return new Annotation[numParameters][0];
-
- Annotation[][] result = AnnotationParser.parseParameterAnnotations(
- parameterAnnotations,
- sun.misc.SharedSecrets.getJavaLangAccess().
- getConstantPool(getDeclaringClass()),
- getDeclaringClass());
- if (result.length != numParameters) {
- Class<?> declaringClass = getDeclaringClass();
- if (declaringClass.isEnum() ||
- declaringClass.isAnonymousClass() ||
- declaringClass.isLocalClass() )
- ; // Can't do reliable parameter counting
- else {
- if (!declaringClass.isMemberClass() || // top-level
- // Check for the enclosing instance parameter for
- // non-static member classes
- (declaringClass.isMemberClass() &&
- ((declaringClass.getModifiers() & Modifier.STATIC) == 0) &&
- result.length + 1 != numParameters) ) {
- throw new AnnotationFormatError(
- "Parameter annotations don't match number of parameters");
- }
- }
- }
- return result;
- }
-
-
- public Constructor(Class<T> declaringClass, Class[] parameterTypes, Class[] checkedExceptions, int modifiers, int slot, String signature, byte[] annotations, byte[] parameterAnnotations) {
- //todo implement it
- String my_signature = Signature.toSignature(null, parameterTypes);
- this.vmMethod = declaringClass.getVmClass().link().getDeclaredMethod("<init>", my_signature);
- if(this.vmMethod == null) throw new RuntimeException("Constructor creation failure");
-
- this.modifiers = modifiers;
- this.slot = slot;
- this.signature = signature;
- this.annotations = annotations;
- this.parameterAnnotations = parameterAnnotations;
- }
-
-
- private int modifiers;
- // Generics and annotations support
- private transient String signature;
- // generic info repository; lazily initialized
- private byte[] annotations;
-
- private volatile ConstructorAccessor constructorAccessor;
-
- /**
- * Returns <tt>true</tt> if and only if the underlying class
- * is a member class.
- *
- * @return <tt>true</tt> if and only if this class is a member class.
- * @since 1.5
- */
- public ConstructorAccessor getConstructorAccessor() {
- return constructorAccessor;
- }
-
- public void setConstructorAccessor(ConstructorAccessor accessor) {
- constructorAccessor = accessor;
- // Propagate up
- /*
- if (root != null) {
- root.setConstructorAccessor(accessor);
- }
- */
- }
-
- public int getSlot() {
- return slot;
- }
-
- public byte[] getRawAnnotations() {
- return annotations;
- }
-
- public byte[] getRawParameterAnnotations() {
- return parameterAnnotations;
- }
-
- public Constructor<T> copy() {
- //todo implement it
- throw new UnsupportedOperationException();
- }
-}
Modified: trunk/core/src/classpath/vm/java/lang/reflect/Method.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/reflect/Method.java 2008-12-13 21:11:59 UTC (rev 4787)
+++ trunk/core/src/classpath/vm/java/lang/reflect/Method.java 2008-12-14 21:49:21 UTC (rev 4788)
@@ -319,7 +319,7 @@
// 128 is a reasonable buffer initial size for constructor
StringBuilder sb = new StringBuilder(128);
sb.append(Modifier.toString(getModifiers())).append(' ');
- Constructor.addTypeParameters(sb, getTypeParameters());
+ addTypeParameters(sb, getTypeParameters());
sb.append(getGenericReturnType()).append(' ');
sb.append(getDeclaringClass().getName()).append('.');
sb.append(getName()).append('(');
@@ -596,4 +596,18 @@
return result;
}
+ static <X extends GenericDeclaration>
+ void addTypeParameters(StringBuilder sb, TypeVariable<X>[] typeArgs)
+ {
+ if (typeArgs.length == 0)
+ return;
+ sb.append('<');
+ for (int i = 0; i < typeArgs.length; ++i)
+ {
+ if (i > 0)
+ sb.append(',');
+ sb.append(typeArgs[i]);
+ }
+ sb.append("> ");
+ }
}
Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java 2008-12-13 21:11:59 UTC (rev 4787)
+++ trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java 2008-12-14 21:49:21 UTC (rev 4788)
@@ -194,7 +194,41 @@
Member javaMember = javaMemberHolder.get();
if (javaMember == null) {
if (isConstructor()) {
- javaMember = new Constructor(this);
+ //parameter types
+ int arg_count = getNoArguments();
+ Class[] args = new Class[arg_count];
+ for (int i = 0; i < arg_count; i++) {
+ args[i] = getArgumentType(i).asClass();
+ }
+
+ //checked exceptions
+ final VmExceptions exceptions = getExceptions();
+ int ce_count = exceptions.getLength();
+ final Class[] ces = new Class[ce_count];
+ for (int i = 0; i < ce_count; i++) {
+ VmConstClass vmConstClass = exceptions.getException(i);
+ if (!vmConstClass.isResolved()) {
+ vmConstClass.doResolve(getDeclaringClass().getLoader());
+ }
+ ces[i] = vmConstClass.getResolvedVmClass().asClass();
+ }
+
+ //slot
+ VmType decl_type = getDeclaringClass();
+ int slot = -1;
+ for (int i = 0; i < decl_type.getNoDeclaredMethods(); i++) {
+ if (this == decl_type.getDeclaredMethod(i)) {
+ slot = i;
+ break;
+ }
+ }
+
+ if (slot == -1) {
+ throw new ClassFormatError("Invalid constructor");
+ }
+
+ javaMember = new Constructor(getDeclaringClass().asClass(), args, ces, getModifiers(), slot,
+ getSignature(), getRawAnnotations(), getRawParameterAnnotations());
} else {
javaMember = new Method(this);
}
Modified: trunk/core/src/openjdk/java/java/lang/ThreadGroup.java
===================================================================
--- trunk/core/src/openjdk/java/java/lang/ThreadGroup.java 2008-12-13 21:11:59 UTC (rev 4787)
+++ trunk/core/src/openjdk/java/java/lang/ThreadGroup.java 2008-12-14 21:49:21 UTC (rev 4788)
@@ -68,12 +68,12 @@
int ngroups;
ThreadGroup groups[];
-
+ //jnode
/**
* Creates an empty Thread group that is not in any Thread group.
* This method is used to create the system Thread group.
*/
- private ThreadGroup() { // called from C code
+ public ThreadGroup() { // called from C code
this.name = "system";
this.maxPriority = Thread.MAX_PRIORITY;
}
Added: trunk/core/src/openjdk/java/java/lang/reflect/Constructor.java
===================================================================
--- trunk/core/src/openjdk/java/java/lang/reflect/Constructor.java (rev 0)
+++ trunk/core/src/openjdk/java/java/lang/reflect/Constructor.java 2008-12-14 21:49:21 UTC (rev 4788)
@@ -0,0 +1,691 @@
+/*
+ * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code 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 General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.lang.reflect;
+
+import sun.reflect.ConstructorAccessor;
+import sun.reflect.Reflection;
+import sun.reflect.generics.repository.ConstructorRepository;
+import sun.reflect.generics.factory.CoreReflectionFactory;
+import sun.reflect.generics.factory.GenericsFactory;
+import sun.reflect.generics.scope.ConstructorScope;
+import java.lang.annotation.Annotation;
+import java.util.Map;
+import sun.reflect.annotation.AnnotationParser;
+import java.lang.annotation.AnnotationFormatError;
+import java.lang.reflect.Modifier;
+
+/**
+ * {@code Constructor} provides information about, and access to, a single
+ * constructor for a class.
+ *
+ * <p>{@code Constructor} permits widening conversions to occur when matching the
+ * actual parameters to newInstance() with the underlying
+ * constructor's formal parameters, but throws an
+ * {@code IllegalArgumentException} if a narrowing conversion would occur.
+ *
+ * @param <T> the class in which the constructor is declared
+ *
+ * @see Member
+ * @see java.lang.Class
+ * @see java.lang.Class#getConstructors()
+ * @see java.lang.Class#getConstructor(Class[])
+ * @see java.lang.Class#getDeclaredConstructors()
+ *
+ * @author Kenneth Russell
+ * @author Nakul Saraiya
+ */
+public final
+ class Constructor<T> extends Accessible...
[truncated message content] |
|
From: <ls...@us...> - 2008-12-27 17:00:29
|
Revision: 4809
http://jnode.svn.sourceforge.net/jnode/?rev=4809&view=rev
Author: lsantha
Date: 2008-12-27 17:00:27 +0000 (Sat, 27 Dec 2008)
Log Message:
-----------
Improved reflective field access.
Modified Paths:
--------------
trunk/core/src/core/org/jnode/vm/classmgr/VmField.java
trunk/core/src/openjdk/java/java/lang/reflect/Field.java
trunk/core/src/openjdk/vm/sun/misc/NativeUnsafe.java
Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmField.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/VmField.java 2008-12-27 09:16:49 UTC (rev 4808)
+++ trunk/core/src/core/org/jnode/vm/classmgr/VmField.java 2008-12-27 17:00:27 UTC (rev 4809)
@@ -122,8 +122,20 @@
}
Field javaField = javaFieldHolder.get();
if (javaField == null) {
+ //slot
+ VmType<?> d_class = getDeclaringClass();
+ int slot = -1;
+ for (int i = 0; i < d_class.getNoDeclaredFields(); i++) {
+ if (this == d_class.getDeclaredField(i)) {
+ slot = i;
+ break;
+ }
+ }
+ if (slot == -1) {
+ throw new ClassFormatError("Invalid field: " + this.getName());
+ }
//todo add annotations
- javaField = new Field(getDeclaringClass().asClass(), getName(), getType().asClass(), getModifiers(), -1,
+ javaField = new Field(d_class.asClass(), getName(), getType().asClass(), getModifiers(), slot,
getSignature(), null);
javaFieldHolder.set(javaField);
}
Modified: trunk/core/src/openjdk/java/java/lang/reflect/Field.java
===================================================================
--- trunk/core/src/openjdk/java/java/lang/reflect/Field.java 2008-12-27 09:16:49 UTC (rev 4808)
+++ trunk/core/src/openjdk/java/java/lang/reflect/Field.java 2008-12-27 17:00:27 UTC (rev 4809)
@@ -1038,4 +1038,9 @@
}
return declaredAnnotations;
}
+
+ //jnode
+ public int getSlot() {
+ return slot;
+ }
}
Modified: trunk/core/src/openjdk/vm/sun/misc/NativeUnsafe.java
===================================================================
--- trunk/core/src/openjdk/vm/sun/misc/NativeUnsafe.java 2008-12-27 09:16:49 UTC (rev 4808)
+++ trunk/core/src/openjdk/vm/sun/misc/NativeUnsafe.java 2008-12-27 17:00:27 UTC (rev 4809)
@@ -417,8 +417,8 @@
private static VmField getVmField(Field f) {
VmType<?> vmClass = VmType.fromClass((Class<?>) f.getDeclaringClass());
- vmClass.link();
- return vmClass.getField(f.getName());
+ //vmClass.link();
+ return vmClass.getDeclaredField(f.getSlot());
}
public static void ensureClassInitialized(Unsafe instance, Class c) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2008-12-30 18:20:30
|
Revision: 4810
http://jnode.svn.sourceforge.net/jnode/?rev=4810&view=rev
Author: lsantha
Date: 2008-12-30 18:20:25 +0000 (Tue, 30 Dec 2008)
Log Message:
-----------
Bugfixes and cleanups related to reflection.
Modified Paths:
--------------
trunk/core/src/classpath/vm/gnu/classpath/jdwp/NativeVMVirtualMachine.java
trunk/core/src/core/org/jnode/util/IOUtils.java
trunk/core/src/core/org/jnode/vm/VmReflection.java
trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java
trunk/core/src/core/org/jnode/vm/classmgr/TIBBuilder.java
trunk/core/src/core/org/jnode/vm/classmgr/VmClassType.java
Modified: trunk/core/src/classpath/vm/gnu/classpath/jdwp/NativeVMVirtualMachine.java
===================================================================
--- trunk/core/src/classpath/vm/gnu/classpath/jdwp/NativeVMVirtualMachine.java 2008-12-27 17:00:27 UTC (rev 4809)
+++ trunk/core/src/classpath/vm/gnu/classpath/jdwp/NativeVMVirtualMachine.java 2008-12-30 18:20:25 UTC (rev 4810)
@@ -68,7 +68,7 @@
}
public Object next() {
- return iter.next().newClass();
+ return iter.next().asClass();
}
public void remove() {
Modified: trunk/core/src/core/org/jnode/util/IOUtils.java
===================================================================
--- trunk/core/src/core/org/jnode/util/IOUtils.java 2008-12-27 17:00:27 UTC (rev 4809)
+++ trunk/core/src/core/org/jnode/util/IOUtils.java 2008-12-30 18:20:25 UTC (rev 4810)
@@ -106,7 +106,9 @@
try {
Class<FilterInputStream> cls = FilterInputStream.class;
Field field = cls.getDeclaredField("in");
+ field.setAccessible(true);
Object in = field.get(inputStream);
+ field.setAccessible(false);
return (InputStream) in;
} catch (Exception ex) {
Logger.getLogger(IOUtils.class).error("Cannot extract the 'in' field", ex);
Modified: trunk/core/src/core/org/jnode/vm/VmReflection.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmReflection.java 2008-12-27 17:00:27 UTC (rev 4809)
+++ trunk/core/src/core/org/jnode/vm/VmReflection.java 2008-12-30 18:20:25 UTC (rev 4810)
@@ -82,7 +82,7 @@
return (byte) getStaticFieldAddress(sf).loadInt();
} else {
final VmInstanceField inf = (VmInstanceField) field;
- return (byte) getInstanceFieldAddress(o, inf).loadByte();
+ return getInstanceFieldAddress(o, inf).loadByte();
}
}
@@ -93,7 +93,7 @@
return (char) getStaticFieldAddress(sf).loadInt();
} else {
final VmInstanceField inf = (VmInstanceField) field;
- return (char) getInstanceFieldAddress(o, inf).loadChar();
+ return getInstanceFieldAddress(o, inf).loadChar();
}
}
@@ -104,7 +104,7 @@
return (short) getStaticFieldAddress(sf).loadInt();
} else {
final VmInstanceField inf = (VmInstanceField) field;
- return (short) getInstanceFieldAddress(o, inf).loadShort();
+ return getInstanceFieldAddress(o, inf).loadShort();
}
}
@@ -343,39 +343,133 @@
Unsafe.pushObject(o);
if (!method.isConstructor()) {
- method = VmType.fromClass(o.getClass()).getMethod(method.getName(), method.getSignature());
+ //todo implement dynamic method lookup according to JLS 15.12.4.4
+ if(method.isAbstract())
+ method = VmType.fromClass(o.getClass()).getMethod(method.getName(), method.getSignature());
+ else if(java.lang.reflect.Proxy.isProxyClass(o.getClass())) {
+ method = VmType.fromClass(o.getClass()).getMethod(method.getName(), method.getSignature());
+ }
}
} else {
method.getDeclaringClass().initialize();
}
+
for (int i = 0; i < argCount; i++) {
final VmType<?> argType = method.getArgumentType(i);
final Object arg = args[i];
if (argType.isPrimitive()) {
+ if (arg == null)
+ throw new IllegalArgumentException();
+
int v = 0;
long lv = 0;
boolean wide = false;
- if (arg == null) {
- /* do nothing */
- } else if (arg instanceof Boolean) {
- v = ((Boolean) arg).booleanValue() ? 1 : 0;
- } else if (arg instanceof Byte) {
- v = ((Byte) arg).byteValue();
- } else if (arg instanceof Character) {
- v = ((Character) arg).charValue();
- } else if (arg instanceof Short) {
- v = ((Short) arg).shortValue();
- } else if (arg instanceof Integer) {
- v = ((Integer) arg).intValue();
- } else if (arg instanceof Long) {
- lv = ((Long) arg).longValue();
- wide = true;
- } else if (arg instanceof Float) {
- v = Float.floatToRawIntBits(((Float) arg).floatValue());
- } else if (arg instanceof Double) {
- lv = Double.doubleToRawLongBits(((Double) arg)
- .doubleValue());
- wide = true;
+ switch (argType.getJvmType()) {
+ case JvmType.BOOLEAN: {
+ if (arg instanceof Boolean) {
+ v = (Boolean) arg ? 1 : 0;
+ } else {
+ throw new IllegalArgumentException("argument type mismatch");
+ }
+ break;
+ }
+ case JvmType.INT: {
+ if (arg instanceof Integer) {
+ v = (Integer) arg;
+ } else if (arg instanceof Byte) {
+ v = (Byte) arg;
+ } else if (arg instanceof Character) {
+ v = (Character) arg;
+ } else if (arg instanceof Short) {
+ v = (Short) arg;
+ } else {
+ throw new IllegalArgumentException("argument type mismatch");
+ }
+ break;
+ }
+ case JvmType.CHAR: {
+ if (arg instanceof Character) {
+ v = (Character) arg;
+ } else {
+ throw new IllegalArgumentException("argument type mismatch");
+ }
+ break;
+ }
+ case JvmType.BYTE: {
+ if (arg instanceof Byte) {
+ v = (Byte) arg;
+ } else {
+ throw new IllegalArgumentException("argument type mismatch");
+ }
+ break;
+ }
+ case JvmType.SHORT: {
+ if (arg instanceof Short) {
+ v = (Short) arg;
+ } else if (arg instanceof Byte) {
+ v = (Byte) arg;
+ } else {
+ throw new IllegalArgumentException("argument type mismatch");
+ }
+ break;
+ }
+ case JvmType.FLOAT: {
+ if (arg instanceof Float) {
+ v = Float.floatToRawIntBits((Float) arg);
+ } else if (arg instanceof Byte) {
+ v = Float.floatToRawIntBits((Byte) arg);
+ } else if (arg instanceof Short) {
+ v = Float.floatToRawIntBits((Short) arg);
+ } else if (arg instanceof Integer) {
+ v = Float.floatToRawIntBits((Integer) arg);
+ } else if (arg instanceof Character) {
+ v = Float.floatToRawIntBits((Character) arg);
+ } else {
+ throw new IllegalArgumentException("argument type mismatch");
+ }
+ break;
+ }
+ case JvmType.LONG: {
+ wide = true;
+ if (arg instanceof Long) {
+ lv = (Long) arg;
+ } else if (arg instanceof Integer) {
+ lv = (Integer) arg;
+ } else if (arg instanceof Byte) {
+ lv = (Byte) arg;
+ } else if (arg instanceof Short) {
+ lv = (Short) arg;
+ } else if (arg instanceof Character) {
+ lv = (Character) arg;
+ } else {
+ throw new IllegalArgumentException("argument type mismatch");
+ }
+ break;
+ }
+ case JvmType.DOUBLE: {
+ wide = true;
+ if (arg instanceof Double) {
+ lv = Double.doubleToRawLongBits((Double) arg);
+ } else if (arg instanceof Integer) {
+ lv = Double.doubleToRawLongBits((Integer) arg);
+ } else if (arg instanceof Byte) {
+ lv = Double.doubleToRawLongBits((Byte) arg);
+ } else if (arg instanceof Short) {
+ lv = Double.doubleToRawLongBits((Short) arg);
+ } else if (arg instanceof Character) {
+ lv = Double.doubleToRawLongBits((Character) arg);
+ } else if (arg instanceof Float) {
+ lv = Double.doubleToRawLongBits((Float) arg);
+ } else if (arg instanceof Long) {
+ lv = Double.doubleToRawLongBits((Long) arg);
+ } else {
+ throw new IllegalArgumentException("argument type mismatch");
+ }
+ break;
+ }
+ default: {
+ throw new RuntimeException("invalid argument type: " + argType);
+ }
}
final Class argClass = argType.asClass();
@@ -395,6 +489,11 @@
}
}
} else {
+ if(arg != null) {
+ if(!argType.isAssignableFrom(VmType.fromClass(arg.getClass()))) {
+ throw new IllegalArgumentException ("argument type mismatch");
+ }
+ }
// Non-primitive argument
Unsafe.pushObject(arg);
}
@@ -410,25 +509,25 @@
long rc = Unsafe.invokeLong(method);
final Class<?> retType = method.getReturnType().asClass();
if (Long.TYPE == retType) {
- return new Long(rc);
+ return rc;
} else {
- return new Double(Double.longBitsToDouble(rc));
+ return Double.longBitsToDouble(rc);
}
} else {
int rc = Unsafe.invokeInt(method);
final Class retType = method.getReturnType().asClass();
if (Byte.TYPE == retType) {
- return new Byte((byte) rc);
+ return (byte) rc;
} else if (Boolean.TYPE == retType) {
- return Boolean.valueOf(rc != 0);
+ return rc != 0;
} else if (Character.TYPE == retType) {
- return new Character((char) rc);
+ return (char) rc;
} else if (Short.TYPE == retType) {
- return new Short((short) rc);
+ return (short) rc;
} else if (Float.TYPE == retType) {
- return new Float(Float.intBitsToFloat(rc));
+ return Float.intBitsToFloat(rc);
} else {
- return new Integer(rc);
+ return rc;
}
}
} catch (Throwable ex) {
Modified: trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java 2008-12-27 17:00:27 UTC (rev 4809)
+++ trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java 2008-12-30 18:20:25 UTC (rev 4810)
@@ -1015,7 +1015,7 @@
break;
}
- r_class = vtm.newClass();
+ r_class = vtm.asClass();
} else {
try {
r_class = Class.forName(vtm.getName(), false, vtm.getLoader().asClassLoader());
@@ -1024,7 +1024,7 @@
}
}
Object defo = AnnotationParser.parseMemberValue(r_class, data, new VmConstantPool(cls),
- cls.newClass());
+ cls.asClass());
mts.setAnnotationDefault(defo);
} else {
skip(data, length);
@@ -1263,7 +1263,7 @@
break;
}
- r_class = vtm.newClass();
+ r_class = vtm.asClass();
} else {
try {
r_class = vtm.getLoader().asClassLoader().loadClass(vtm.getName());
Modified: trunk/core/src/core/org/jnode/vm/classmgr/TIBBuilder.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/TIBBuilder.java 2008-12-27 17:00:27 UTC (rev 4809)
+++ trunk/core/src/core/org/jnode/vm/classmgr/TIBBuilder.java 2008-12-30 18:20:25 UTC (rev 4810)
@@ -23,6 +23,7 @@
import java.util.ArrayList;
import java.util.HashMap;
+import gnu.java.lang.VMClassHelper;
/**
* @author epr
@@ -103,7 +104,28 @@
method.setTibOffset(index);
}
+ //todo review rules for overriding and do more testing
/**
+ * Check if the method has the correct visibility ofr overriding the method at index.
+ * It asumed that the signutares were already checked and they match
+ * @param index
+ * @param method
+ * @return
+ */
+ boolean overrides(int index, VmInstanceMethod method) {
+ if (tibAsArray != null) {
+ throw new RuntimeException("This VMT is locked");
+ }
+ if (index < FIRST_METHOD_INDEX) {
+ throw new IndexOutOfBoundsException("Index (" + index + ")must be >= " + FIRST_METHOD_INDEX);
+ }
+ VmInstanceMethod met = (VmInstanceMethod) tibAsList.get(index);
+ return (met.isPublic() || met.isProtected() || (!met.isPrivate() &&
+ VMClassHelper.getPackagePortion(met.getDeclaringClass().getName()).
+ equals(VMClassHelper.getPackagePortion(method.getDeclaringClass().getName()))));
+ }
+
+ /**
* Search through a given VMT for a method with a given name & signature.
* Return the index in the VMT (0..length-1) if found, -1 otherwise.
*
Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmClassType.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/VmClassType.java 2008-12-27 17:00:27 UTC (rev 4809)
+++ trunk/core/src/core/org/jnode/vm/classmgr/VmClassType.java 2008-12-30 18:20:25 UTC (rev 4810)
@@ -148,7 +148,11 @@
final int index = vmt.indexOf(name, signature);
if (index >= 0) {
// The method existed in the super class, overwrite it
- vmt.set(index, method);
+ if(vmt.overrides(index, method)){
+ vmt.set(index, method);
+ } else {
+ vmt.add(method);
+ }
} else {
// The method does not exist yet.
vmt.add(method);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2009-01-04 10:08:49
|
Revision: 4824
http://jnode.svn.sourceforge.net/jnode/?rev=4824&view=rev
Author: lsantha
Date: 2009-01-04 10:08:42 +0000 (Sun, 04 Jan 2009)
Log Message:
-----------
OpenJDK integration.
Modified Paths:
--------------
trunk/core/src/classpath/java/java/security/CodeSource.java
Added Paths:
-----------
trunk/core/src/openjdk/java/java/net/URLClassLoader.java
Removed Paths:
-------------
trunk/core/src/classpath/java/java/net/URLClassLoader.java
Deleted: trunk/core/src/classpath/java/java/net/URLClassLoader.java
===================================================================
--- trunk/core/src/classpath/java/java/net/URLClassLoader.java 2009-01-04 01:48:18 UTC (rev 4823)
+++ trunk/core/src/classpath/java/java/net/URLClassLoader.java 2009-01-04 10:08:42 UTC (rev 4824)
@@ -1,1325 +0,0 @@
-/* URLClassLoader.java -- ClassLoader that loads classes from one or more URLs
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath 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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.net;
-
-import java.io.ByteArrayOutputStream;
-import java.io.EOFException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FilePermission;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.CodeSource;
-import java.security.PermissionCollection;
-import java.security.PrivilegedAction;
-import java.security.SecureClassLoader;
-import java.security.cert.Certificate;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.StringTokenizer;
-import java.util.Vector;
-import java.util.jar.Attributes;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-
-
-/**
- * A secure class loader that can load classes and resources from
- * multiple locations. Given an array of <code>URL</code>s this class
- * loader will retrieve classes and resources by fetching them from
- * possible remote locations. Each <code>URL</code> is searched in
- * order in which it was added. If the file portion of the
- * <code>URL</code> ends with a '/' character then it is interpreted
- * as a base directory, otherwise it is interpreted as a jar file from
- * which the classes/resources are resolved.
- *
- * <p>New instances can be created by two static
- * <code>newInstance()</code> methods or by three public
- * contructors. Both ways give the option to supply an initial array
- * of <code>URL</code>s and (optionally) a parent classloader (that is
- * different from the standard system class loader).</p>
- *
- * <p>Normally creating a <code>URLClassLoader</code> throws a
- * <code>SecurityException</code> if a <code>SecurityManager</code> is
- * installed and the <code>checkCreateClassLoader()</code> method does
- * not return true. But the <code>newInstance()</code> methods may be
- * used by any code as long as it has permission to acces the given
- * <code>URL</code>s. <code>URLClassLoaders</code> created by the
- * <code>newInstance()</code> methods also explicitly call the
- * <code>checkPackageAccess()</code> method of
- * <code>SecurityManager</code> if one is installed before trying to
- * load a class. Note that only subclasses of
- * <code>URLClassLoader</code> can add new URLs after the
- * URLClassLoader had been created. But it is always possible to get
- * an array of all URLs that the class loader uses to resolve classes
- * and resources by way of the <code>getURLs()</code> method.</p>
- *
- * <p>Open issues:
- * <ul>
- *
- * <li>Should the URLClassLoader actually add the locations found in
- * the manifest or is this the responsibility of some other
- * loader/(sub)class? (see <a
- * href="http://java.sun.com/products/jdk/1.4/docs/guide/extensions/spec.html">
- * Extension Mechanism Architecture - Bundles Extensions</a>)</li>
- *
- * <li>How does <code>definePackage()</code> and sealing work
- * precisely?</li>
- *
- * <li>We save and use the security context (when a created by
- * <code>newInstance()</code> but do we have to use it in more
- * places?</li>
- *
- * <li>The use of <code>URLStreamHandler</code>s has not been tested.</li>
- *
- * </ul>
- * </p>
- *
- * @since 1.2
- *
- * @author Mark Wielaard (ma...@kl...)
- * @author Wu Gansha (gan...@in...)
- */
-public class URLClassLoader extends SecureClassLoader
-{
- // Class Variables
-
- /**
- * A global cache to store mappings between URLLoader and URL,
- * so we can avoid do all the homework each time the same URL
- * comes.
- * XXX - Keeps these loaders forever which prevents garbage collection.
- */
- private static HashMap urlloaders = new HashMap();
-
- /**
- * A cache to store mappings between handler factory and its
- * private protocol handler cache (also a HashMap), so we can avoid
- * create handlers each time the same protocol comes.
- */
- private static HashMap factoryCache = new HashMap(5);
-
- // Instance variables
-
- /** Locations to load classes from */
- private final Vector urls = new Vector();
-
- /**
- * Store pre-parsed information for each url into this vector: each
- * element is a URL loader. A jar file has its own class-path
- * attribute which adds to the URLs that will be searched, but this
- * does not add to the list of urls.
- */
- private final Vector urlinfos = new Vector();
-
- /** Factory used to get the protocol handlers of the URLs */
- private final URLStreamHandlerFactory factory;
-
- /**
- * The security context when created from <code>newInstance()</code>
- * or null when created through a normal constructor or when no
- * <code>SecurityManager</code> was installed.
- */
- private final AccessControlContext securityContext;
-
- // Helper classes
-
- /**
- * A <code>URLLoader</code> contains all logic to load resources from a
- * given base <code>URL</code>.
- */
- abstract static class URLLoader
- {
- /**
- * Our classloader to get info from if needed.
- */
- final URLClassLoader classloader;
-
- /**
- * The base URL from which all resources are loaded.
- */
- final URL baseURL;
-
- /**
- * A <code>CodeSource</code> without any associated certificates.
- * It is common for classes to not have certificates associated
- * with them. If they come from the same <code>URLLoader</code>
- * then it is safe to share the associated <code>CodeSource</code>
- * between them since <code>CodeSource</code> is immutable.
- */
- final CodeSource noCertCodeSource;
-
- URLLoader(URLClassLoader classloader, URL baseURL)
- {
- this(classloader, baseURL, baseURL);
- }
-
- URLLoader(URLClassLoader classloader, URL baseURL, URL overrideURL)
- {
- this.classloader = classloader;
- this.baseURL = baseURL;
- this.noCertCodeSource = new CodeSource(overrideURL, (Certificate[])null);
- }
-
- /**
- * Returns a <code>Resource</code> loaded by this
- * <code>URLLoader</code>, or <code>null</code> when no
- * <code>Resource</code> with the given name exists.
- */
- abstract Resource getResource(String s);
-
- /**
- * Returns the <code>Manifest</code> associated with the
- * <code>Resource</code>s loaded by this <code>URLLoader</code> or
- * <code>null</code> there is no such <code>Manifest</code>.
- */
- Manifest getManifest()
- {
- return null;
- }
-
- Vector getClassPath()
- {
- return null;
- }
- }
-
- /**
- * A <code>Resource</code> represents a resource in some
- * <code>URLLoader</code>. It also contains all information (e.g.,
- * <code>URL</code>, <code>CodeSource</code>, <code>Manifest</code> and
- * <code>InputStream</code>) that is necessary for loading resources
- * and creating classes from a <code>URL</code>.
- */
- abstract static class Resource
- {
- final URLLoader loader;
-
- Resource(URLLoader loader)
- {
- this.loader = loader;
- }
-
- /**
- * Returns the non-null <code>CodeSource</code> associated with
- * this resource.
- */
- CodeSource getCodeSource()
- {
- Certificate[] certs = getCertificates();
- if (certs == null)
- return loader.noCertCodeSource;
- else
- return new CodeSource(loader.baseURL, certs);
- }
-
- /**
- * Returns <code>Certificates</code> associated with this
- * resource, or null when there are none.
- */
- Certificate[] getCertificates()
- {
- return null;
- }
-
- /**
- * Return a <code>URL</code> that can be used to access this resource.
- */
- abstract URL getURL();
-
- /**
- * Returns the size of this <code>Resource</code> in bytes or
- * <code>-1</code> when unknown.
- */
- abstract int getLength();
-
- /**
- * Returns the non-null <code>InputStream</code> through which
- * this resource can be loaded.
- */
- abstract InputStream getInputStream() throws IOException;
- }
-
- /**
- * A <code>JarURLLoader</code> is a type of <code>URLLoader</code>
- * only loading from jar url.
- */
- static final class JarURLLoader extends URLLoader
- {
- final JarFile jarfile; // The jar file for this url
- final URL baseJarURL; // Base jar: url for all resources loaded from jar
-
- Vector classPath; // The "Class-Path" attribute of this Jar's manifest
-
- public JarURLLoader(URLClassLoader classloader, URL baseURL,
- URL absoluteUrl)
- {
- super(classloader, baseURL, absoluteUrl);
-
- // Cache url prefix for all resources in this jar url.
- String external = baseURL.toExternalForm();
- StringBuffer sb = new StringBuffer(external.length() + 6);
- sb.append("jar:");
- sb.append(external);
- sb.append("!/");
- String jarURL = sb.toString();
-
- this.classPath = null;
- URL baseJarURL = null;
- JarFile jarfile = null;
- try
- {
- baseJarURL =
- new URL(null, jarURL, classloader.getURLStreamHandler("jar"));
-
- jarfile =
- ((JarURLConnection) baseJarURL.openConnection()).getJarFile();
-
- Manifest manifest;
- Attributes attributes;
- String classPathString;
-
- if ((manifest = jarfile.getManifest()) != null
- && (attributes = manifest.getMainAttributes()) != null
- && ((classPathString
- = attributes.getValue(Attributes.Name.CLASS_PATH))
- != null))
- {
- this.classPath = new Vector();
-
- StringTokenizer st = new StringTokenizer(classPathString, " ");
- while (st.hasMoreElements ())
- {
- String e = st.nextToken ();
- try
- {
- URL url = new URL(baseURL, e);
- this.classPath.add(url);
- }
- catch (java.net.MalformedURLException xx)
- {
- // Give up
- }
- }
- }
- }
- catch (IOException ioe)
- {
- /* ignored */
- }
-
- this.baseJarURL = baseJarURL;
- this.jarfile = jarfile;
- }
-
- /** get resource with the name "name" in the jar url */
- Resource getResource(String name)
- {
- if (jarfile == null)
- return null;
-
- if (name.startsWith("/"))
- name = name.substring(1);
-
- JarEntry je = jarfile.getJarEntry(name);
- if (je != null)
- return new JarURLResource(this, name, je);
- else
- return null;
- }
-
- Manifest getManifest()
- {
- try
- {
- return (jarfile == null) ? null : jarfile.getManifest();
- }
- catch (IOException ioe)
- {
- return null;
- }
- }
-
- Vector getClassPath()
- {
- return classPath;
- }
- }
-
- static final class JarURLResource extends Resource
- {
- private final JarEntry entry;
- private final String name;
-
- JarURLResource(JarURLLoader loader, String name, JarEntry entry)
- {
- super(loader);
- this.entry = entry;
- this.name = name;
- }
-
- InputStream getInputStream() throws IOException
- {
- return ((JarURLLoader) loader).jarfile.getInputStream(entry);
- }
-
- int getLength()
- {
- return (int) entry.getSize();
- }
-
- Certificate[] getCertificates()
- {
- // We have to get the entry from the jar file again, because the
- // certificates will not be available until the entire entry has
- // been read.
- return ((JarEntry) ((JarURLLoader) loader).jarfile.getEntry(name))
- .getCertificates();
- }
-
- URL getURL()
- {
- try
- {
- return new URL(((JarURLLoader) loader).baseJarURL, name,
- loader.classloader.getURLStreamHandler("jar"));
- }
- catch (MalformedURLException e)
- {
- InternalError ie = new InternalError();
- ie.initCause(e);
- throw ie;
- }
- }
- }
-
- /**
- * Loader for remote directories.
- */
- static final class RemoteURLLoader extends URLLoader
- {
- private final String protocol;
-
- RemoteURLLoader(URLClassLoader classloader, URL url)
- {
- super(classloader, url);
- protocol = url.getProtocol();
- }
-
- /**
- * Get a remote resource.
- * Returns null if no such resource exists.
- */
- Resource getResource(String name)
- {
- try
- {
- URL url =
- new URL(baseURL, name, classloader.getURLStreamHandler(protocol));
- URLConnection connection = url.openConnection();
-
- // Open the connection and check the stream
- // just to be sure it exists.
- int length = connection.getContentLength();
- InputStream stream = connection.getInputStream();
-
- // We can do some extra checking if it is a http request
- if (connection instanceof HttpURLConnection)
- {
- int response =
- ((HttpURLConnection) connection).getResponseCode();
- if (response / 100 != 2)
- return null;
- }
-
- if (stream != null)
- return new RemoteResource(this, name, url, stream, length);
- else
- return null;
- }
- catch (IOException ioe)
- {
- return null;
- }
- }
- }
-
- /**
- * A resource from some remote location.
- */
- static final class RemoteResource extends Resource
- {
- private final URL url;
- private final InputStream stream;
- private final int length;
-
- RemoteResource(RemoteURLLoader loader, String name, URL url,
- InputStream stream, int length)
- {
- super(loader);
- this.url = url;
- this.stream = stream;
- this.length = length;
- }
-
- InputStream getInputStream() throws IOException
- {
- return stream;
- }
-
- public int getLength()
- {
- return length;
- }
-
- public URL getURL()
- {
- return url;
- }
- }
-
- /**
- * A <code>FileURLLoader</code> is a type of <code>URLLoader</code>
- * only loading from file url.
- */
- static final class FileURLLoader extends URLLoader
- {
- File dir; //the file for this file url
-
- FileURLLoader(URLClassLoader classloader, URL url, URL absoluteUrl)
- {
- super(classloader, url, absoluteUrl);
- dir = new File(absoluteUrl.getFile());
- }
-
- /** get resource with the name "name" in the file url */
- Resource getResource(String name)
- {
- try
- {
- // Make sure that all components in name are valid by walking through
- // them
- File file = walkPathComponents(name);
-
- if (file == null)
- return null;
-
- return new FileResource(this, file);
- }
- catch (IOException e)
- {
- // Fall through...
- }
- return null;
- }
-
- /**
- * Walk all path tokens and check them for validity. At no moment, we are
- * allowed to reach a directory located "above" the root directory, stored
- * in "dir" property. We are also not allowed to enter a non existing
- * directory or a non directory component (plain file, symbolic link, ...).
- * An empty or null path is valid. Pathnames components are separated by
- * <code>File.separatorChar</code>
- *
- * @param resourceFileName the name to be checked for validity.
- * @return the canonical file pointed by the resourceFileName or null if the
- * walking failed
- * @throws IOException in case of issue when creating the canonical
- * resulting file
- * @see File#separatorChar
- */
- private File walkPathComponents(String resourceFileName) throws IOException
- {
- StringTokenizer stringTokenizer = new StringTokenizer(resourceFileName, File.separator);
- File currentFile = dir;
- int tokenCount = stringTokenizer.countTokens();
-
- for (int i = 0; i < tokenCount - 1; i++)
- {
- String currentToken = stringTokenizer.nextToken();
-
- // If we are at the root directory and trying to go up, the walking is
- // finished with an error
- if ("..".equals(currentToken) && currentFile.equals(dir))
- return null;
-
- currentFile = new File(currentFile, currentToken);
-
- // If the current file doesn't exist or is not a directory, the walking is
- // finished with an error
- if (! (currentFile.exists() && currentFile.isDirectory()))
- return null;
-
- }
-
- // Treat the last token differently, if it exists, because it does not need
- // to be a directory
- if (tokenCount > 0)
- {
- String currentToken = stringTokenizer.nextToken();
-
- if ("..".equals(currentToken) && currentFile.equals(dir))
- return null;
-
- currentFile = new File(currentFile, currentToken);
-
- // If the current file doesn't exist, the walking is
- // finished with an error
- if (! currentFile.exists())
- return null;
- }
-
- return currentFile.getCanonicalFile();
- }
- }
-
- static final class FileResource extends Resource
- {
- final File file;
-
- FileResource(FileURLLoader loader, File file)
- {
- super(loader);
- this.file = file;
- }
-
- InputStream getInputStream() throws IOException
- {
- return new FileInputStream(file);
- }
-
- public int getLength()
- {
- return (int) file.length();
- }
-
- public URL getURL()
- {
- try
- {
- return file.toURL();
- }
- catch (MalformedURLException e)
- {
- InternalError ie = new InternalError();
- ie.initCause(e);
- throw ie;
- }
- }
- }
-
- // Constructors
-
- /**
- * Creates a URLClassLoader that gets classes from the supplied URLs.
- * To determine if this classloader may be created the constructor of
- * the super class (<code>SecureClassLoader</code>) is called first, which
- * can throw a SecurityException. Then the supplied URLs are added
- * in the order given to the URLClassLoader which uses these URLs to
- * load classes and resources (after using the default parent ClassLoader).
- *
- * @param urls Locations that should be searched by this ClassLoader when
- * resolving Classes or Resources.
- * @exception SecurityException if the SecurityManager disallows the
- * creation of a ClassLoader.
- * @see SecureClassLoader
- */
- public URLClassLoader(URL[] urls) throws SecurityException
- {
- super();
- this.factory = null;
- this.securityContext = null;
- addURLs(urls);
- }
-
- /**
- * Creates a <code>URLClassLoader</code> that gets classes from the supplied
- * <code>URL</code>s.
- * To determine if this classloader may be created the constructor of
- * the super class (<code>SecureClassLoader</code>) is called first, which
- * can throw a SecurityException. Then the supplied URLs are added
- * in the order given to the URLClassLoader which uses these URLs to
- * load classes and resources (after using the supplied parent ClassLoader).
- * @param urls Locations that should be searched by this ClassLoader when
- * resolving Classes or Resources.
- * @param parent The parent class loader used before trying this class
- * loader.
- * @exception SecurityException if the SecurityManager disallows the
- * creation of a ClassLoader.
- * @exception SecurityException
- * @see SecureClassLoader
- */
- public URLClassLoader(URL[] urls, ClassLoader parent)
- throws SecurityException
- {
- super(parent);
- this.factory = null;
- this.securityContext = null;
- addURLs(urls);
- }
-
- // Package-private to avoid a trampoline constructor.
- /**
- * Package-private constructor used by the static
- * <code>newInstance(URL[])</code> method. Creates an
- * <code>URLClassLoader</code> with the given parent but without any
- * <code>URL</code>s yet. This is used to bypass the normal security
- * check for creating classloaders, but remembers the security
- * context which will be used when defining classes. The
- * <code>URL</code>s to load from must be added by the
- * <code>newInstance()</code> method in the security context of the
- * caller.
- *
- * @param securityContext the security context of the unprivileged code.
- */
- URLClassLoader(ClassLoader parent, AccessControlContext securityContext)
- {
- super(parent);
- this.factory = null;
- this.securityContext = securityContext;
- }
-
- /**
- * Creates a URLClassLoader that gets classes from the supplied URLs.
- * To determine if this classloader may be created the constructor of
- * the super class (<CODE>SecureClassLoader</CODE>) is called first, which
- * can throw a SecurityException. Then the supplied URLs are added
- * in the order given to the URLClassLoader which uses these URLs to
- * load classes and resources (after using the supplied parent ClassLoader).
- * It will use the supplied <CODE>URLStreamHandlerFactory</CODE> to get the
- * protocol handlers of the supplied URLs.
- * @param urls Locations that should be searched by this ClassLoader when
- * resolving Classes or Resources.
- * @param parent The parent class loader used before trying this class
- * loader.
- * @param factory Used to get the protocol handler for the URLs.
- * @exception SecurityException if the SecurityManager disallows the
- * creation of a ClassLoader.
- * @exception SecurityException
- * @see SecureClassLoader
- */
- public URLClassLoader(URL[] urls, ClassLoader parent,
- URLStreamHandlerFactory factory)
- throws SecurityException
- {
- super(parent);
- this.securityContext = null;
- this.factory = factory;
- addURLs(urls);
-
- // If this factory is still not in factoryCache, add it,
- // since we only support three protocols so far, 5 is enough
- // for cache initial size
- synchronized (factoryCache)
- {
- if (factory != null && factoryCache.get(factory) == null)
- factoryCache.put(factory, new HashMap(5));
- }
- }
-
- // Methods
-
- /**
- * Adds a new location to the end of the internal URL store.
- * @param newUrl the location to add
- */
- protected void addURL(URL newUrl)
- {
- urls.add(newUrl);
- addURLImpl(newUrl);
- }
-
- private void addURLImpl(URL newUrl)
- {
- synchronized (this)
- {
- if (newUrl == null)
- return; // Silently ignore...
-
- // Reset the toString() value.
- thisString = null;
-
- // Check global cache to see if there're already url loader
- // for this url.
- URLLoader loader = (URLLoader) urlloaders.get(newUrl);
- if (loader == null)
- {
- String file = newUrl.getFile();
- String protocol = newUrl.getProtocol();
-
- // If we have a file: URL, we want to make it absolute
- // here, before we decide whether it is really a jar.
- URL absoluteURL;
- if ("file".equals (protocol))
- {
- File dir = new File(file);
- URL absUrl;
- try
- {
- absoluteURL = dir.getCanonicalFile().toURL();
- }
- catch (IOException ignore)
- {
- try
- {
- absoluteURL = dir.getAbsoluteFile().toURL();
- }
- catch (MalformedURLException _)
- {
- // This really should not happen.
- absoluteURL = newUrl;
- }
- }
- }
- else
- {
- // This doesn't hurt, and it simplifies the logic a
- // little.
- absoluteURL = newUrl;
- }
-
- // Check that it is not a directory
- if (! (file.endsWith("/") || file.endsWith(File.separator)))
- loader = new JarURLLoader(this, newUrl, absoluteURL);
- else if ("file".equals(protocol))
- loader = new FileURLLoader(this, newUrl, absoluteURL);
- else
- loader = new RemoteURLLoader(this, newUrl);
-
- // Cache it.
- urlloaders.put(newUrl, loader);
- }
-
- urlinfos.add(loader);
-
- Vector extraUrls = loader.getClassPath();
- if (extraUrls != null)
- {
- Iterator it = extraUrls.iterator();
- while (it.hasNext())
- {
- URL url = (URL)it.next();
- URLLoader extraLoader = (URLLoader) urlloaders.get(url);
- if (! urlinfos.contains (extraLoader))
- addURLImpl(url);
- }
- }
-
- }
- }
-
- /**
- * Adds an array of new locations to the end of the internal URL
- * store. Called from the the constructors. Should not call to the
- * protected addURL() method since that can be overridden and
- * subclasses are not yet in a good state at this point.
- * jboss 4.0.3 for example depends on this.
- *
- * @param newUrls the locations to add
- */
- private void addURLs(URL[] newUrls)
- {
- for (int i = 0; i < newUrls.length; i++)
- {
- urls.add(newUrls[i]);
- addURLImpl(newUrls[i]);
- }
- }
-
- /**
- * Look in both Attributes for a given value. The first Attributes
- * object, if not null, has precedence.
- */
- private String getAttributeValue(Attributes.Name name, Attributes first,
- Attributes second)
- {
- String result = null;
- if (first != null)
- result = first.getValue(name);
- if (result == null)
- result = second.getValue(name);
- return result;
- }
-
- /**
- * Defines a Package based on the given name and the supplied manifest
- * information. The manifest indicates the title, version and
- * vendor information of the specification and implementation and whether the
- * package is sealed. If the Manifest indicates that the package is sealed
- * then the Package will be sealed with respect to the supplied URL.
- *
- * @param name The name of the package
- * @param manifest The manifest describing the specification,
- * implementation and sealing details of the package
- * @param url the code source url to seal the package
- * @return the defined Package
- * @throws IllegalArgumentException If this package name already exists
- * in this class loader
- */
- protected Package definePackage(String name, Manifest manifest, URL url)
- throws IllegalArgumentException
- {
- // Compute the name of the package as it may appear in the
- // Manifest.
- StringBuffer xform = new StringBuffer(name);
- for (int i = xform.length () - 1; i >= 0; --i)
- if (xform.charAt(i) == '.')
- xform.setCharAt(i, '/');
- xform.append('/');
- String xformName = xform.toString();
-
- Attributes entryAttr = manifest.getAttributes(xformName);
- Attributes attr = manifest.getMainAttributes();
-
- String specTitle
- = getAttributeValue(Attributes.Name.SPECIFICATION_TITLE,
- entryAttr, attr);
- String specVersion
- = getAttributeValue(Attributes.Name.SPECIFICATION_VERSION,
- entryAttr, attr);
- String specVendor
- = getAttributeValue(Attributes.Name.SPECIFICATION_VENDOR,
- entryAttr, attr);
- String implTitle
- = getAttributeValue(Attributes.Name.IMPLEMENTATION_TITLE,
- entryAttr, attr);
- String implVersion
- = getAttributeValue(Attributes.Name.IMPLEMENTATION_VERSION,
- entryAttr, attr);
- String implVendor
- = getAttributeValue(Attributes.Name.IMPLEMENTATION_VENDOR,
- entryAttr, attr);
-
- // Look if the Manifest indicates that this package is sealed
- // XXX - most likely not completely correct!
- // Shouldn't we also check the sealed attribute of the complete jar?
- // http://java.sun.com/products/jdk/1.4/docs/guide/extensions/spec.html#bundled
- // But how do we get that jar manifest here?
- String sealed = attr.getValue(Attributes.Name.SEALED);
- if ("false".equals(sealed))
- // make sure that the URL is null so the package is not sealed
- url = null;
-
- return definePackage(name,
- specTitle, specVendor, specVersio...
[truncated message content] |
|
From: <ls...@us...> - 2009-01-04 16:31:57
|
Revision: 4828
http://jnode.svn.sourceforge.net/jnode/?rev=4828&view=rev
Author: lsantha
Date: 2009-01-04 16:31:52 +0000 (Sun, 04 Jan 2009)
Log Message:
-----------
VM interface cleanups.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/lang/Thread.java
trunk/core/src/mmtk-vm/org/mmtk/vm/Strings.java
trunk/core/src/openjdk/java/java/lang/System.java
trunk/core/src/openjdk/vm/java/lang/NativeShutdown.java
trunk/core/src/openjdk/vm/java/lang/NativeString.java
trunk/core/src/openjdk/vm/java/lang/NativeSystem.java
trunk/core/src/openjdk/vm/java/lang/NativeThrowable.java
trunk/core/src/openjdk/vm/java/lang/reflect/NativeArray.java
Removed Paths:
-------------
trunk/core/src/classpath/java/java/lang/reflect/
trunk/core/src/classpath/vm/java/lang/VMCompiler.java
trunk/core/src/classpath/vm/java/lang/VMDouble.java
trunk/core/src/classpath/vm/java/lang/VMFloat.java
trunk/core/src/classpath/vm/java/lang/VMMath.java
trunk/core/src/classpath/vm/java/lang/VMObject.java
trunk/core/src/classpath/vm/java/lang/VMString.java
trunk/core/src/classpath/vm/java/lang/VMThrowable.java
trunk/core/src/classpath/vm/java/lang/reflect/VMArray.java
Modified: trunk/core/src/classpath/vm/java/lang/Thread.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/Thread.java 2009-01-04 14:07:46 UTC (rev 4827)
+++ trunk/core/src/classpath/vm/java/lang/Thread.java 2009-01-04 16:31:52 UTC (rev 4828)
@@ -41,7 +41,6 @@
import java.util.Map;
import java.util.WeakHashMap;
import java.util.HashMap;
-import java.lang.reflect.Constructor;
import org.jnode.security.JNodePermission;
@@ -50,7 +49,6 @@
import org.jnode.vm.annotation.Internal;
import org.jnode.vm.annotation.SharedStatics;
import org.jnode.vm.classmgr.VmIsolatedStatics;
-import org.jnode.vm.isolate.IsolateThread;
import org.jnode.vm.scheduler.MonitorManager;
import org.jnode.vm.scheduler.VmProcessor;
import org.jnode.vm.scheduler.VmThread;
@@ -1258,7 +1256,7 @@
if (!isAlive()) {
return EMPTY_STACK_TRACE;
}
- return VMThrowable.backTrace2stackTrace(VmThread.getStackTrace(vmThread));
+ return NativeThrowable.backTrace2stackTrace(VmThread.getStackTrace(vmThread));
} else {
// Don't need JVM help for current thread
return (new Exception()).getStackTrace();
@@ -1468,4 +1466,5 @@
// blocker = b;
// }
}
+
}
Deleted: trunk/core/src/classpath/vm/java/lang/VMCompiler.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/VMCompiler.java 2009-01-04 14:07:46 UTC (rev 4827)
+++ trunk/core/src/classpath/vm/java/lang/VMCompiler.java 2009-01-04 16:31:52 UTC (rev 4828)
@@ -1,94 +0,0 @@
-/*
- * $Id$
- *
- * JNode.org
- * Copyright (C) 2003-2006 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 java.lang;
-
-/**
- * This class is just a per-VM reflection of java.lang.Compiler. All methods are
- * defined identically.
- */
-final class VMCompiler {
- /**
- * Don't allow new `Compiler's to be made.
- */
- private VMCompiler() {
- }
-
- /**
- * Compile the class named by <code>oneClass</code>.
- *
- * @param oneClass
- * the class to compile
- * @return <code>false</code> if no compiler is available or compilation
- * failed, <code>true</code> if compilation succeeded
- * @throws NullPointerException
- * if oneClass is null
- */
- public static boolean compileClass(Class oneClass) {
- // Never succeed.
- return false;
- }
-
- /**
- * Compile the classes whose name matches <code>classNames</code>.
- *
- * @param classNames
- * the name of classes to compile
- * @return <code>false</code> if no compiler is available or compilation
- * failed, <code>true</code> if compilation succeeded
- * @throws NullPointerException
- * if classNames is null
- */
- public static boolean compileClasses(String classNames) {
- // Note the incredibly lame interface. Always fail.
- return false;
- }
-
- /**
- * This method examines the argument and performs an operation according to
- * the compilers documentation. No specific operation is required.
- *
- * @param arg
- * a compiler-specific argument
- * @return a compiler-specific value, including null
- * @throws NullPointerException
- * if the compiler doesn't like a null arg
- */
- public static Object command(Object arg) {
- // Our implementation defines this to a no-op.
- return null;
- }
-
- /**
- * Calling <code>Compiler.enable()</code> will cause the compiler to
- * resume operation if it was previously disabled; provided that a compiler
- * even exists.
- */
- public static void enable() {
- }
-
- /**
- * Calling <code>Compiler.disable()</code> will cause the compiler to be
- * suspended; provided that a compiler even exists.
- */
- public static void disable() {
- }
-}
Deleted: trunk/core/src/classpath/vm/java/lang/VMDouble.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/VMDouble.java 2009-01-04 14:07:46 UTC (rev 4827)
+++ trunk/core/src/classpath/vm/java/lang/VMDouble.java 2009-01-04 16:31:52 UTC (rev 4828)
@@ -1,348 +0,0 @@
-/*
- * $Id$
- *
- * JNode.org
- * Copyright (C) 2003-2006 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 java.lang;
-
-import org.jnode.vm.VmMagic;
-import org.jnode.vm.annotation.MagicPermission;
-
-/**
- * VM specific double routines.
- *
- * @author Ewout Prangsma (ep...@us...)
- */
-@MagicPermission
-public final class VMDouble {
- private char[] chars;
-
- private int length;
-
- private int index;
-
- /**
- * Convert the double to the IEEE 754 floating-point "double format" bit
- * layout. Bit 63 (the most significant) is the sign bit, bits 62-52 (masked
- * by 0x7ff0000000000000L) represent the exponent, and bits 51-0 (masked by
- * 0x000fffffffffffffL) are the mantissa. This function collapses all
- * versions of NaN to 0x7ff8000000000000L. The result of this function can
- * be used as the argument to <code>Double.longBitsToDouble(long)</code>
- * to obtain the original <code>double</code> value.
- *
- * @param value
- * the <code>double</code> to convert
- * @return the bits of the <code>double</code>
- * @see #longBitsToDouble(long)
- */
- public static long doubleToLongBits(double value) {
- if (Double.isNaN(value)) {
- return 0x7ff8000000000000L;
- } else {
- return VmMagic.doubleToRawLongBits(value);
- }
- }
-
- /**
- * Convert the double to the IEEE 754 floating-point "double format" bit
- * layout. Bit 63 (the most significant) is the sign bit, bits 62-52 (masked
- * by 0x7ff0000000000000L) represent the exponent, and bits 51-0 (masked by
- * 0x000fffffffffffffL) are the mantissa. This function leaves NaN alone,
- * rather than collapsing to a canonical value. The result of this function
- * can be used as the argument to <code>Double.longBitsToDouble(long)</code>
- * to obtain the original <code>double</code> value.
- *
- * @param value
- * the <code>double</code> to convert
- * @return the bits of the <code>double</code>
- * @see #longBitsToDouble(long)
- */
- public static long doubleToRawLongBits(double value) {
- return VmMagic.doubleToRawLongBits(value);
- }
-
- /**
- * Convert the argument in IEEE 754 floating-point "double format" bit
- * layout to the corresponding float. Bit 63 (the most significant) is the
- * sign bit, bits 62-52 (masked by 0x7ff0000000000000L) represent the
- * exponent, and bits 51-0 (masked by 0x000fffffffffffffL) are the mantissa.
- * This function leaves NaN alone, so that you can recover the bit pattern
- * with <code>Double.doubleToRawLongBits(double)</code>.
- *
- * @param bits
- * the bits to convert
- * @return the <code>double</code> represented by the bits
- * @see #doubleToLongBits(double)
- * @see #doubleToRawLongBits(double)
- */
- public static double longBitsToDouble(long bits) {
- return VmMagic.longBitsToDouble(bits);
- }
-
- private int parseUnsignedInt() throws NumberFormatException {
- if (index >= length)
- throw new NumberFormatException();
-
- int start = index;
- int value = 0;
-
- for (; index < length; index++) {
- int d = Character.digit(chars[index], 10);
- if (d < 0)
- break;
- value *= 10;
- value += d;
- }
-
- if (index == start)
- throw new NumberFormatException();
-
- return value;
- }
-
- private int parseSignedInt() throws NumberFormatException {
- if (index >= length)
- throw new NumberFormatException();
-
- char sign = ' ';
-
- switch (chars[index]) {
- case '-':
- sign = '-';
- index++;
- break;
-
- case '+':
- sign = '+';
- index++;
- break;
- }
-
- int value = parseUnsignedInt();
-
- return (sign == '-') ? -value : value;
- }
-
- private double parseFractionalPart(boolean nonEmpty)
- throws NumberFormatException {
- if (index >= length)
- throw new NumberFormatException();
-
- int start = index;
- double value = 0.0d;
-
- for (; index < length; index++) {
- int d = Character.digit(chars[index], 10);
- if (d < 0)
- break;
- value += d;
- value /= 10;
- }
-
- if (nonEmpty && (index == start))
- throw new NumberFormatException();
-
- return value;
- }
-
- private double parseExponent(double value) throws NumberFormatException {
- if (index >= chars.length)
- return value;
-
- switch (chars[index]) {
- case 'f':
- case 'F':
- case 'd':
- case 'D':
- return value;
-
- case 'e':
- case 'E':
- index++;
- break;
-
- default:
- throw new NumberFormatException();
- }
-
- int exponent = parseSignedInt();
-
- char ch = 0;
- if (index < chars.length && ((ch = chars[index]) != 'f' && ch != 'F' && ch != 'd' && ch != 'D'))
- throw new NumberFormatException();
-
- return value * Math.pow(10.0, exponent);
- }
-
- public static double parseDouble(String s) {
- return new VMDouble(s).parse();
- }
-
- public double parse() throws NumberFormatException {
- if (index >= chars.length)
- throw new NumberFormatException();
-
- char sign = '+';
-
- switch (chars[index]) {
- case '-':
- sign = '-';
- index++;
- break;
-
- case '+':
- sign = '+';
- index++;
- break;
- }
-
- if (index >= chars.length)
- throw new NumberFormatException();
-
- double value = 0;
-
- if (chars[index] == '.') {
- index++;
- value = parseFractionalPart(true);
- value = parseExponent(value);
- } else {
- value = parseUnsignedInt();
-
- if (index < chars.length){
- if(chars[index] == '.'){
- index++;
- value += parseFractionalPart(false);
- }
- }
-
-
- value = parseExponent(value);
- }
-
- return (sign == '-') ? -value : value;
- }
-
- public VMDouble(String s) {
- chars = s.toCharArray();
- length = chars.length;
- index = 0;
- }
-
- /**
- * Convert the <code>double</code> to a <code>String</code>.
- * Floating-point string representation is fairly complex: here is a rundown
- * of the possible values. "<code>[-]</code>" indicates that a negative
- * sign will be printed if the value (or exponent) is negative. "
- * <code><number></code>" means a string of digits ('0' to '9'). "
- * <code><digit></code>" means a single digit ('0' to '9'). <br>
- *
- * <table border=1>
- * <tr>
- * <th>Value of Double</th>
- * <th>String Representation</th>
- * </tr>
- * <tr>
- * <td>[+-] 0</td>
- * <td><code>[-]0.0</code></td>
- * </tr>
- * <tr>
- * <td>Between [+-] 10 <sup>-3 </sup> and 10 <sup>7 </sup>, exclusive</td>
- * <td><code>[-]number.number</code></td>
- * </tr>
- * <tr>
- * <td>Other numeric value</td>
- * <td><code>[-]<digit>.<number>
- * E[-]<number></code>
- * </td>
- * </tr>
- * <tr>
- * <td>[+-] infinity</td>
- * <td><code>[-]Infinity</code></td>
- * </tr>
- * <tr>
- * <td>NaN</td>
- * <td><code>NaN</code></td>
- * </tr>
- * </table>
- *
- * Yes, negative zero <em>is</em> a possible value. Note that there is
- * <em>always</em> a <code>.</code> and at least one digit printed after
- * it: even if the number is 3, it will be printed as <code>3.0</code>.
- * After the ".", all digits will be printed except trailing zeros. The
- * result is rounded to the shortest decimal number which will parse back to
- * the same double.
- *
- * <p>
- * To create other output formats, use {@link java.text.NumberFormat}.
- *
- * @XXX specify where we are not in accord with the spec.
- *
- * @param v
- * the <code>double</code> to convert
- * @return the <code>String</code> representing the <code>double</code>
- */
- public static String toString(double v, boolean isFloat) {
-
- final int MAX_DIGITS = isFloat ? 10 : 19;
-
- if (Double.isNaN(v))
- return "NaN";
- if (v == Double.POSITIVE_INFINITY)
- return "Infinity";
- if (v == Double.NEGATIVE_INFINITY)
- return "-Infinity";
-
- boolean negative = (doubleToLongBits(v) & (1L << 63)) != 0;
- double m = negative ? -v : v;
-
- if (m == 0.0d)
- return negative ? "-0.0" : "0.0";
-
- StringBuffer result = new StringBuffer(MAX_DIGITS * 2);
- if (negative) {
- result.append('-');
- }
-
- if (m >= 1e-3 && m < 1e7) {
- int digits = 0;
- long digit = (long) (m - 0.5d);
- result.append(digit);
- result.append('.');
- m -= digit;
- while ((m > 0.0d) && (digits < MAX_DIGITS)) {
- m *= 10.0d;
- digit = (long) (m - 0.5d);
- m -= digit;
- result.append(digit);
- digits++;
- }
- if (digits == 0) {
- result.append('0');
- }
- } else {
- int exponent = (int) (Math.log(m) / Math.log(10.0d));
- double mantissa = m / Math.pow(10.0d, exponent);
- result.append(toString(mantissa, isFloat));
- result.append('E');
- result.append(Integer.toString(exponent));
- }
-
- return result.toString();
- }
-}
Deleted: trunk/core/src/classpath/vm/java/lang/VMFloat.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/VMFloat.java 2009-01-04 14:07:46 UTC (rev 4827)
+++ trunk/core/src/classpath/vm/java/lang/VMFloat.java 2009-01-04 16:31:52 UTC (rev 4828)
@@ -1,97 +0,0 @@
-/*
- * $Id$
- *
- * JNode.org
- * Copyright (C) 2003-2006 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 java.lang;
-
-import org.jnode.vm.VmMagic;
-import org.jnode.vm.annotation.MagicPermission;
-
-/*
- * This class is a reference version, mainly for compiling a class library jar.
- * It is likely that VM implementers replace this with their own version that
- * can communicate effectively with the VM.
- */
-
-/**
- * Code relocated from java.lang.Float by
- *
- * @author Dave Grove <gr...@us...>
- */
-@MagicPermission
-final class VMFloat {
- /**
- * Convert the float to the IEEE 754 floating-point "single format" bit
- * layout. Bit 31 (the most significant) is the sign bit, bits 30-23 (masked
- * by 0x7f800000) represent the exponent, and bits 22-0 (masked by
- * 0x007fffff) are the mantissa. This function collapses all versions of NaN
- * to 0x7fc00000. The result of this function can be used as the argument to
- * <code>Float.intBitsToFloat(int)</code> to obtain the original
- * <code>float</code> value.
- *
- * @param value
- * the <code>float</code> to convert
- * @return the bits of the <code>float</code>
- * @see #intBitsToFloat(int)
- */
- static int floatToIntBits(float value) {
- if (Float.isNaN(value)) {
- return 0x7fc00000;
- } else {
- return VmMagic.floatToRawIntBits(value);
- }
- }
-
- /**
- * Convert the float to the IEEE 754 floating-point "single format" bit
- * layout. Bit 31 (the most significant) is the sign bit, bits 30-23 (masked
- * by 0x7f800000) represent the exponent, and bits 22-0 (masked by
- * 0x007fffff) are the mantissa. This function leaves NaN alone, rather than
- * collapsing to a canonical value. The result of this function can be used
- * as the argument to <code>Float.intBitsToFloat(int)</code> to obtain the
- * original <code>float</code> value.
- *
- * @param value
- * the <code>float</code> to convert
- * @return the bits of the <code>float</code>
- * @see #intBitsToFloat(int)
- */
- static int floatToRawIntBits(float value) {
- return VmMagic.floatToRawIntBits(value);
- }
-
- /**
- * Convert the argument in IEEE 754 floating-point "single format" bit
- * layout to the corresponding float. Bit 31 (the most significant) is the
- * sign bit, bits 30-23 (masked by 0x7f800000) represent the exponent, and
- * bits 22-0 (masked by 0x007fffff) are the mantissa. This function leaves
- * NaN alone, so that you can recover the bit pattern with
- * <code>Float.floatToRawIntBits(float)</code>.
- *
- * @param bits
- * the bits to convert
- * @return the <code>float</code> represented by the bits
- * @see #floatToIntBits(float)
- * @see #floatToRawIntBits(float)
- */
- static float intBitsToFloat(int bits) {
- return VmMagic.intBitsToFloat(bits);
- }
-} // class VMFloat
Deleted: trunk/core/src/classpath/vm/java/lang/VMMath.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/VMMath.java 2009-01-04 14:07:46 UTC (rev 4827)
+++ trunk/core/src/classpath/vm/java/lang/VMMath.java 2009-01-04 16:31:52 UTC (rev 4828)
@@ -1,541 +0,0 @@
-/* VMMath.java -- Common mathematical functions.
- Copyright (C) 2006 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath 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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-import gnu.classpath.Configuration;
-
-class VMMath
-{
-
- static
- {
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("javalang");
- }
- }
-
- /**
- * The trigonometric function <em>sin</em>. The sine of NaN or infinity is
- * NaN, and the sine of 0 retains its sign. This is accurate within 1 ulp,
- * and is semi-monotonic.
- *
- * @param a the angle (in radians)
- * @return sin(a)
- */
- public static double sin(double a) {
- return StrictMath.sin(a);
- }
-
- /**
- * The trigonometric function <em>cos</em>. The cosine of NaN or infinity is
- * NaN. This is accurate within 1 ulp, and is semi-monotonic.
- *
- * @param a the angle (in radians)
- * @return cos(a)
- */
- public static double cos(double a) {
- return StrictMath.cos(a);
- }
-
- /**
- * The trigonometric function <em>tan</em>. The tangent of NaN or infinity
- * is NaN, and the tangent of 0 retains its sign. This is accurate within 1
- * ulp, and is semi-monotonic.
- *
- * @param a the angle (in radians)
- * @return tan(a)
- */
- public static double tan(double a) {
- return StrictMath.tan(a);
- }
-
- /**
- * The trigonometric function <em>arcsin</em>. The range of angles returned
- * is -pi/2 to pi/2 radians (-90 to 90 degrees). If the argument is NaN or
- * its absolute value is beyond 1, the result is NaN; and the arcsine of
- * 0 retains its sign. This is accurate within 1 ulp, and is semi-monotonic.
- *
- * @param a the sin to turn back into an angle
- * @return arcsin(a)
- */
- public static double asin(double a) {
- return StrictMath.asin(a);
- }
-
- /**
- * The trigonometric function <em>arccos</em>. The range of angles returned
- * is 0 to pi radians (0 to 180 degrees). If the argument is NaN or
- * its absolute value is beyond 1, the result is NaN. This is accurate
- * within 1 ulp, and is semi-monotonic.
- *
- * @param a the cos to turn back into an angle
- * @return arccos(a)
- */
- public static double acos(double a) {
- return StrictMath.acos(a);
- }
-
- /**
- * The trigonometric function <em>arcsin</em>. The range of angles returned
- * is -pi/2 to pi/2 radians (-90 to 90 degrees). If the argument is NaN, the
- * result is NaN; and the arctangent of 0 retains its sign. This is accurate
- * within 1 ulp, and is semi-monotonic.
- *
- * @param a the tan to turn back into an angle
- * @return arcsin(a)
- * @see #atan2(double, double)
- */
- public static double atan(double a) {
- return StrictMath.atan(a);
- }
-
- /**
- * A special version of the trigonometric function <em>arctan</em>, for
- * converting rectangular coordinates <em>(x, y)</em> to polar
- * <em>(r, theta)</em>. This computes the arctangent of x/y in the range
- * of -pi to pi radians (-180 to 180 degrees). Special cases:<ul>
- * <li>If either argument is NaN, the result is NaN.</li>
- * <li>If the first argument is positive zero and the second argument is
- * positive, or the first argument is positive and finite and the second
- * argument is positive infinity, then the result is positive zero.</li>
- * <li>If the first argument is negative zero and the second argument is
- * positive, or the first argument is negative and finite and the second
- * argument is positive infinity, then the result is negative zero.</li>
- * <li>If the first argument is positive zero and the second argument is
- * negative, or the first argument is positive and finite and the second
- * argument is negative infinity, then the result is the double value
- * closest to pi.</li>
- * <li>If the first argument is negative zero and the second argument is
- * negative, or the first argument is negative and finite and the second
- * argument is negative infinity, then the result is the double value
- * closest to -pi.</li>
- * <li>If the first argument is positive and the second argument is
- * positive zero or negative zero, or the first argument is positive
- * infinity and the second argument is finite, then the result is the
- * double value closest to pi/2.</li>
- * <li>If the first argument is negative and the second argument is
- * positive zero or negative zero, or the first argument is negative
- * infinity and the second argument is finite, then the result is the
- * double value closest to -pi/2.</li>
- * <li>If both arguments are positive infinity, then the result is the
- * double value closest to pi/4.</li>
- * <li>If the first argument is positive infinity and the second argument
- * is negative infinity, then the result is the double value closest to
- * 3*pi/4.</li>
- * <li>If the first argument is negative infinity and the second argument
- * is positive infinity, then the result is the double value closest to
- * -pi/4.</li>
- * <li>If both arguments are negative infinity, then the result is the
- * double value closest to -3*pi/4.</li>
- *
- * </ul><p>This is accurate within 2 ulps, and is semi-monotonic. To get r,
- * use sqrt(x*x+y*y).
- *
- * @param y the y position
- * @param x the x position
- * @return <em>theta</em> in the conversion of (x, y) to (r, theta)
- * @see #atan(double)
- */
- public static double atan2(double y, double x) {
- return StrictMath.atan2(y, x);
- }
-
- /**
- * Take <em>e</em><sup>a</sup>. The opposite of <code>log()</code>. If the
- * argument is NaN, the result is NaN; if the argument is positive infinity,
- * the result is positive infinity; and if the argument is negative
- * infinity, the result is positive zero. This is accurate within 1 ulp,
- * and is semi-monotonic.
- *
- * @param a the number to raise to the power
- * @return the number raised to the power of <em>e</em>
- * @see #log(double)
- * @see #pow(double, double)
- */
- public static double exp(double a) {
- return StrictMath.exp(a);
- }
-
- /**
- * Take ln(a) (the natural log). The opposite of <code>exp()</code>. If the
- * argument is NaN or negative, the result is NaN; if the argument is
- * positive infinity, the result is positive infinity; and if the argument
- * is either zero, the result is negative infinity. This is accurate within
- * 1 ulp, and is semi-monotonic.
- *
- * <p>Note that the way to get log<sub>b</sub>(a) is to do this:
- * <code>ln(a) / ln(b)</code>.
- *
- * @param a the number to take the natural log of
- * @return the natural log of <code>a</code>
- * @see #exp(double)
- */
- public static double log(double a) {
- return StrictMath.log(a);
- }
-
- /**
- * Take a square root. If the argument is NaN or negative, the result is
- * NaN; if the argument is positive infinity, the result is positive
- * infinity; and if the result is either zero, the result is the same.
- * This is accurate within the limits of doubles.
- *
- * <p>For other roots, use pow(a, 1 / rootNumber).
- *
- * @param a the numeric argument
- * @return the square root of the argument
- * @see #pow(double, double)
- */
- public static double sqrt(double a) {
- return StrictMath.sqrt(a);
- }
-
- /**
- * Raise a number to a power. Special cases:<ul>
- * <li>If the second argument is...
[truncated message content] |
|
From: <fd...@us...> - 2009-01-17 21:25:55
|
Revision: 4881
http://jnode.svn.sourceforge.net/jnode/?rev=4881&view=rev
Author: fduminy
Date: 2009-01-17 21:25:50 +0000 (Sat, 17 Jan 2009)
Log Message:
-----------
- bug fix from Peter Barth (StackException in floating point computations)
- added test for the above bug
Modified Paths:
--------------
trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java
Added Paths:
-----------
trunk/core/src/test/org/jnode/test/TestFPStackException.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 2009-01-17 19:11:28 UTC (rev 4880)
+++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java 2009-01-17 21:25:50 UTC (rev 4881)
@@ -1,5 +1,4 @@
/*
- * $Id$
*
* JNode.org
* Copyright (C) 2003-2006 JNode.org
@@ -23,7 +22,6 @@
import java.util.HashMap;
import java.util.Map;
-
import org.jnode.assembler.Label;
import org.jnode.assembler.NativeStream;
import org.jnode.assembler.x86.X86Assembler;
@@ -1937,7 +1935,7 @@
if (isfloat) {
result = ifac.createFPUStack(JvmType.FLOAT);
os.writeFLD32(refr, fieldOffset);
- vstack.fpuStack.push(result);
+ pushFloat(result);
} else {
final char fieldType = field.getSignature().charAt(0);
final WordItem iw = L1AHelper.requestWordRegister(eContext,
@@ -1970,7 +1968,7 @@
if (isfloat) {
result = ifac.createFPUStack(JvmType.DOUBLE);
os.writeFLD64(refr, fieldOffset);
- vstack.fpuStack.push(result);
+ pushFloat(result);
} else {
final DoubleWordItem idw = L1AHelper
.requestDoubleWordRegisters(eContext, type);
@@ -2022,7 +2020,7 @@
L1AHelper.releaseRegister(eContext, tmp);
}
final Item result = ifac.createFPUStack(type);
- vstack.fpuStack.push(result);
+ pushFloat(result);
vstack.push(result);
} else if (!fieldRef.isWide()) {
final WordItem result = L1AHelper.requestWordRegister(eContext,
@@ -4550,4 +4548,13 @@
}
return _curInstrLabel;
}
+
+ private void pushFloat(Item floatItem) {
+ // TODO should we do the same check for all calls to vstack.fpuStack.push(Item) ?
+ if (!vstack.fpuStack.hasCapacity(1)) {
+ vstack.push(eContext);
+ }
+
+ vstack.fpuStack.push(floatItem);
+ }
}
Added: trunk/core/src/test/org/jnode/test/TestFPStackException.java
===================================================================
--- trunk/core/src/test/org/jnode/test/TestFPStackException.java (rev 0)
+++ trunk/core/src/test/org/jnode/test/TestFPStackException.java 2009-01-17 21:25:50 UTC (rev 4881)
@@ -0,0 +1,58 @@
+package org.jnode.test;
+
+public class TestFPStackException {
+ public static void main(String[] args) {
+ System.out.println("creating instances");
+ Matrix m = new Matrix(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0);
+ Matrix m2 = new Matrix(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0);
+
+ System.out.println("calling times(...)");
+
+ // without bug fix, here the jnode compiler will fail with a org.jnode.vm.bytecode.StackException
+ Matrix m3 = m.times(m2);
+
+ System.out.println("end");
+ }
+
+ private static class Matrix {
+ private double m11, m12, m13, m14;
+ private double m21, m22, m23, m24;
+ private double m31, m32, m33, m34;
+ private double m41, m42, m43, m44;
+
+ public Matrix(double e11, double e12, double e13, double e14, double e21, double e22, double e23,
+ double e24, double e31, double e32, double e33, double e34, double e41, double e42,
+ double e43, double e44) {
+ m11 = e11;
+ m12 = e12;
+ m13 = e13;
+ m14 = e14;
+ m21 = e21;
+ m22 = e22;
+ m23 = e23;
+ m24 = e24;
+ m31 = e31;
+ m32 = e32;
+ m33 = e33;
+ m34 = e34;
+ m41 = e41;
+ m42 = e42;
+ m43 = e43;
+ m44 = e44;
+ }
+
+ public final Matrix times(Matrix a) {
+ return new Matrix(m11 * a.m11 + m12 * a.m21 + m13 * a.m31 + m14 * a.m41, m11 * a.m12 + m12 *
+ a.m22 + m13 * a.m32 + m14 * a.m42, m11 * a.m13 + m12 * a.m23 + m13 * a.m33 + m14 *
+ a.m43, m11 * a.m14 + m12 * a.m24 + m13 * a.m34 + m14 * a.m44, m21 * a.m11 + m22 *
+ a.m21 + m23 * a.m31 + m24 * a.m41, m21 * a.m12 + m22 * a.m22 + m23 * a.m32 + m24 *
+ a.m42, m21 * a.m13 + m22 * a.m23 + m23 * a.m33 + m24 * a.m43, m21 * a.m14 + m22 *
+ a.m24 + m23 * a.m34 + m24 * a.m44, m31 * a.m11 + m32 * a.m21 + m33 * a.m31 + m34 *
+ a.m41, m31 * a.m12 + m32 * a.m22 + m33 * a.m32 + m34 * a.m42, m31 * a.m13 + m32 *
+ a.m23 + m33 * a.m33 + m34 * a.m43, m31 * a.m14 + m32 * a.m24 + m33 * a.m34 + m34 *
+ a.m44, m41 * a.m11 + m42 * a.m21 + m43 * a.m31 + m44 * a.m41, m41 * a.m12 + m42 *
+ a.m22 + m43 * a.m32 + m44 * a.m42, m41 * a.m13 + m42 * a.m23 + m43 * a.m33 + m44 *
+ a.m43, m41 * a.m14 + m42 * a.m24 + m43 * a.m34 + m44 * a.m44);
+ }
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2009-02-01 20:10:23
|
Revision: 4960
http://jnode.svn.sourceforge.net/jnode/?rev=4960&view=rev
Author: lsantha
Date: 2009-02-01 20:10:09 +0000 (Sun, 01 Feb 2009)
Log Message:
-----------
Fixed headers.
Modified Paths:
--------------
trunk/core/src/classpath/ext/java/nio/channels/LinkChannel.java
trunk/core/src/classpath/ext/java/util/prefs/TransientPreferences.java
trunk/core/src/classpath/ext/javax/cache/Cache.java
trunk/core/src/classpath/ext/javax/cache/CacheEntry.java
trunk/core/src/classpath/ext/javax/cache/CacheException.java
trunk/core/src/classpath/ext/javax/cache/CacheFactory.java
trunk/core/src/classpath/ext/javax/cache/CacheListener.java
trunk/core/src/classpath/ext/javax/cache/CacheLoader.java
trunk/core/src/classpath/ext/javax/cache/CacheManager.java
trunk/core/src/classpath/ext/javax/cache/CacheStatistics.java
trunk/core/src/classpath/ext/javax/cache/EvictionStrategy.java
trunk/core/src/classpath/ext/javax/isolate/AbstractLinkMessageHandler.java
trunk/core/src/classpath/ext/javax/isolate/ClosedLinkException.java
trunk/core/src/classpath/ext/javax/isolate/Isolate.java
trunk/core/src/classpath/ext/javax/isolate/IsolatePermission.java
trunk/core/src/classpath/ext/javax/isolate/IsolateStartupException.java
trunk/core/src/classpath/ext/javax/isolate/IsolateStatus.java
trunk/core/src/classpath/ext/javax/isolate/Link.java
trunk/core/src/classpath/ext/javax/isolate/LinkMessage.java
trunk/core/src/classpath/ext/javax/isolate/LinkMessageDispatcher.java
trunk/core/src/classpath/ext/javax/isolate/LinkMessageHandler.java
trunk/core/src/classpath/ext/javax/isolate/StreamBindings.java
trunk/core/src/classpath/vm/gnu/classpath/Configuration.java
trunk/core/src/classpath/vm/gnu/classpath/VMStackWalker.java
trunk/core/src/classpath/vm/gnu/classpath/VMSystemProperties.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/JNodeSocketTransport.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/NativeVMFrame.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/NativeVMMethod.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/NativeVMVirtualMachine.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMFrame.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMIdManager.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMMethod.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMVirtualMachine.java
trunk/core/src/classpath/vm/gnu/java/lang/VMClassHelper.java
trunk/core/src/classpath/vm/gnu/java/lang/VMInstrumentationImpl.java
trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java
trunk/core/src/classpath/vm/gnu/java/nio/VMPipe.java
trunk/core/src/classpath/vm/gnu/java/nio/VMSelector.java
trunk/core/src/classpath/vm/gnu/java/security/action/GetPolicyAction.java
trunk/core/src/classpath/vm/gnu/java/security/action/GetPropertiesAction.java
trunk/core/src/classpath/vm/gnu/java/security/action/InvokeAction.java
trunk/core/src/classpath/vm/gnu/java/security/action/SetPropertyAction.java
trunk/core/src/classpath/vm/gnu/java/security/util/SimplePermissionCollection.java
trunk/core/src/classpath/vm/java/awt/VMAwtAPI.java
trunk/core/src/classpath/vm/java/awt/image/VMImageAPI.java
trunk/core/src/classpath/vm/java/awt/image/VMImageUtils.java
trunk/core/src/classpath/vm/java/io/VMFile.java
trunk/core/src/classpath/vm/java/io/VMFileSystemAPI.java
trunk/core/src/classpath/vm/java/io/VMIOUtils.java
trunk/core/src/classpath/vm/java/io/VMObjectInputStream.java
trunk/core/src/classpath/vm/java/io/VMObjectStreamClass.java
trunk/core/src/classpath/vm/java/io/VMOpenMode.java
trunk/core/src/classpath/vm/java/lang/ClassLoader.java
trunk/core/src/classpath/vm/java/lang/Thread.java
trunk/core/src/classpath/vm/java/lang/VMClassLoader.java
trunk/core/src/classpath/vm/java/lang/VMProcess.java
trunk/core/src/classpath/vm/java/lang/VMRuntime.java
trunk/core/src/classpath/vm/java/lang/VMSecurityManager.java
trunk/core/src/classpath/vm/java/lang/VMSystem.java
trunk/core/src/classpath/vm/java/net/ExSocketOptions.java
trunk/core/src/classpath/vm/java/net/VMInetAddress.java
trunk/core/src/classpath/vm/java/net/VMNetAPI.java
trunk/core/src/classpath/vm/java/net/VMNetAny.java
trunk/core/src/classpath/vm/java/net/VMNetDevice.java
trunk/core/src/classpath/vm/java/net/VMNetUtils.java
trunk/core/src/classpath/vm/java/net/VMNetworkInterface.java
trunk/core/src/classpath/vm/java/net/VMURLConnection.java
trunk/core/src/classpath/vm/java/nio/VMDirectByteBuffer.java
trunk/core/src/classpath/vm/java/nio/channels/VMChannels.java
trunk/core/src/classpath/vm/java/security/VMSecureRandom.java
trunk/core/src/classpath/vm/org/jnode/java/io/VMFileHandle.java
trunk/core/src/core/org/jnode/assembler/BootImageNativeStream.java
trunk/core/src/core/org/jnode/assembler/Label.java
trunk/core/src/core/org/jnode/assembler/NativeStream.java
trunk/core/src/core/org/jnode/assembler/ObjectResolver.java
trunk/core/src/core/org/jnode/assembler/UnresolvedObjectRefException.java
trunk/core/src/core/org/jnode/assembler/x86/InvalidOpcodeException.java
trunk/core/src/core/org/jnode/assembler/x86/X86Assembler.java
trunk/core/src/core/org/jnode/assembler/x86/X86BinaryAssembler.java
trunk/core/src/core/org/jnode/assembler/x86/X86Constants.java
trunk/core/src/core/org/jnode/assembler/x86/X86Operation.java
trunk/core/src/core/org/jnode/assembler/x86/X86Register.java
trunk/core/src/core/org/jnode/assembler/x86/X86TextAssembler.java
trunk/core/src/core/org/jnode/assembler/x86/X86Utils.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/boot/MemoryResourceInputStream.java
trunk/core/src/core/org/jnode/boot/NoCloseInputStream.java
trunk/core/src/core/org/jnode/debug/RemoteAppender.java
trunk/core/src/core/org/jnode/debug/RemoteReceiver.java
trunk/core/src/core/org/jnode/debug/UDPOutputStream.java
trunk/core/src/core/org/jnode/debugger/DebugState.java
trunk/core/src/core/org/jnode/debugger/Debugger.java
trunk/core/src/core/org/jnode/debugger/DebuggerPlugin.java
trunk/core/src/core/org/jnode/debugger/DebuggerUtils.java
trunk/core/src/core/org/jnode/debugger/RootState.java
trunk/core/src/core/org/jnode/debugger/ThreadListState.java
trunk/core/src/core/org/jnode/debugger/ThreadState.java
trunk/core/src/core/org/jnode/imageio/jpeg/JPEGDecoder.java
trunk/core/src/core/org/jnode/imageio/jpeg/JPEGDecoderAdapter.java
trunk/core/src/core/org/jnode/imageio/jpeg/JPEGException.java
trunk/core/src/core/org/jnode/imageio/jpeg/JPEGImageReader.java
trunk/core/src/core/org/jnode/imageio/jpeg/JPEGImageReaderSpi.java
trunk/core/src/core/org/jnode/log4j/config/JNodeSystemAppender.java
trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java
trunk/core/src/core/org/jnode/log4j/config/UnsafeDebugAppender.java
trunk/core/src/core/org/jnode/log4j/config/VirtualConsoleAppender.java
trunk/core/src/core/org/jnode/naming/AbstractNameSpace.java
trunk/core/src/core/org/jnode/naming/DefaultNameSpace.java
trunk/core/src/core/org/jnode/naming/InitialNaming.java
trunk/core/src/core/org/jnode/naming/NameSpace.java
trunk/core/src/core/org/jnode/naming/NameSpaceListener.java
trunk/core/src/core/org/jnode/plugin/AutoUnzipPlugin.java
trunk/core/src/core/org/jnode/plugin/ConfigurationElement.java
trunk/core/src/core/org/jnode/plugin/Extension.java
trunk/core/src/core/org/jnode/plugin/ExtensionPoint.java
trunk/core/src/core/org/jnode/plugin/ExtensionPointListener.java
trunk/core/src/core/org/jnode/plugin/FragmentDescriptor.java
trunk/core/src/core/org/jnode/plugin/Library.java
trunk/core/src/core/org/jnode/plugin/Plugin.java
trunk/core/src/core/org/jnode/plugin/PluginClassLoader.java
trunk/core/src/core/org/jnode/plugin/PluginDescriptor.java
trunk/core/src/core/org/jnode/plugin/PluginDescriptorListener.java
trunk/core/src/core/org/jnode/plugin/PluginException.java
trunk/core/src/core/org/jnode/plugin/PluginLoader.java
trunk/core/src/core/org/jnode/plugin/PluginLoaderManager.java
trunk/core/src/core/org/jnode/plugin/PluginManager.java
trunk/core/src/core/org/jnode/plugin/PluginPrerequisite.java
trunk/core/src/core/org/jnode/plugin/PluginReference.java
trunk/core/src/core/org/jnode/plugin/PluginRegistry.java
trunk/core/src/core/org/jnode/plugin/PluginSecurityConstants.java
trunk/core/src/core/org/jnode/plugin/PluginUtils.java
trunk/core/src/core/org/jnode/plugin/Runtime.java
trunk/core/src/core/org/jnode/plugin/URLPluginLoader.java
trunk/core/src/core/org/jnode/plugin/manager/DefaultPluginLoaderManager.java
trunk/core/src/core/org/jnode/plugin/manager/DefaultPluginManager.java
trunk/core/src/core/org/jnode/plugin/model/AbstractModelObject.java
trunk/core/src/core/org/jnode/plugin/model/AttributeModel.java
trunk/core/src/core/org/jnode/plugin/model/ConfigurationElementModel.java
trunk/core/src/core/org/jnode/plugin/model/EmptyPlugin.java
trunk/core/src/core/org/jnode/plugin/model/ExtensionModel.java
trunk/core/src/core/org/jnode/plugin/model/ExtensionPointModel.java
trunk/core/src/core/org/jnode/plugin/model/Factory.java
trunk/core/src/core/org/jnode/plugin/model/FragmentDescriptorModel.java
trunk/core/src/core/org/jnode/plugin/model/LibraryModel.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/plugin/model/PluginJar.java
trunk/core/src/core/org/jnode/plugin/model/PluginModelObject.java
trunk/core/src/core/org/jnode/plugin/model/PluginPrerequisiteModel.java
trunk/core/src/core/org/jnode/plugin/model/PluginRegistryModel.java
trunk/core/src/core/org/jnode/plugin/model/PluginsClassLoader.java
trunk/core/src/core/org/jnode/plugin/model/RuntimeModel.java
trunk/core/src/core/org/jnode/protocol/ProtocolHandlerFactoryPlugin.java
trunk/core/src/core/org/jnode/protocol/plugin/Handler.java
trunk/core/src/core/org/jnode/protocol/plugin/PluginURLConnection.java
trunk/core/src/core/org/jnode/protocol/system/Handler.java
trunk/core/src/core/org/jnode/protocol/system/SystemURLConnection.java
trunk/core/src/core/org/jnode/security/JNodePermission.java
trunk/core/src/core/org/jnode/security/JNodePolicy.java
trunk/core/src/core/org/jnode/security/JNodeSecurityManager.java
trunk/core/src/core/org/jnode/security/SecurityPlugin.java
trunk/core/src/core/org/jnode/system/BootLog.java
trunk/core/src/core/org/jnode/system/DMAException.java
trunk/core/src/core/org/jnode/system/DMAManager.java
trunk/core/src/core/org/jnode/system/DMAResource.java
trunk/core/src/core/org/jnode/system/IOResource.java
trunk/core/src/core/org/jnode/system/IRQHandler.java
trunk/core/src/core/org/jnode/system/IRQResource.java
trunk/core/src/core/org/jnode/system/MemoryResource.java
trunk/core/src/core/org/jnode/system/MemoryScanner.java
trunk/core/src/core/org/jnode/system/MultiMediaMemoryResource.java
trunk/core/src/core/org/jnode/system/Resource.java
trunk/core/src/core/org/jnode/system/ResourceManager.java
trunk/core/src/core/org/jnode/system/ResourceNotFreeException.java
trunk/core/src/core/org/jnode/system/ResourceOwner.java
trunk/core/src/core/org/jnode/system/ResourcePermission.java
trunk/core/src/core/org/jnode/system/SimpleResourceOwner.java
trunk/core/src/core/org/jnode/system/event/FocusEvent.java
trunk/core/src/core/org/jnode/system/event/FocusListener.java
trunk/core/src/core/org/jnode/system/event/SystemEvent.java
trunk/core/src/core/org/jnode/system/repository/Repository.java
trunk/core/src/core/org/jnode/system/repository/RepositoryPlugin.java
trunk/core/src/core/org/jnode/system/repository/RepositoryPluginLoader.java
trunk/core/src/core/org/jnode/system/repository/SystemRepository.java
trunk/core/src/core/org/jnode/system/repository/SystemRepositoryPlugin.java
trunk/core/src/core/org/jnode/system/repository/plugins/PluginLoaderPlugin.java
trunk/core/src/core/org/jnode/system/repository/spi/SystemRepositoryProvider.java
trunk/core/src/core/org/jnode/system/x86/DMA.java
trunk/core/src/core/org/jnode/system/x86/DMAConstants.java
trunk/core/src/core/org/jnode/system/x86/DMAPlugin.java
trunk/core/src/core/org/jnode/system/x86/X86DMAChannel.java
trunk/core/src/core/org/jnode/util/AccessControllerUtils.java
trunk/core/src/core/org/jnode/util/BCDUtils.java
trunk/core/src/core/org/jnode/util/BeanUtils.java
trunk/core/src/core/org/jnode/util/BigEndian.java
trunk/core/src/core/org/jnode/util/BinaryScaleFactor.java
trunk/core/src/core/org/jnode/util/BooleanUtils.java
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/ByteBufferInputStream.java
trunk/core/src/core/org/jnode/util/ByteBufferUtils.java
trunk/core/src/core/org/jnode/util/ByteQueue.java
trunk/core/src/core/org/jnode/util/ByteQueueProcessor.java
trunk/core/src/core/org/jnode/util/ByteQueueProcessorThread.java
trunk/core/src/core/org/jnode/util/ChannelInputStream.java
trunk/core/src/core/org/jnode/util/ChannelOutputStream.java
trunk/core/src/core/org/jnode/util/Command.java
trunk/core/src/core/org/jnode/util/ConsoleStream.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/DecimalScaleFactor.java
trunk/core/src/core/org/jnode/util/EmptyInputStream.java
trunk/core/src/core/org/jnode/util/FileUtils.java
trunk/core/src/core/org/jnode/util/IOUtils.java
trunk/core/src/core/org/jnode/util/JarBuffer.java
trunk/core/src/core/org/jnode/util/JarConstants.java
trunk/core/src/core/org/jnode/util/LittleEndian.java
trunk/core/src/core/org/jnode/util/NumberUtils.java
trunk/core/src/core/org/jnode/util/ObjectArrayIterator.java
trunk/core/src/core/org/jnode/util/ObjectUtils.java
trunk/core/src/core/org/jnode/util/OsUtils.java
trunk/core/src/core/org/jnode/util/ProxyStream.java
trunk/core/src/core/org/jnode/util/ProxyStreamException.java
trunk/core/src/core/org/jnode/util/Queue.java
trunk/core/src/core/org/jnode/util/QueueProcessor.java
trunk/core/src/core/org/jnode/util/QueueProcessorThread.java
trunk/core/src/core/org/jnode/util/ReaderInputStream.java
trunk/core/src/core/org/jnode/util/ScaleFactor.java
trunk/core/src/core/org/jnode/util/SizeUnit.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/StopWatch.java
trunk/core/src/core/org/jnode/util/SynchronizedCounter.java
trunk/core/src/core/org/jnode/util/SystemInputStream.java
trunk/core/src/core/org/jnode/util/TimeUtils.java
trunk/core/src/core/org/jnode/util/TimeoutException.java
trunk/core/src/core/org/jnode/util/Token.java
trunk/core/src/core/org/jnode/util/WriterOutputStream.java
trunk/core/src/core/org/jnode/vm/AllocationBitmap.java
trunk/core/src/core/org/jnode/vm/BootableObject.java
trunk/core/src/core/org/jnode/vm/CpuID.java
trunk/core/src/core/org/jnode/vm/HeapHelperImpl.java
trunk/core/src/core/org/jnode/vm/IOContext.java
trunk/core/src/core/org/jnode/vm/IOResourceImpl.java
trunk/core/src/core/org/jnode/vm/JvmType.java
trunk/core/src/core/org/jnode/vm/LoadCompileService.java
trunk/core/src/core/org/jnode/vm/LoadCompileThread.java
trunk/core/src/core/org/jnode/vm/MathSupport.java
trunk/core/src/core/org/jnode/vm/MemoryBlockManager.java
trunk/core/src/core/org/jnode/vm/MemoryMapEntry.java
trunk/core/src/core/org/jnode/vm/MemoryResourceImpl.java
trunk/core/src/core/org/jnode/vm/MemoryScannerImpl.java
trunk/core/src/core/org/jnode/vm/MultiMediaMemoryResourceImpl.java
trunk/core/src/core/org/jnode/vm/ObjectVisitor.java
trunk/core/src/core/org/jnode/vm/RTCService.java
trunk/core/src/core/org/jnode/vm/Region.java
trunk/core/src/core/org/jnode/vm/ResourceLoader.java
trunk/core/src/core/org/jnode/vm/ResourceManagerImpl.java
trunk/core/src/core/org/jnode/vm/SoftByteCodes.java
trunk/core/src/core/org/jnode/vm/Unsafe.java
trunk/core/src/core/org/jnode/vm/VirtualMemoryRegion.java
trunk/core/src/core/org/jnode/vm/Vm.java
trunk/core/src/core/org/jnode/vm/VmAbstractClassLoader.java
trunk/core/src/core/org/jnode/vm/VmAccessControlContext.java
trunk/core/src/core/org/jnode/vm/VmAccessController.java
trunk/core/src/core/org/jnode/vm/VmAddress.java
trunk/core/src/core/org/jnode/vm/VmArchitecture.java
trunk/core/src/core/org/jnode/vm/VmChannel.java
trunk/core/src/core/org/jnode/vm/VmExit.java
trunk/core/src/core/org/jnode/vm/VmIOContext.java
trunk/core/src/core/org/jnode/vm/VmJavaClassLoader.java
trunk/core/src/core/org/jnode/vm/VmJavaMultiMediaSupport.java
trunk/core/src/core/org/jnode/vm/VmMagic.java
trunk/core/src/core/org/jnode/vm/VmMultiMediaSupport.java
trunk/core/src/core/org/jnode/vm/VmProcess.java
trunk/core/src/core/org/jnode/vm/VmProcessClassLoader.java
trunk/core/src/core/org/jnode/vm/VmReflection.java
trunk/core/src/core/org/jnode/vm/VmStackFrame.java
trunk/core/src/core/org/jnode/vm/VmStackFrameEnumerator.java
trunk/core/src/core/org/jnode/vm/VmStackReader.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/VmSystemObject.java
trunk/core/src/core/org/jnode/vm/VmUtils.java
trunk/core/src/core/org/jnode/vm/annotation/AllowedPackages.java
trunk/core/src/core/org/jnode/vm/annotation/CheckPermission.java
trunk/core/src/core/org/jnode/vm/annotation/DoPrivileged.java
trunk/core/src/core/org/jnode/vm/annotation/Inline.java
trunk/core/src/core/org/jnode/vm/annotation/Internal.java
trunk/core/src/core/org/jnode/vm/annotation/KernelSpace.java
trunk/core/src/core/org/jnode/vm/annotation/LoadStatics.java
trunk/core/src/core/org/jnode/vm/annotation/MagicPermission.java
trunk/core/src/core/org/jnode/vm/annotation/NoFieldAlignments.java
trunk/core/src/core/org/jnode/vm/annotation/NoInline.java
trunk/core/src/core/org/jnode/vm/annotation/NoReadBarrier.java
trunk/core/src/core/org/jnode/vm/annotation/NoWriteBarrier.java
trunk/core/src/core/org/jnode/vm/annotation/PrivilegedActionPragma.java
trunk/core/src/core/org/jnode/vm/annotation/SharedStatics.java
trunk/core/src/core/org/jnode/vm/annotation/Uninterruptible.java
trunk/core/src/core/org/jnode/vm/bytecode/BasicBlock.java
trunk/core/src/core/org/jnode/vm/bytecode/BasicBlockFinder.java
trunk/core/src/core/org/jnode/vm/bytecode/BytecodeFlags.java
trunk/core/src/core/org/jnode/vm/bytecode/BytecodeParser.java
trunk/core/src/core/org/jnode/vm/bytecode/BytecodeViewer.java
trunk/core/src/core/org/jnode/vm/bytecode/BytecodeVisitor.java
trunk/core/src/core/org/jnode/vm/bytecode/BytecodeVisitorSupport.java
trunk/core/src/core/org/jnode/vm/bytecode/BytecodeWriter.java
trunk/core/src/core/org/jnode/vm/bytecode/ControlFlowGraph.java
trunk/core/src/core/org/jnode/vm/bytecode/DelegatingBytecodeVisitor.java
trunk/core/src/core/org/jnode/vm/bytecode/StackException.java
trunk/core/src/core/org/jnode/vm/bytecode/TypeStack.java
trunk/core/src/core/org/jnode/vm/classmgr/AbstractCode.java
trunk/core/src/core/org/jnode/vm/classmgr/AbstractExceptionHandler.java
trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java
trunk/core/src/core/org/jnode/vm/classmgr/CompiledCodeList.java
trunk/core/src/core/org/jnode/vm/classmgr/IMTBuilder.java
trunk/core/src/core/org/jnode/vm/classmgr/MethodPragmaFlags.java
trunk/core/src/core/org/jnode/vm/classmgr/Modifier.java
trunk/core/src/core/org/jnode/vm/classmgr/NotResolvedYetException.java
trunk/core/src/core/org/jnode/vm/classmgr/ObjectFlags.java
trunk/core/src/core/org/jnode/vm/classmgr/ObjectLayout.java
trunk/core/src/core/org/jnode/vm/classmgr/SelectorMap.java
trunk/core/src/core/org/jnode/vm/classmgr/Signature.java
trunk/core/src/core/org/jnode/vm/classmgr/TIBBuilder.java
trunk/core/src/core/org/jnode/vm/classmgr/TIBLayout.java
trunk/core/src/core/org/jnode/vm/classmgr/TypePragmaFlags.java
trunk/core/src/core/org/jnode/vm/classmgr/TypeSizeInfo.java
trunk/core/src/core/org/jnode/vm/classmgr/VmAddressMap.java
trunk/core/src/core/org/jnode/vm/classmgr/VmAnnotatedElement.java
trunk/core/src/core/org/jnode/vm/classmgr/VmAnnotation.java
trunk/core/src/core/org/jnode/vm/classmgr/VmArray.java
trunk/core/src/core/org/jnode/vm/classmgr/VmArrayClass.java
trunk/core/src/core/org/jnode/vm/classmgr/VmByteCode.java
trunk/core/src/core/org/jnode/vm/classmgr/VmCP.java
trunk/core/src/core/org/jnode/vm/classmgr/VmClassLoader.java
trunk/core/src/core/org/jnode/vm/classmgr/VmClassType.java
trunk/core/src/core/org/jnode/vm/classmgr/VmCompiledCode.java
trunk/core/src/core/org/jnode/vm/classmgr/VmCompiledExceptionHandler.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstClass.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstDouble.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstFieldRef.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstFloat.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstIMethodRef.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstInt.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstLong.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstMemberRef.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstMethodRef.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstObject.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstString.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstantPool.java
trunk/core/src/core/org/jnode/vm/classmgr/VmExceptions.java
trunk/core/src/core/org/jnode/vm/classmgr/VmField.java
trunk/core/src/core/org/jnode/vm/classmgr/VmImplementedInterface.java
trunk/core/src/core/org/jnode/vm/classmgr/VmInstanceField.java
trunk/core/src/core/org/jnode/vm/classmgr/VmInstanceMethod.java
trunk/core/src/core/org/jnode/vm/classmgr/VmInterfaceClass.java
trunk/core/src/core/org/jnode/vm/classmgr/VmInterpretedExceptionHandler.java
trunk/core/src/core/org/jnode/vm/classmgr/VmIsolatedStatics.java
trunk/core/src/core/org/jnode/vm/classmgr/VmIsolatedStaticsEntry.java
trunk/core/src/core/org/jnode/vm/classmgr/VmLineNumberMap.java
trunk/core/src/core/org/jnode/vm/classmgr/VmLocalVariable.java
trunk/core/src/core/org/jnode/vm/classmgr/VmLocalVariableTable.java
trunk/core/src/core/org/jnode/vm/classmgr/VmMember.java
trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java
trunk/core/src/core/org/jnode/vm/classmgr/VmMethodCode.java
trunk/core/src/core/org/jnode/vm/classmgr/VmNormalClass.java
trunk/core/src/core/org/jnode/vm/classmgr/VmObject.java
trunk/core/src/core/org/jnode/vm/classmgr/VmPrimitiveClass.java
trunk/core/src/core/org/jnode/vm/classmgr/VmResolvableConstObject.java
trunk/core/src/core/org/jnode/vm/classmgr/VmSharedStatics.java
trunk/core/src/core/org/jnode/vm/classmgr/VmSharedStaticsEntry.java
trunk/core/src/core/org/jnode/vm/classmgr/VmSpecialMethod.java
trunk/core/src/core/org/jnode/vm/classmgr/VmStaticField.java
trunk/core/src/core/org/jnode/vm/classmgr/VmStaticMethod.java
trunk/core/src/core/org/jnode/vm/classmgr/VmStatics.java
trunk/core/src/core/org/jnode/vm/classmgr/VmStaticsAllocator.java
trunk/core/src/core/org/jnode/vm/classmgr/VmStaticsBase.java
trunk/core/src/core/org/jnode/vm/classmgr/VmStaticsIterator.java
trunk/core/src/core/org/jnode/vm/classmgr/VmType.java
trunk/core/src/core/org/jnode/vm/classmgr/VmTypeState.java
trunk/core/src/core/org/jnode/vm/classmgr/VmUTF8Convert.java
trunk/core/src/core/org/jnode/vm/compiler/BaseMagicHelper.java
trunk/core/src/core/org/jnode/vm/compiler/CompileError.java
trunk/core/src/core/org/jnode/vm/compiler/CompiledExceptionHandler.java
trunk/core/src/core/org/jnode/vm/compiler/CompiledIMT.java
trunk/core/src/core/org/jnode/vm/compiler/CompiledMethod.java
trunk/core/src/core/org/jnode/vm/compiler/CompilerBytecodeParser.java
trunk/core/src/core/org/jnode/vm/compiler/CompilerBytecodeViewer.java
trunk/core/src/core/org/jnode/vm/compiler/CompilerBytecodeVisitor.java
trunk/core/src/core/org/jnode/vm/compiler/DelegatingCompilerBytecodeVisitor.java
trunk/core/src/core/org/jnode/vm/compiler/EntryPoints.java
trunk/core/src/core/org/jnode/vm/compiler/GCMapIterator.java
trunk/core/src/core/org/jnode/vm/compiler/IMTCompiler.java
trunk/core/src/core/org/jnode/vm/compiler/IllegalModeException.java
trunk/core/src/core/org/jnode/vm/compiler/InlineBytecodeVisitor.java
trunk/core/src/core/org/jnode/vm/compiler/NativeCodeCompiler.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/compiler/ir/AddressingMode.java
trunk/core/src/core/org/jnode/vm/compiler/ir/CodeGenerator.java
trunk/core/src/core/org/jnode/vm/compiler/ir/Constant.java
trunk/core/src/core/org/jnode/vm/compiler/ir/DoubleConstant.java
trunk/core/src/core/org/jnode/vm/compiler/ir/FloatConstant.java
trunk/core/src/core/org/jnode/vm/compiler/ir/IRBasicBlock.java
trunk/core/src/core/org/jnode/vm/compiler/ir/IRBasicBlockFinder.java
trunk/core/src/core/org/jnode/vm/compiler/ir/IRControlFlowGraph.java
trunk/core/src/core/org/jnode/vm/compiler/ir/IRGenerator.java
trunk/core/src/core/org/jnode/vm/compiler/ir/IRTest.java
trunk/core/src/core/org/jnode/vm/compiler/ir/IntConstant.java
trunk/core/src/core/org/jnode/vm/compiler/ir/LinearScanAllocator.java
trunk/core/src/core/org/jnode/vm/compiler/ir/LiveRange.java
trunk/core/src/core/org/jnode/vm/compiler/ir/LocalVariable.java
trunk/core/src/core/org/jnode/vm/compiler/ir/Location.java
trunk/core/src/core/org/jnode/vm/compiler/ir/LongConstant.java
trunk/core/src/core/org/jnode/vm/compiler/ir/MethodArgument.java
trunk/core/src/core/org/jnode/vm/compiler/ir/NativeTest.java
trunk/core/src/core/org/jnode/vm/compiler/ir/Operand.java
trunk/core/src/core/org/jnode/vm/compiler/ir/PhiOperand.java
trunk/core/src/core/org/jnode/vm/compiler/ir/PrimitiveTest.java
trunk/core/src/core/org/jnode/vm/compiler/ir/ReferenceConstant.java
trunk/core/src/core/org/jnode/vm/compiler/ir/RegisterLocation.java
trunk/core/src/core/org/jnode/vm/compiler/ir/RegisterPool.java
trunk/core/src/core/org/jnode/vm/compiler/ir/SSAStack.java
trunk/core/src/core/org/jnode/vm/compiler/ir/StackLocation.java
trunk/core/src/core/org/jnode/vm/compiler/ir/StackVariable.java
trunk/core/src/core/org/jnode/vm/compiler/ir/Variable.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/AssignQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/BinaryOperation.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/BinaryQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/BranchCondition.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/BranchQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/ConditionalBranchQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/ConstantRefAssignQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/PhiAssignQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/Quad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/UnaryOperation.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/UnaryQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/UnconditionalBranchQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/VarReturnQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/VariableRefAssignQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/VoidReturnQuad.java
trunk/core/src/core/org/jnode/vm/isolate/DataLinkMessage.java
trunk/core/src/core/org/jnode/vm/isolate/IsolateLinkMessage.java
trunk/core/src/core/org/jnode/vm/isolate/IsolateStatusImpl.java
trunk/core/src/core/org/jnode/vm/isolate/IsolateThread.java
trunk/core/src/core/org/jnode/vm/isolate/IsolateThreadFactory.java
trunk/core/src/core/org/jnode/vm/isolate/LinkImpl.java
trunk/core/src/core/org/jnode/vm/isolate/LinkLinkMessage.java
trunk/core/src/core/org/jnode/vm/isolate/LinkMessageFactory.java
trunk/core/src/core/org/jnode/vm/isolate/LinkMessageImpl.java
trunk/core/src/core/org/jnode/vm/isolate/ObjectLinkMessage.java
trunk/core/src/core/org/jnode/vm/isolate/StatusLinkMessage.java
trunk/core/src/core/org/jnode/vm/isolate/StringLinkMessage.java
trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
trunk/core/src/core/org/jnode/vm/isolate/VmIsolateLocal.java
trunk/core/src/core/org/jnode/vm/isolate/VmLink.java
trunk/core/src/core/org/jnode/vm/isolate/VmStreamBindings.java
trunk/core/src/core/org/jnode/vm/memmgr/GCStatistics.java
trunk/core/src/core/org/jnode/vm/memmgr/HeapHelper.java
trunk/core/src/core/org/jnode/vm/memmgr/HeapStatistics.java
trunk/core/src/core/org/jnode/vm/memmgr/VmHeapManager.java
trunk/core/src/core/org/jnode/vm/memmgr/VmWriteBarrier.java
trunk/core/src/core/org/jnode/vm/memmgr/def/DefGCStatistics.java
trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java
trunk/core/src/core/org/jnode/vm/memmgr/def/DefaultHeapManager.java
trunk/core/src/core...
[truncated message content] |
|
From: <kon...@us...> - 2009-02-02 00:10:26
|
Revision: 4968
http://jnode.svn.sourceforge.net/jnode/?rev=4968&view=rev
Author: konkubinaten
Date: 2009-02-02 00:10:20 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
revert headers of files that were accidentially modified
Modified Paths:
--------------
trunk/core/src/classpath/vm/gnu/classpath/VMStackWalker.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMFrame.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMIdManager.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMMethod.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMVirtualMachine.java
trunk/core/src/classpath/vm/gnu/java/lang/VMInstrumentationImpl.java
trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java
trunk/core/src/classpath/vm/java/lang/Thread.java
trunk/core/src/classpath/vm/java/lang/VMProcess.java
trunk/core/src/classpath/vm/java/lang/VMSystem.java
trunk/core/src/openjdk/vm/java/lang/NativeStrictMath.java
trunk/core/src/openjdk/vm/java/lang/ProcessEnvironment.java
trunk/core/src/openjdk/vm/java/lang/ProcessImpl.java
trunk/core/src/openjdk/vm/java/lang/Terminator.java
trunk/core/src/openjdk/vm/java/lang/UNIXProcess.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_be.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_bg.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_ca.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_cs.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_da.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_de.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_el.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_el_CY.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_en.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_en_GB.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_en_IE.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_en_MT.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_es.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_es_ES.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_es_US.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_et.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_fi.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_fr.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_fr_CA.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_hr.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_hu.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_in_ID.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_is.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_it.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_lt.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_lv.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_mk.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_ms_MY.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_mt.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_mt_MT.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_nl.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_no.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_pl.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_pt.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_pt_PT.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_ro.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_ru.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_sk.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_sl.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_sq.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_sr.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_sv.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_tr.java
trunk/core/src/openjdk/vm/sun/util/resources/CalendarData_uk.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_be_BY.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_bg_BG.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_ca_ES.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_cs_CZ.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_da_DK.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_de_AT.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_de_CH.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_de_DE.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_de_GR.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_de_LU.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_el_CY.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_el_GR.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_AU.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_CA.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_GB.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_IE.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_IN.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_MT.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_NZ.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_PH.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_SG.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_US.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_en_ZA.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_AR.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_BO.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_CL.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_CO.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_CR.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_DO.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_EC.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_ES.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_GT.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_HN.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_MX.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_NI.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_PA.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_PE.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_PR.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_PY.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_SV.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_US.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_UY.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_es_VE.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_et_EE.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_fi_FI.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_fr_BE.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_fr_CA.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_fr_CH.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_fr_FR.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_fr_LU.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_ga_IE.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_hr_HR.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_hu_HU.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_in_ID.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_is_IS.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_it_CH.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_it_IT.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_lt_LT.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_lv_LV.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_mk_MK.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_ms_MY.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_mt_MT.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_nl_BE.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_nl_NL.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_no_NO.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_pl_PL.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_pt_BR.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_pt_PT.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_ro_RO.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_ru_RU.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_sk_SK.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_sl_SI.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_sq_AL.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_sr_BA.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_sr_CS.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_sr_ME.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_sv_SE.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_tr_TR.java
trunk/core/src/openjdk/vm/sun/util/resources/CurrencyNames_uk_UA.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_be.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_bg.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_ca.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_cs.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_da.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_de.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_el.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_el_CY.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_en.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_en_MT.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_en_PH.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_en_SG.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_es.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_es_US.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_et.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_fi.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_fr.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_ga.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_hr.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_hu.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_in.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_is.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_it.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_lt.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_lv.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_mk.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_ms.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_mt.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_nl.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_no.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_pl.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_pt.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_pt_BR.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_pt_PT.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_ro.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_ru.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_sk.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_sl.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_sq.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_sr.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_sv.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_tr.java
trunk/core/src/openjdk/vm/sun/util/resources/LocaleNames_uk.java
Modified: trunk/core/src/classpath/vm/gnu/classpath/VMStackWalker.java
===================================================================
--- trunk/core/src/classpath/vm/gnu/classpath/VMStackWalker.java 2009-02-01 22:13:30 UTC (rev 4967)
+++ trunk/core/src/classpath/vm/gnu/classpath/VMStackWalker.java 2009-02-02 00:10:20 UTC (rev 4968)
@@ -1,24 +1,40 @@
-/*
- * $Id$
- *
- * JNode.org
- * Copyright (C) 2003-2009 JNode.org
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
+/* VMStackWalker.java -- Reference implementation of VM hooks for stack access
+ Copyright (C) 2005, 2006 Free Software Foundation
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
package gnu.classpath;
import org.jnode.vm.VmSystem;
Modified: trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMFrame.java
===================================================================
--- trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMFrame.java 2009-02-01 22:13:30 UTC (rev 4967)
+++ trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMFrame.java 2009-02-02 00:10:20 UTC (rev 4968)
@@ -1,24 +1,42 @@
-/*
- * $Id$
- *
- * JNode.org
- * Copyright (C) 2003-2009 JNode.org
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
+/* VMFrame.java -- Reference implementation of VM hooks for JDWP Frame access.
+ Copyright (C) 2005, 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
package gnu.classpath.jdwp;
import gnu.classpath.jdwp.util.Location;
Modified: trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMIdManager.java
===================================================================
--- trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMIdManager.java 2009-02-01 22:13:30 UTC (rev 4967)
+++ trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMIdManager.java 2009-02-02 00:10:20 UTC (rev 4968)
@@ -1,24 +1,44 @@
-/*
- * $Id$
- *
- * JNode.org
- * Copyright (C) 2003-2009 JNode.org
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
+/* VMIdManager.java -- A reference/example implementation of a manager for
+ JDWP object/reference type IDs
+
+ Copyright (C) 2005, 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
package gnu.classpath.jdwp;
import gnu.classpath.jdwp.exception.InvalidClassException;
Modified: trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMMethod.java
===================================================================
--- trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMMethod.java 2009-02-01 22:13:30 UTC (rev 4967)
+++ trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMMethod.java 2009-02-02 00:10:20 UTC (rev 4968)
@@ -1,24 +1,42 @@
-/*
- * $Id$
- *
- * JNode.org
- * Copyright (C) 2003-2009 JNode.org
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
+/* VMMethod.java -- a method in a virtual machine
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
package gnu.classpath.jdwp;
import java.io.DataOutputStream;
Modified: trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMVirtualMachine.java
===================================================================
--- trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMVirtualMachine.java 2009-02-01 22:13:30 UTC (rev 4967)
+++ trunk/core/src/classpath/vm/gnu/classpath/jdwp/VMVirtualMachine.java 2009-02-02 00:10:20 UTC (rev 4968)
@@ -1,24 +1,44 @@
-/*
- * $Id$
- *
- * JNode.org
- * Copyright (C) 2003-2009 JNode.org
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
+/* VMVirtualMachine.java -- A reference implementation of a JDWP virtual
+ machine
+
+ Copyright (C) 2005, 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
package gnu.classpath.jdwp;
import gnu.classpath.jdwp.event.EventRequest;
Modified: trunk/core/src/classpath/vm/gnu/java/lang/VMInstrumentationImpl.java
===================================================================
--- trunk/core/src/classpath/vm/gnu/java/lang/VMInstrumentationImpl.java 2009-02-01 22:13:30 UTC (rev 4967)
+++ trunk/core/src/classpath/vm/gnu/java/lang/VMInstrumentationImpl.java 2009-02-02 00:10:20 UTC (rev 4968)
@@ -1,24 +1,42 @@
-/*
- * $Id$
- *
- * JNode.org
- * Copyright (C) 2003-2009 JNode.org
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
+/*...
[truncated message content] |
|
From: <ls...@us...> - 2009-02-02 07:53:09
|
Revision: 4973
http://jnode.svn.sourceforge.net/jnode/?rev=4973&view=rev
Author: lsantha
Date: 2009-02-02 07:52:47 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
Fixed header.
Modified Paths:
--------------
trunk/core/src/classpath/ext/java/nio/channels/LinkChannel.java
trunk/core/src/classpath/ext/java/util/prefs/TransientPreferences.java
trunk/core/src/classpath/ext/javax/cache/Cache.java
trunk/core/src/classpath/ext/javax/cache/CacheEntry.java
trunk/core/src/classpath/ext/javax/cache/CacheException.java
trunk/core/src/classpath/ext/javax/cache/CacheFactory.java
trunk/core/src/classpath/ext/javax/cache/CacheListener.java
trunk/core/src/classpath/ext/javax/cache/CacheLoader.java
trunk/core/src/classpath/ext/javax/cache/CacheManager.java
trunk/core/src/classpath/ext/javax/cache/CacheStatistics.java
trunk/core/src/classpath/ext/javax/cache/EvictionStrategy.java
trunk/core/src/classpath/ext/javax/isolate/AbstractLinkMessageHandler.java
trunk/core/src/classpath/ext/javax/isolate/ClosedLinkException.java
trunk/core/src/classpath/ext/javax/isolate/Isolate.java
trunk/core/src/classpath/ext/javax/isolate/IsolatePermission.java
trunk/core/src/classpath/ext/javax/isolate/IsolateStartupException.java
trunk/core/src/classpath/ext/javax/isolate/IsolateStatus.java
trunk/core/src/classpath/ext/javax/isolate/Link.java
trunk/core/src/classpath/ext/javax/isolate/LinkMessage.java
trunk/core/src/classpath/ext/javax/isolate/LinkMessageDispatcher.java
trunk/core/src/classpath/ext/javax/isolate/LinkMessageHandler.java
trunk/core/src/classpath/ext/javax/isolate/StreamBindings.java
trunk/core/src/classpath/vm/gnu/classpath/Configuration.java
trunk/core/src/classpath/vm/gnu/classpath/VMSystemProperties.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/JNodeSocketTransport.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/NativeVMFrame.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/NativeVMMethod.java
trunk/core/src/classpath/vm/gnu/classpath/jdwp/NativeVMVirtualMachine.java
trunk/core/src/classpath/vm/gnu/java/lang/VMClassHelper.java
trunk/core/src/classpath/vm/gnu/java/nio/VMPipe.java
trunk/core/src/classpath/vm/gnu/java/nio/VMSelector.java
trunk/core/src/classpath/vm/gnu/java/security/action/GetPolicyAction.java
trunk/core/src/classpath/vm/gnu/java/security/action/GetPropertiesAction.java
trunk/core/src/classpath/vm/gnu/java/security/action/InvokeAction.java
trunk/core/src/classpath/vm/gnu/java/security/action/SetPropertyAction.java
trunk/core/src/classpath/vm/gnu/java/security/util/SimplePermissionCollection.java
trunk/core/src/classpath/vm/java/awt/VMAwtAPI.java
trunk/core/src/classpath/vm/java/awt/image/VMImageAPI.java
trunk/core/src/classpath/vm/java/awt/image/VMImageUtils.java
trunk/core/src/classpath/vm/java/io/VMFile.java
trunk/core/src/classpath/vm/java/io/VMFileSystemAPI.java
trunk/core/src/classpath/vm/java/io/VMIOUtils.java
trunk/core/src/classpath/vm/java/io/VMObjectInputStream.java
trunk/core/src/classpath/vm/java/io/VMObjectStreamClass.java
trunk/core/src/classpath/vm/java/io/VMOpenMode.java
trunk/core/src/classpath/vm/java/lang/ClassLoader.java
trunk/core/src/classpath/vm/java/lang/VMClassLoader.java
trunk/core/src/classpath/vm/java/lang/VMRuntime.java
trunk/core/src/classpath/vm/java/lang/VMSecurityManager.java
trunk/core/src/classpath/vm/java/net/ExSocketOptions.java
trunk/core/src/classpath/vm/java/net/VMInetAddress.java
trunk/core/src/classpath/vm/java/net/VMNetAPI.java
trunk/core/src/classpath/vm/java/net/VMNetAny.java
trunk/core/src/classpath/vm/java/net/VMNetDevice.java
trunk/core/src/classpath/vm/java/net/VMNetUtils.java
trunk/core/src/classpath/vm/java/net/VMNetworkInterface.java
trunk/core/src/classpath/vm/java/net/VMURLConnection.java
trunk/core/src/classpath/vm/java/nio/VMDirectByteBuffer.java
trunk/core/src/classpath/vm/java/nio/channels/VMChannels.java
trunk/core/src/classpath/vm/java/security/VMSecureRandom.java
trunk/core/src/classpath/vm/org/jnode/java/io/VMFileHandle.java
trunk/core/src/core/org/jnode/assembler/BootImageNativeStream.java
trunk/core/src/core/org/jnode/assembler/Label.java
trunk/core/src/core/org/jnode/assembler/NativeStream.java
trunk/core/src/core/org/jnode/assembler/ObjectResolver.java
trunk/core/src/core/org/jnode/assembler/UnresolvedObjectRefException.java
trunk/core/src/core/org/jnode/assembler/x86/InvalidOpcodeException.java
trunk/core/src/core/org/jnode/assembler/x86/X86Assembler.java
trunk/core/src/core/org/jnode/assembler/x86/X86BinaryAssembler.java
trunk/core/src/core/org/jnode/assembler/x86/X86Constants.java
trunk/core/src/core/org/jnode/assembler/x86/X86Operation.java
trunk/core/src/core/org/jnode/assembler/x86/X86Register.java
trunk/core/src/core/org/jnode/assembler/x86/X86TextAssembler.java
trunk/core/src/core/org/jnode/assembler/x86/X86Utils.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/boot/MemoryResourceInputStream.java
trunk/core/src/core/org/jnode/boot/NoCloseInputStream.java
trunk/core/src/core/org/jnode/debug/RemoteAppender.java
trunk/core/src/core/org/jnode/debug/RemoteReceiver.java
trunk/core/src/core/org/jnode/debug/UDPOutputStream.java
trunk/core/src/core/org/jnode/debugger/DebugState.java
trunk/core/src/core/org/jnode/debugger/Debugger.java
trunk/core/src/core/org/jnode/debugger/DebuggerPlugin.java
trunk/core/src/core/org/jnode/debugger/DebuggerUtils.java
trunk/core/src/core/org/jnode/debugger/RootState.java
trunk/core/src/core/org/jnode/debugger/ThreadListState.java
trunk/core/src/core/org/jnode/debugger/ThreadState.java
trunk/core/src/core/org/jnode/imageio/jpeg/JPEGDecoder.java
trunk/core/src/core/org/jnode/imageio/jpeg/JPEGDecoderAdapter.java
trunk/core/src/core/org/jnode/imageio/jpeg/JPEGException.java
trunk/core/src/core/org/jnode/imageio/jpeg/JPEGImageReader.java
trunk/core/src/core/org/jnode/imageio/jpeg/JPEGImageReaderSpi.java
trunk/core/src/core/org/jnode/log4j/config/JNodeSystemAppender.java
trunk/core/src/core/org/jnode/log4j/config/Log4jConfigurePlugin.java
trunk/core/src/core/org/jnode/log4j/config/UnsafeDebugAppender.java
trunk/core/src/core/org/jnode/log4j/config/VirtualConsoleAppender.java
trunk/core/src/core/org/jnode/naming/AbstractNameSpace.java
trunk/core/src/core/org/jnode/naming/DefaultNameSpace.java
trunk/core/src/core/org/jnode/naming/InitialNaming.java
trunk/core/src/core/org/jnode/naming/NameSpace.java
trunk/core/src/core/org/jnode/naming/NameSpaceListener.java
trunk/core/src/core/org/jnode/plugin/AutoUnzipPlugin.java
trunk/core/src/core/org/jnode/plugin/ConfigurationElement.java
trunk/core/src/core/org/jnode/plugin/Extension.java
trunk/core/src/core/org/jnode/plugin/ExtensionPoint.java
trunk/core/src/core/org/jnode/plugin/ExtensionPointListener.java
trunk/core/src/core/org/jnode/plugin/FragmentDescriptor.java
trunk/core/src/core/org/jnode/plugin/Library.java
trunk/core/src/core/org/jnode/plugin/Plugin.java
trunk/core/src/core/org/jnode/plugin/PluginClassLoader.java
trunk/core/src/core/org/jnode/plugin/PluginDescriptor.java
trunk/core/src/core/org/jnode/plugin/PluginDescriptorListener.java
trunk/core/src/core/org/jnode/plugin/PluginException.java
trunk/core/src/core/org/jnode/plugin/PluginLoader.java
trunk/core/src/core/org/jnode/plugin/PluginLoaderManager.java
trunk/core/src/core/org/jnode/plugin/PluginManager.java
trunk/core/src/core/org/jnode/plugin/PluginPrerequisite.java
trunk/core/src/core/org/jnode/plugin/PluginReference.java
trunk/core/src/core/org/jnode/plugin/PluginRegistry.java
trunk/core/src/core/org/jnode/plugin/PluginSecurityConstants.java
trunk/core/src/core/org/jnode/plugin/PluginUtils.java
trunk/core/src/core/org/jnode/plugin/Runtime.java
trunk/core/src/core/org/jnode/plugin/URLPluginLoader.java
trunk/core/src/core/org/jnode/plugin/manager/DefaultPluginLoaderManager.java
trunk/core/src/core/org/jnode/plugin/manager/DefaultPluginManager.java
trunk/core/src/core/org/jnode/plugin/model/AbstractModelObject.java
trunk/core/src/core/org/jnode/plugin/model/AttributeModel.java
trunk/core/src/core/org/jnode/plugin/model/ConfigurationElementModel.java
trunk/core/src/core/org/jnode/plugin/model/EmptyPlugin.java
trunk/core/src/core/org/jnode/plugin/model/ExtensionModel.java
trunk/core/src/core/org/jnode/plugin/model/ExtensionPointModel.java
trunk/core/src/core/org/jnode/plugin/model/Factory.java
trunk/core/src/core/org/jnode/plugin/model/FragmentDescriptorModel.java
trunk/core/src/core/org/jnode/plugin/model/LibraryModel.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/plugin/model/PluginJar.java
trunk/core/src/core/org/jnode/plugin/model/PluginModelObject.java
trunk/core/src/core/org/jnode/plugin/model/PluginPrerequisiteModel.java
trunk/core/src/core/org/jnode/plugin/model/PluginRegistryModel.java
trunk/core/src/core/org/jnode/plugin/model/PluginsClassLoader.java
trunk/core/src/core/org/jnode/plugin/model/RuntimeModel.java
trunk/core/src/core/org/jnode/protocol/ProtocolHandlerFactoryPlugin.java
trunk/core/src/core/org/jnode/protocol/plugin/Handler.java
trunk/core/src/core/org/jnode/protocol/plugin/PluginURLConnection.java
trunk/core/src/core/org/jnode/protocol/system/Handler.java
trunk/core/src/core/org/jnode/protocol/system/SystemURLConnection.java
trunk/core/src/core/org/jnode/security/JNodePermission.java
trunk/core/src/core/org/jnode/security/JNodePolicy.java
trunk/core/src/core/org/jnode/security/JNodeSecurityManager.java
trunk/core/src/core/org/jnode/security/SecurityPlugin.java
trunk/core/src/core/org/jnode/system/BootLog.java
trunk/core/src/core/org/jnode/system/DMAException.java
trunk/core/src/core/org/jnode/system/DMAManager.java
trunk/core/src/core/org/jnode/system/DMAResource.java
trunk/core/src/core/org/jnode/system/IOResource.java
trunk/core/src/core/org/jnode/system/IRQHandler.java
trunk/core/src/core/org/jnode/system/IRQResource.java
trunk/core/src/core/org/jnode/system/MemoryResource.java
trunk/core/src/core/org/jnode/system/MemoryScanner.java
trunk/core/src/core/org/jnode/system/MultiMediaMemoryResource.java
trunk/core/src/core/org/jnode/system/Resource.java
trunk/core/src/core/org/jnode/system/ResourceManager.java
trunk/core/src/core/org/jnode/system/ResourceNotFreeException.java
trunk/core/src/core/org/jnode/system/ResourceOwner.java
trunk/core/src/core/org/jnode/system/ResourcePermission.java
trunk/core/src/core/org/jnode/system/SimpleResourceOwner.java
trunk/core/src/core/org/jnode/system/event/FocusEvent.java
trunk/core/src/core/org/jnode/system/event/FocusListener.java
trunk/core/src/core/org/jnode/system/event/SystemEvent.java
trunk/core/src/core/org/jnode/system/repository/Repository.java
trunk/core/src/core/org/jnode/system/repository/RepositoryPlugin.java
trunk/core/src/core/org/jnode/system/repository/RepositoryPluginLoader.java
trunk/core/src/core/org/jnode/system/repository/SystemRepository.java
trunk/core/src/core/org/jnode/system/repository/SystemRepositoryPlugin.java
trunk/core/src/core/org/jnode/system/repository/plugins/PluginLoaderPlugin.java
trunk/core/src/core/org/jnode/system/repository/spi/SystemRepositoryProvider.java
trunk/core/src/core/org/jnode/system/x86/DMA.java
trunk/core/src/core/org/jnode/system/x86/DMAConstants.java
trunk/core/src/core/org/jnode/system/x86/DMAPlugin.java
trunk/core/src/core/org/jnode/system/x86/X86DMAChannel.java
trunk/core/src/core/org/jnode/util/AccessControllerUtils.java
trunk/core/src/core/org/jnode/util/BCDUtils.java
trunk/core/src/core/org/jnode/util/BeanUtils.java
trunk/core/src/core/org/jnode/util/BigEndian.java
trunk/core/src/core/org/jnode/util/BinaryScaleFactor.java
trunk/core/src/core/org/jnode/util/BooleanUtils.java
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/ByteBufferInputStream.java
trunk/core/src/core/org/jnode/util/ByteBufferUtils.java
trunk/core/src/core/org/jnode/util/ByteQueue.java
trunk/core/src/core/org/jnode/util/ByteQueueProcessor.java
trunk/core/src/core/org/jnode/util/ByteQueueProcessorThread.java
trunk/core/src/core/org/jnode/util/ChannelInputStream.java
trunk/core/src/core/org/jnode/util/ChannelOutputStream.java
trunk/core/src/core/org/jnode/util/Command.java
trunk/core/src/core/org/jnode/util/ConsoleStream.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/DecimalScaleFactor.java
trunk/core/src/core/org/jnode/util/EmptyInputStream.java
trunk/core/src/core/org/jnode/util/FileUtils.java
trunk/core/src/core/org/jnode/util/IOUtils.java
trunk/core/src/core/org/jnode/util/JarBuffer.java
trunk/core/src/core/org/jnode/util/JarConstants.java
trunk/core/src/core/org/jnode/util/LittleEndian.java
trunk/core/src/core/org/jnode/util/NumberUtils.java
trunk/core/src/core/org/jnode/util/ObjectArrayIterator.java
trunk/core/src/core/org/jnode/util/ObjectUtils.java
trunk/core/src/core/org/jnode/util/OsUtils.java
trunk/core/src/core/org/jnode/util/ProxyStream.java
trunk/core/src/core/org/jnode/util/ProxyStreamException.java
trunk/core/src/core/org/jnode/util/Queue.java
trunk/core/src/core/org/jnode/util/QueueProcessor.java
trunk/core/src/core/org/jnode/util/QueueProcessorThread.java
trunk/core/src/core/org/jnode/util/ReaderInputStream.java
trunk/core/src/core/org/jnode/util/ScaleFactor.java
trunk/core/src/core/org/jnode/util/SizeUnit.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/StopWatch.java
trunk/core/src/core/org/jnode/util/SynchronizedCounter.java
trunk/core/src/core/org/jnode/util/SystemInputStream.java
trunk/core/src/core/org/jnode/util/TimeUtils.java
trunk/core/src/core/org/jnode/util/TimeoutException.java
trunk/core/src/core/org/jnode/util/Token.java
trunk/core/src/core/org/jnode/util/WriterOutputStream.java
trunk/core/src/core/org/jnode/vm/AllocationBitmap.java
trunk/core/src/core/org/jnode/vm/BootableObject.java
trunk/core/src/core/org/jnode/vm/CpuID.java
trunk/core/src/core/org/jnode/vm/HeapHelperImpl.java
trunk/core/src/core/org/jnode/vm/IOContext.java
trunk/core/src/core/org/jnode/vm/IOResourceImpl.java
trunk/core/src/core/org/jnode/vm/JvmType.java
trunk/core/src/core/org/jnode/vm/LoadCompileService.java
trunk/core/src/core/org/jnode/vm/LoadCompileThread.java
trunk/core/src/core/org/jnode/vm/MathSupport.java
trunk/core/src/core/org/jnode/vm/MemoryBlockManager.java
trunk/core/src/core/org/jnode/vm/MemoryMapEntry.java
trunk/core/src/core/org/jnode/vm/MemoryResourceImpl.java
trunk/core/src/core/org/jnode/vm/MemoryScannerImpl.java
trunk/core/src/core/org/jnode/vm/MultiMediaMemoryResourceImpl.java
trunk/core/src/core/org/jnode/vm/ObjectVisitor.java
trunk/core/src/core/org/jnode/vm/RTCService.java
trunk/core/src/core/org/jnode/vm/Region.java
trunk/core/src/core/org/jnode/vm/ResourceLoader.java
trunk/core/src/core/org/jnode/vm/ResourceManagerImpl.java
trunk/core/src/core/org/jnode/vm/SoftByteCodes.java
trunk/core/src/core/org/jnode/vm/Unsafe.java
trunk/core/src/core/org/jnode/vm/VirtualMemoryRegion.java
trunk/core/src/core/org/jnode/vm/Vm.java
trunk/core/src/core/org/jnode/vm/VmAbstractClassLoader.java
trunk/core/src/core/org/jnode/vm/VmAccessControlContext.java
trunk/core/src/core/org/jnode/vm/VmAccessController.java
trunk/core/src/core/org/jnode/vm/VmAddress.java
trunk/core/src/core/org/jnode/vm/VmArchitecture.java
trunk/core/src/core/org/jnode/vm/VmChannel.java
trunk/core/src/core/org/jnode/vm/VmExit.java
trunk/core/src/core/org/jnode/vm/VmIOContext.java
trunk/core/src/core/org/jnode/vm/VmJavaClassLoader.java
trunk/core/src/core/org/jnode/vm/VmJavaMultiMediaSupport.java
trunk/core/src/core/org/jnode/vm/VmMagic.java
trunk/core/src/core/org/jnode/vm/VmMultiMediaSupport.java
trunk/core/src/core/org/jnode/vm/VmProcess.java
trunk/core/src/core/org/jnode/vm/VmProcessClassLoader.java
trunk/core/src/core/org/jnode/vm/VmReflection.java
trunk/core/src/core/org/jnode/vm/VmStackFrame.java
trunk/core/src/core/org/jnode/vm/VmStackFrameEnumerator.java
trunk/core/src/core/org/jnode/vm/VmStackReader.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/VmSystemObject.java
trunk/core/src/core/org/jnode/vm/VmUtils.java
trunk/core/src/core/org/jnode/vm/annotation/AllowedPackages.java
trunk/core/src/core/org/jnode/vm/annotation/CheckPermission.java
trunk/core/src/core/org/jnode/vm/annotation/DoPrivileged.java
trunk/core/src/core/org/jnode/vm/annotation/Inline.java
trunk/core/src/core/org/jnode/vm/annotation/Internal.java
trunk/core/src/core/org/jnode/vm/annotation/KernelSpace.java
trunk/core/src/core/org/jnode/vm/annotation/LoadStatics.java
trunk/core/src/core/org/jnode/vm/annotation/MagicPermission.java
trunk/core/src/core/org/jnode/vm/annotation/NoFieldAlignments.java
trunk/core/src/core/org/jnode/vm/annotation/NoInline.java
trunk/core/src/core/org/jnode/vm/annotation/NoReadBarrier.java
trunk/core/src/core/org/jnode/vm/annotation/NoWriteBarrier.java
trunk/core/src/core/org/jnode/vm/annotation/PrivilegedActionPragma.java
trunk/core/src/core/org/jnode/vm/annotation/SharedStatics.java
trunk/core/src/core/org/jnode/vm/annotation/Uninterruptible.java
trunk/core/src/core/org/jnode/vm/bytecode/BasicBlock.java
trunk/core/src/core/org/jnode/vm/bytecode/BasicBlockFinder.java
trunk/core/src/core/org/jnode/vm/bytecode/BytecodeFlags.java
trunk/core/src/core/org/jnode/vm/bytecode/BytecodeParser.java
trunk/core/src/core/org/jnode/vm/bytecode/BytecodeViewer.java
trunk/core/src/core/org/jnode/vm/bytecode/BytecodeVisitor.java
trunk/core/src/core/org/jnode/vm/bytecode/BytecodeVisitorSupport.java
trunk/core/src/core/org/jnode/vm/bytecode/BytecodeWriter.java
trunk/core/src/core/org/jnode/vm/bytecode/ControlFlowGraph.java
trunk/core/src/core/org/jnode/vm/bytecode/DelegatingBytecodeVisitor.java
trunk/core/src/core/org/jnode/vm/bytecode/StackException.java
trunk/core/src/core/org/jnode/vm/bytecode/TypeStack.java
trunk/core/src/core/org/jnode/vm/classmgr/AbstractCode.java
trunk/core/src/core/org/jnode/vm/classmgr/AbstractExceptionHandler.java
trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java
trunk/core/src/core/org/jnode/vm/classmgr/CompiledCodeList.java
trunk/core/src/core/org/jnode/vm/classmgr/IMTBuilder.java
trunk/core/src/core/org/jnode/vm/classmgr/MethodPragmaFlags.java
trunk/core/src/core/org/jnode/vm/classmgr/Modifier.java
trunk/core/src/core/org/jnode/vm/classmgr/NotResolvedYetException.java
trunk/core/src/core/org/jnode/vm/classmgr/ObjectFlags.java
trunk/core/src/core/org/jnode/vm/classmgr/ObjectLayout.java
trunk/core/src/core/org/jnode/vm/classmgr/SelectorMap.java
trunk/core/src/core/org/jnode/vm/classmgr/Signature.java
trunk/core/src/core/org/jnode/vm/classmgr/TIBBuilder.java
trunk/core/src/core/org/jnode/vm/classmgr/TIBLayout.java
trunk/core/src/core/org/jnode/vm/classmgr/TypePragmaFlags.java
trunk/core/src/core/org/jnode/vm/classmgr/TypeSizeInfo.java
trunk/core/src/core/org/jnode/vm/classmgr/VmAddressMap.java
trunk/core/src/core/org/jnode/vm/classmgr/VmAnnotatedElement.java
trunk/core/src/core/org/jnode/vm/classmgr/VmAnnotation.java
trunk/core/src/core/org/jnode/vm/classmgr/VmArray.java
trunk/core/src/core/org/jnode/vm/classmgr/VmArrayClass.java
trunk/core/src/core/org/jnode/vm/classmgr/VmByteCode.java
trunk/core/src/core/org/jnode/vm/classmgr/VmCP.java
trunk/core/src/core/org/jnode/vm/classmgr/VmClassLoader.java
trunk/core/src/core/org/jnode/vm/classmgr/VmClassType.java
trunk/core/src/core/org/jnode/vm/classmgr/VmCompiledCode.java
trunk/core/src/core/org/jnode/vm/classmgr/VmCompiledExceptionHandler.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstClass.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstDouble.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstFieldRef.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstFloat.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstIMethodRef.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstInt.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstLong.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstMemberRef.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstMethodRef.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstObject.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstString.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstantPool.java
trunk/core/src/core/org/jnode/vm/classmgr/VmExceptions.java
trunk/core/src/core/org/jnode/vm/classmgr/VmField.java
trunk/core/src/core/org/jnode/vm/classmgr/VmImplementedInterface.java
trunk/core/src/core/org/jnode/vm/classmgr/VmInstanceField.java
trunk/core/src/core/org/jnode/vm/classmgr/VmInstanceMethod.java
trunk/core/src/core/org/jnode/vm/classmgr/VmInterfaceClass.java
trunk/core/src/core/org/jnode/vm/classmgr/VmInterpretedExceptionHandler.java
trunk/core/src/core/org/jnode/vm/classmgr/VmIsolatedStatics.java
trunk/core/src/core/org/jnode/vm/classmgr/VmIsolatedStaticsEntry.java
trunk/core/src/core/org/jnode/vm/classmgr/VmLineNumberMap.java
trunk/core/src/core/org/jnode/vm/classmgr/VmLocalVariable.java
trunk/core/src/core/org/jnode/vm/classmgr/VmLocalVariableTable.java
trunk/core/src/core/org/jnode/vm/classmgr/VmMember.java
trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java
trunk/core/src/core/org/jnode/vm/classmgr/VmMethodCode.java
trunk/core/src/core/org/jnode/vm/classmgr/VmNormalClass.java
trunk/core/src/core/org/jnode/vm/classmgr/VmObject.java
trunk/core/src/core/org/jnode/vm/classmgr/VmPrimitiveClass.java
trunk/core/src/core/org/jnode/vm/classmgr/VmResolvableConstObject.java
trunk/core/src/core/org/jnode/vm/classmgr/VmSharedStatics.java
trunk/core/src/core/org/jnode/vm/classmgr/VmSharedStaticsEntry.java
trunk/core/src/core/org/jnode/vm/classmgr/VmSpecialMethod.java
trunk/core/src/core/org/jnode/vm/classmgr/VmStaticField.java
trunk/core/src/core/org/jnode/vm/classmgr/VmStaticMethod.java
trunk/core/src/core/org/jnode/vm/classmgr/VmStatics.java
trunk/core/src/core/org/jnode/vm/classmgr/VmStaticsAllocator.java
trunk/core/src/core/org/jnode/vm/classmgr/VmStaticsBase.java
trunk/core/src/core/org/jnode/vm/classmgr/VmStaticsIterator.java
trunk/core/src/core/org/jnode/vm/classmgr/VmType.java
trunk/core/src/core/org/jnode/vm/classmgr/VmTypeState.java
trunk/core/src/core/org/jnode/vm/classmgr/VmUTF8Convert.java
trunk/core/src/core/org/jnode/vm/compiler/BaseMagicHelper.java
trunk/core/src/core/org/jnode/vm/compiler/CompileError.java
trunk/core/src/core/org/jnode/vm/compiler/CompiledExceptionHandler.java
trunk/core/src/core/org/jnode/vm/compiler/CompiledIMT.java
trunk/core/src/core/org/jnode/vm/compiler/CompiledMethod.java
trunk/core/src/core/org/jnode/vm/compiler/CompilerBytecodeParser.java
trunk/core/src/core/org/jnode/vm/compiler/CompilerBytecodeViewer.java
trunk/core/src/core/org/jnode/vm/compiler/CompilerBytecodeVisitor.java
trunk/core/src/core/org/jnode/vm/compiler/DelegatingCompilerBytecodeVisitor.java
trunk/core/src/core/org/jnode/vm/compiler/EntryPoints.java
trunk/core/src/core/org/jnode/vm/compiler/GCMapIterator.java
trunk/core/src/core/org/jnode/vm/compiler/IMTCompiler.java
trunk/core/src/core/org/jnode/vm/compiler/IllegalModeException.java
trunk/core/src/core/org/jnode/vm/compiler/InlineBytecodeVisitor.java
trunk/core/src/core/org/jnode/vm/compiler/NativeCodeCompiler.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/compiler/ir/AddressingMode.java
trunk/core/src/core/org/jnode/vm/compiler/ir/CodeGenerator.java
trunk/core/src/core/org/jnode/vm/compiler/ir/Constant.java
trunk/core/src/core/org/jnode/vm/compiler/ir/DoubleConstant.java
trunk/core/src/core/org/jnode/vm/compiler/ir/FloatConstant.java
trunk/core/src/core/org/jnode/vm/compiler/ir/IRBasicBlock.java
trunk/core/src/core/org/jnode/vm/compiler/ir/IRBasicBlockFinder.java
trunk/core/src/core/org/jnode/vm/compiler/ir/IRControlFlowGraph.java
trunk/core/src/core/org/jnode/vm/compiler/ir/IRGenerator.java
trunk/core/src/core/org/jnode/vm/compiler/ir/IRTest.java
trunk/core/src/core/org/jnode/vm/compiler/ir/IntConstant.java
trunk/core/src/core/org/jnode/vm/compiler/ir/LinearScanAllocator.java
trunk/core/src/core/org/jnode/vm/compiler/ir/LiveRange.java
trunk/core/src/core/org/jnode/vm/compiler/ir/LocalVariable.java
trunk/core/src/core/org/jnode/vm/compiler/ir/Location.java
trunk/core/src/core/org/jnode/vm/compiler/ir/LongConstant.java
trunk/core/src/core/org/jnode/vm/compiler/ir/MethodArgument.java
trunk/core/src/core/org/jnode/vm/compiler/ir/NativeTest.java
trunk/core/src/core/org/jnode/vm/compiler/ir/Operand.java
trunk/core/src/core/org/jnode/vm/compiler/ir/PhiOperand.java
trunk/core/src/core/org/jnode/vm/compiler/ir/PrimitiveTest.java
trunk/core/src/core/org/jnode/vm/compiler/ir/ReferenceConstant.java
trunk/core/src/core/org/jnode/vm/compiler/ir/RegisterLocation.java
trunk/core/src/core/org/jnode/vm/compiler/ir/RegisterPool.java
trunk/core/src/core/org/jnode/vm/compiler/ir/SSAStack.java
trunk/core/src/core/org/jnode/vm/compiler/ir/StackLocation.java
trunk/core/src/core/org/jnode/vm/compiler/ir/StackVariable.java
trunk/core/src/core/org/jnode/vm/compiler/ir/Variable.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/AssignQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/BinaryOperation.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/BinaryQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/BranchCondition.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/BranchQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/ConditionalBranchQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/ConstantRefAssignQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/PhiAssignQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/Quad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/UnaryOperation.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/UnaryQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/UnconditionalBranchQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/VarReturnQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/VariableRefAssignQuad.java
trunk/core/src/core/org/jnode/vm/compiler/ir/quad/VoidReturnQuad.java
trunk/core/src/core/org/jnode/vm/isolate/DataLinkMessage.java
trunk/core/src/core/org/jnode/vm/isolate/IsolateLinkMessage.java
trunk/core/src/core/org/jnode/vm/isolate/IsolateStatusImpl.java
trunk/core/src/core/org/jnode/vm/isolate/IsolateThread.java
trunk/core/src/core/org/jnode/vm/isolate/IsolateThreadFactory.java
trunk/core/src/core/org/jnode/vm/isolate/LinkImpl.java
trunk/core/src/core/org/jnode/vm/isolate/LinkLinkMessage.java
trunk/core/src/core/org/jnode/vm/isolate/LinkMessageFactory.java
trunk/core/src/core/org/jnode/vm/isolate/LinkMessageImpl.java
trunk/core/src/core/org/jnode/vm/isolate/ObjectLinkMessage.java
trunk/core/src/core/org/jnode/vm/isolate/StatusLinkMessage.java
trunk/core/src/core/org/jnode/vm/isolate/StringLinkMessage.java
trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
trunk/core/src/core/org/jnode/vm/isolate/VmIsolateLocal.java
trunk/core/src/core/org/jnode/vm/isolate/VmLink.java
trunk/core/src/core/org/jnode/vm/isolate/VmStreamBindings.java
trunk/core/src/core/org/jnode/vm/memmgr/GCStatistics.java
trunk/core/src/core/org/jnode/vm/memmgr/HeapHelper.java
trunk/core/src/core/org/jnode/vm/memmgr/HeapStatistics.java
trunk/core/src/core/org/jnode/vm/memmgr/VmHeapManager.java
trunk/core/src/core/org/jnode/vm/memmgr/VmWriteBarrier.java
trunk/core/src/core/org/jnode/vm/memmgr/def/DefGCStatistics.java
trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java
trunk/core/src/core/org/jnode/vm/memmgr/def/DefaultHeapManager.java
trunk/core/src/core/org/jnode/vm/memmgr/def/DefaultWriteBarrier.java
trunk/core/src/core/org/jnode/vm/memmgr/def/FinalizerThread.java
trunk/core/src/core/org/jnode/vm/memmgr/def/FinalizerVisitor.java
trunk/core/src/core/org/jnode/vm/memmgr/def/GCManager.java
trunk/core/src/core/org/jnode/vm/memmgr/def/GCMarkVisitor.java
trunk/core/src/core/org/jnode/vm/memmgr/def/GCSetWhiteVisitor.java
trunk/core/src/core/org/jnode/vm/memmgr/def/GCStack.java
trunk/core/src/core/org/jnode/vm/memmgr/def/GCSweepVisitor.java
trunk/core/src/core/org/jnode/vm/memmgr/def/GCThread.java
trunk/core/src/core/org/jnode/vm/memmgr/def/GCVerif...
[truncated message content] |
|
From: <ls...@us...> - 2009-02-14 20:30:02
|
Revision: 5025
http://jnode.svn.sourceforge.net/jnode/?rev=5025&view=rev
Author: lsantha
Date: 2009-02-14 20:29:54 +0000 (Sat, 14 Feb 2009)
Log Message:
-----------
OpenJDK integration.
Modified Paths:
--------------
trunk/core/src/classpath/java/java/net/Socket.java
Added Paths:
-----------
trunk/core/src/openjdk/com/com/sun/crypto/
trunk/core/src/openjdk/com/com/sun/crypto/provider/
trunk/core/src/openjdk/com/com/sun/crypto/provider/AESCipher.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/AESConstants.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/AESCrypt.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/AESKeyGenerator.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/AESParameters.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/AESWrapCipher.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/ARCFOURCipher.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/BlockCipherParamsCore.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/BlowfishCipher.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/BlowfishConstants.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/BlowfishCrypt.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/BlowfishKeyGenerator.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/BlowfishParameters.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/CipherBlockChaining.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/CipherCore.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/CipherFeedback.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/CipherTextStealing.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/CipherWithWrappingSpi.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/ConstructKeys.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/CounterMode.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DESCipher.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DESConstants.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DESCrypt.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DESKey.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DESKeyFactory.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DESKeyGenerator.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DESParameters.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DESedeCipher.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DESedeCrypt.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DESedeKey.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DESedeKeyFactory.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DESedeKeyGenerator.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DESedeParameters.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DESedeWrapCipher.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DHKeyAgreement.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DHKeyFactory.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DHKeyPairGenerator.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DHParameterGenerator.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DHParameters.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DHPrivateKey.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/DHPublicKey.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/ElectronicCodeBook.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/EncryptedPrivateKeyInfo.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/FeedbackCipher.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/HmacCore.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/HmacMD5.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/HmacMD5KeyGenerator.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/HmacPKCS12PBESHA1.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/HmacSHA1.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/HmacSHA1KeyGenerator.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/ISO10126Padding.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/JarVerifier.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/JceKeyStore.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/KeyGeneratorCore.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/KeyProtector.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/OAEPParameters.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/OutputFeedback.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/PBECipherCore.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/PBEKey.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/PBEKeyFactory.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/PBEParameters.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/PBKDF2KeyImpl.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/PCBC.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/PKCS12PBECipherCore.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/PKCS5Padding.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/Padding.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/PrivateKeyInfo.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/RC2Cipher.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/RC2Crypt.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/RC2Parameters.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/RSACipher.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/SslMacCore.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/SunJCE.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/SymmetricCipher.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/TlsKeyMaterialGenerator.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/TlsMasterSecretGenerator.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/TlsPrfGenerator.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java
trunk/core/src/openjdk/com/com/sun/crypto/provider/ai.java
trunk/core/src/openjdk/com/com/sun/net/ssl/internal/ssl/Provider.java
trunk/core/src/openjdk/javax/javax/crypto/BadPaddingException.java
trunk/core/src/openjdk/javax/javax/crypto/Cipher.java
trunk/core/src/openjdk/javax/javax/crypto/CipherInputStream.java
trunk/core/src/openjdk/javax/javax/crypto/CipherOutputStream.java
trunk/core/src/openjdk/javax/javax/crypto/CipherSpi.java
trunk/core/src/openjdk/javax/javax/crypto/CryptoAllPermission.java
trunk/core/src/openjdk/javax/javax/crypto/CryptoPermission.java
trunk/core/src/openjdk/javax/javax/crypto/CryptoPermissions.java
trunk/core/src/openjdk/javax/javax/crypto/CryptoPolicyParser.java
trunk/core/src/openjdk/javax/javax/crypto/EncryptedPrivateKeyInfo.java
trunk/core/src/openjdk/javax/javax/crypto/ExemptionMechanism.java
trunk/core/src/openjdk/javax/javax/crypto/ExemptionMechanismException.java
trunk/core/src/openjdk/javax/javax/crypto/ExemptionMechanismSpi.java
trunk/core/src/openjdk/javax/javax/crypto/IllegalBlockSizeException.java
trunk/core/src/openjdk/javax/javax/crypto/JarVerifier.java
trunk/core/src/openjdk/javax/javax/crypto/JceSecurity.java
trunk/core/src/openjdk/javax/javax/crypto/JceSecurityManager.java
trunk/core/src/openjdk/javax/javax/crypto/KeyAgreement.java
trunk/core/src/openjdk/javax/javax/crypto/KeyAgreementSpi.java
trunk/core/src/openjdk/javax/javax/crypto/KeyGenerator.java
trunk/core/src/openjdk/javax/javax/crypto/KeyGeneratorSpi.java
trunk/core/src/openjdk/javax/javax/crypto/Mac.java
trunk/core/src/openjdk/javax/javax/crypto/MacSpi.java
trunk/core/src/openjdk/javax/javax/crypto/NoSuchPaddingException.java
trunk/core/src/openjdk/javax/javax/crypto/NullCipher.java
trunk/core/src/openjdk/javax/javax/crypto/NullCipherSpi.java
trunk/core/src/openjdk/javax/javax/crypto/SealedObject.java
trunk/core/src/openjdk/javax/javax/crypto/SecretKey.java
trunk/core/src/openjdk/javax/javax/crypto/SecretKeyFactory.java
trunk/core/src/openjdk/javax/javax/crypto/SecretKeyFactorySpi.java
trunk/core/src/openjdk/javax/javax/crypto/ShortBufferException.java
trunk/core/src/openjdk/javax/javax/crypto/interfaces/
trunk/core/src/openjdk/javax/javax/crypto/interfaces/DHKey.java
trunk/core/src/openjdk/javax/javax/crypto/interfaces/DHPrivateKey.java
trunk/core/src/openjdk/javax/javax/crypto/interfaces/DHPublicKey.java
trunk/core/src/openjdk/javax/javax/crypto/interfaces/PBEKey.java
trunk/core/src/openjdk/javax/javax/crypto/interfaces/package.html
trunk/core/src/openjdk/javax/javax/crypto/package.html
trunk/core/src/openjdk/javax/javax/crypto/spec/DESKeySpec.java
trunk/core/src/openjdk/javax/javax/crypto/spec/DESedeKeySpec.java
trunk/core/src/openjdk/javax/javax/crypto/spec/DHGenParameterSpec.java
trunk/core/src/openjdk/javax/javax/crypto/spec/DHParameterSpec.java
trunk/core/src/openjdk/javax/javax/crypto/spec/DHPrivateKeySpec.java
trunk/core/src/openjdk/javax/javax/crypto/spec/DHPublicKeySpec.java
trunk/core/src/openjdk/javax/javax/crypto/spec/IvParameterSpec.java
trunk/core/src/openjdk/javax/javax/crypto/spec/PBEKeySpec.java
trunk/core/src/openjdk/javax/javax/crypto/spec/PBEParameterSpec.java
trunk/core/src/openjdk/javax/javax/crypto/spec/RC2ParameterSpec.java
trunk/core/src/openjdk/javax/javax/crypto/spec/RC5ParameterSpec.java
trunk/core/src/openjdk/javax/javax/crypto/spec/SecretKeySpec.java
trunk/core/src/openjdk/javax/javax/crypto/spec/package.html
trunk/core/src/openjdk/sun/sun/nio/ch/DirectBuffer.java
Removed Paths:
-------------
trunk/core/src/classpath/javax/javax/crypto/
Modified: trunk/core/src/classpath/java/java/net/Socket.java
===================================================================
--- trunk/core/src/classpath/java/java/net/Socket.java 2009-02-14 20:24:42 UTC (rev 5024)
+++ trunk/core/src/classpath/java/java/net/Socket.java 2009-02-14 20:29:54 UTC (rev 5025)
@@ -1270,4 +1270,9 @@
{
return outputShutdown;
}
+
+ //jnode openjdk
+ public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
+ //TODO implement it
+ }
}
Added: trunk/core/src/openjdk/com/com/sun/crypto/provider/AESCipher.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/crypto/provider/AESCipher.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/crypto/provider/AESCipher.java 2009-02-14 20:29:54 UTC (rev 5025)
@@ -0,0 +1,431 @@
+/*
+ * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code 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 General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.crypto.provider;
+
+import java.security.*;
+import java.security.spec.*;
+import javax.crypto.*;
+import javax.crypto.spec.*;
+import javax.crypto.BadPaddingException;
+
+/**
+ * This class implements the AES algorithm in its various modes
+ * (<code>ECB</code>, <code>CFB</code>, <code>OFB</code>, <code>CBC</code>,
+ * <code>PCBC</code>) and padding schemes (<code>PKCS5Padding</code>,
+ * <code>NoPadding</code>, <code>ISO10126Padding</code>).
+ *
+ * @author Valerie Peng
+ *
+ *
+ * @see AESCrypt
+ * @see CipherBlockChaining
+ * @see ElectronicCodeBook
+ * @see CipherFeedback
+ * @see OutputFeedback
+ */
+
+public final class AESCipher extends CipherSpi {
+ /*
+ * internal CipherCore object which does the real work.
+ */
+ private CipherCore core = null;
+
+ /**
+ * Creates an instance of AES cipher with default ECB mode and
+ * PKCS5Padding.
+ *
+ * @exception SecurityException if this constructor fails to verify
+ * its own integrity
+ */
+ public AESCipher() {
+ SunJCE.ensureIntegrity(getClass());
+ core = new CipherCore(new AESCrypt(), AESConstants.AES_BLOCK_SIZE);
+ }
+
+ /**
+ * Sets the mode of this cipher.
+ *
+ * @param mode the cipher mode
+ *
+ * @exception NoSuchAlgorithmException if the requested cipher mode does
+ * not exist
+ */
+ protected void engineSetMode(String mode)
+ throws NoSuchAlgorithmException {
+ core.setMode(mode);
+ }
+
+ /**
+ * Sets the padding mechanism of this cipher.
+ *
+ * @param padding the padding mechanism
+ *
+ * @exception NoSuchPaddingException if the requested padding mechanism
+ * does not exist
+ */
+ protected void engineSetPadding(String paddingScheme)
+ throws NoSuchPaddingException {
+ core.setPadding(paddingScheme);
+ }
+
+ /**
+ * Returns the block size (in bytes).
+ *
+ * @return the block size (in bytes), or 0 if the underlying algorithm is
+ * not a block cipher
+ */
+ protected int engineGetBlockSize() {
+ return AESConstants.AES_BLOCK_SIZE;
+ }
+
+ /**
+ * Returns the length in bytes that an output buffer would need to be in
+ * order to hold the result of the next <code>update</code> or
+ * <code>doFinal</code> operation, given the input length
+ * <code>inputLen</code> (in bytes).
+ *
+ * <p>This call takes into account any unprocessed (buffered) data from a
+ * previous <code>update</code> call, and padding.
+ *
+ * <p>The actual output length of the next <code>update</code> or
+ * <code>doFinal</code> call may be smaller than the length returned by
+ * this method.
+ *
+ * @param inputLen the input length (in bytes)
+ *
+ * @return the required output buffer size (in bytes)
+ */
+ protected int engineGetOutputSize(int inputLen) {
+ return core.getOutputSize(inputLen);
+ }
+
+ /**
+ * Returns the initialization vector (IV) in a new buffer.
+ *
+ * <p>This is useful in the case where a random IV has been created
+ * (see <a href = "#init">init</a>),
+ * or in the context of password-based encryption or
+ * decryption, where the IV is derived from a user-provided password.
+ *
+ * @return the initialization vector in a new buffer, or null if the
+ * underlying algorithm does not use an IV, or if the IV has not yet
+ * been set.
+ */
+ protected byte[] engineGetIV() {
+ return core.getIV();
+ }
+
+ /**
+ * Returns the parameters used with this cipher.
+ *
+ * <p>The returned parameters may be the same that were used to initialize
+ * this cipher, or may contain the default set of parameters or a set of
+ * randomly generated parameters used by the underlying cipher
+ * implementation (provided that the underlying cipher implementation
+ * uses a default set of parameters or creates new parameters if it needs
+ * parameters but was not initialized with any).
+ *
+ * @return the parameters used with this cipher, or null if this cipher
+ * does not use any parameters.
+ */
+ protected AlgorithmParameters engineGetParameters() {
+ return core.getParameters("AES");
+ }
+
+ /**
+ * Initializes this cipher with a key and a source of randomness.
+ *
+ * <p>The cipher is initialized for one of the following four operations:
+ * encryption, decryption, key wrapping or key unwrapping, depending on
+ * the value of <code>opmode</code>.
+ *
+ * <p>If this cipher requires an initialization vector (IV), it will get
+ * it from <code>random</code>.
+ * This behaviour should only be used in encryption or key wrapping
+ * mode, however.
+ * When initializing a cipher that requires an IV for decryption or
+ * key unwrapping, the IV
+ * (same IV that was used for encryption or key wrapping) must be provided
+ * explicitly as a
+ * parameter, in order to get the correct result.
+ *
+ * <p>This method also cleans existing buffer and other related state
+ * information.
+ *
+ * @param opmode the operation mode of this cipher (this is one of
+ * the following:
+ * <code>ENCRYPT_MODE</code>, <code>DECRYPT_MODE</code>,
+ * <code>WRAP_MODE</code> or <code>UNWRAP_MODE</code>)
+ * @param key the secret key
+ * @param random the source of randomness
+ *
+ * @exception InvalidKeyException if the given key is inappropriate for
+ * initializing this cipher
+ */
+ protected void engineInit(int opmode, Key key, SecureRandom random)
+ throws InvalidKeyException {
+ core.init(opmode, key, random);
+ }
+
+ /**
+ * Initializes this cipher with a key, a set of
+ * algorithm parameters, and a source of randomness.
+ *
+ * <p>The cipher is initialized for one of the following four operations:
+ * encryption, decryption, key wrapping or key unwrapping, depending on
+ * the value of <code>opmode</code>.
+ *
+ * <p>If this cipher (including its underlying feedback or padding scheme)
+ * requires any random bytes, it will get them from <code>random</code>.
+ *
+ * @param opmode the operation mode of this cipher (this is one of
+ * the following:
+ * <code>ENCRYPT_MODE</code>, <code>DECRYPT_MODE</code>,
+ * <code>WRAP_MODE</code> or <code>UNWRAP_MODE</code>)
+ * @param key the encryption key
+ * @param params the algorithm parameters
+ * @param random the source of randomness
+ *
+ * @exception InvalidKeyException if the given key is inappropriate for
+ * initializing this cipher
+ * @exception InvalidAlgorithmParameterException if the given algorithm
+ * parameters are inappropriate for this cipher
+ */
+ protected void engineInit(int opmode, Key key,
+ AlgorithmParameterSpec params,
+ SecureRandom random)
+ throws InvalidKeyException, InvalidAlgorithmParameterException {
+ core.init(opmode, key, params, random);
+ }
+
+ protected void engineInit(int opmode, Key key,
+ AlgorithmParameters params,
+ SecureRandom random)
+ throws InvalidKeyException, InvalidAlgorithmParameterException {
+ core.init(opmode, key, params, random);
+ }
+
+ /**
+ * Continues a multiple-part encryption or decryption operation
+ * (depending on how this cipher was initialized), processing another data
+ * part.
+ *
+ * <p>The first <code>inputLen</code> bytes in the <code>input</code>
+ * buffer, starting at <code>inputOffset</code>, are processed, and the
+ * result is stored in a new buffer.
+ *
+ * @param input the input buffer
+ * @param inputOffset the offset in <code>input</code> where the input
+ * starts
+ * @param inputLen the input length
+ *
+ * @return the new buffer with the result
+ *
+ * @exception IllegalStateException if this cipher is in a wrong state
+ * (e.g., has not been initialized)
+ */
+ protected byte[] engineUpdate(byte[] input, int inputOffset,
+ int inputLen) {
+ return core.update(input, inputOffset, inputLen);
+ }
+
+ /**
+ * Continues a multiple-part encryption or decryption operation
+ * (depending on how this cipher was initialized), processing another data
+ * part.
+ *
+ * <p>The first <code>inputLen</code> bytes in the <code>input</code>
+ * buffer, starting at <code>inputOffset</code>, are processed, and the
+ * result is stored in the <code>output</code> buffer, starting at
+ * <code>outputOffset</code>.
+ *
+ * @param input the input buffer
+ * @param inputOffset the offset in <code>input</code> where the input
+ * starts
+ * @param inputLen the input length
+ * @param output the buffer for the result
+ * @param outputOffset the offset in <code>output</code> where the result
+ * is stored
+ *
+ * @return the number of bytes stored in <code>output</code>
+ *
+ * @exception ShortBufferException if the given output buffer is too small
+ * to hold the result
+ */
+ protected int engineUpdate(byte[] input, int inputOffset, int inputLen,
+ byte[] output, int outputOffset)
+ throws ShortBufferException {
+ return core.update(input, inputOffset, inputLen, output,
+ outputOffset);
+ }
+
+ /**
+ * Encrypts or decrypts data in a single-part operation,
+ * or finishes a multiple-part operation.
+ * The data is encrypted or decrypted, depending on how this cipher was
+ * initialized.
+ *
+ * <p>The first <code>inputLen</code> bytes in the <code>input</code>
+ * buffer, starting at <code>inputOffset</code>, and any input bytes that
+ * may have been buffered during a previous <code>update</code> operation,
+ * are processed, with padding (if requested) being applied.
+ * The result is stored in a new buffer.
+ *
+ * <p>The cipher is reset to its initial state (uninitialized) after this
+ * call.
+ *
+ * @param input the input buffer
+ * @param inputOffset the offset in <code>input</code> where the input
+ * starts
+ * @param inputLen the input length
+ *
+ * @return the new buffer with the result
+ *
+ * @exception IllegalBlockSizeException if this cipher is a block cipher,
+ * no padding has been requested (only in encryption mode), and the total
+ * input length of the data processed by this cipher is not a multiple of
+ * block size
+ * @exception BadPaddingException if this cipher is in decryption mode,
+ * and (un)padding has been requested, but the decrypted data is not
+ * bounded by the appropriate padding bytes
+ */
+ protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
+ throws IllegalBlockSizeException, BadPaddingException {
+ return core.doFinal(input, inputOffset, inputLen);
+ }
+
+ /**
+ * Encrypts or decrypts data in a single-part operation,
+ * or finishes a multiple-part operation.
+ * The data is encrypted or decrypted, depending on how this cipher was
+ * initialized.
+ *
+ * <p>The first <code>inputLen</code> bytes in the <code>input</code>
+ * buffer, starting at <code>inputOffset</code>, and any input bytes that
+ * may have been buffered during a previous <code>update</code> operation,
+ * are processed, with padding (if requested) being applied.
+ * The result is stored in the <code>output</code> buffer, starting at
+ * <code>outputOffset</code>.
+ *
+ * <p>The cipher is reset to its initial state (uninitialized) after this
+ * call.
+ *
+ * @param input the input buffer
+ * @param inputOffset the offset in <code>input</code> where the input
+ * starts
+ * @param inputLen the input length
+ * @param output the buffer for the result
+ * @param outputOffset the offset in <code>output</code> where the result
+ * is stored
+ *
+ * @return the number of bytes stored in <code>output</code>
+ *
+ * @exception IllegalBlockSizeException if this cipher is a block cipher,
+ * no padding has been requested (only in encryption mode), and the total
+ * input length of the data processed by this cipher is not a multiple of
+ * block size
+ * @exception ShortBufferException if the given output buffer is too small
+ * to hold the result
+ * @exception BadPaddingException if this cipher is in decryption mode,
+ * and (un)padding has been requested, but the decrypted data is not
+ * bounded by the appropriate padding bytes
+ */
+ protected int engineDoFinal(byte[] input, int inputOffset, int inputLen,
+ byte[] output, int outputOffset)
+ throws IllegalBlockSizeException, ShortBufferException,
+ BadPaddingException {
+ return core.doFinal(input, inputOffset, inputLen, output,
+ outputOffset);
+ }
+
+ /**
+ * Returns the key size of the given key object.
+ *
+ * @param key the key object.
+ *
+ * @return the key size of the given key object.
+ *
+ * @exception InvalidKeyException if <code>key</code> is invalid.
+ */
+ protected int engineGetKeySize(Key key) throws InvalidKeyException {
+ byte[] encoded = key.getEncoded();
+ if (!AESCrypt.isKeySizeValid(encoded.length)) {
+ throw new InvalidKeyException("Invalid AES key length: " +
+ encoded.length + " bytes");
+ }
+ return encoded.length * 8;
+ }
+
+ /**
+ * Wrap a key.
+ *
+ * @param key the key to be wrapped.
+ *
+ * @return the wrapped key.
+ *
+ * @exception IllegalBlockSizeException if this cipher is a block
+ * cipher, no padding has been requested, and the length of the
+ * encoding of the key to be wrapped is not a
+ * multiple of the block size.
+ *
+ * @exception InvalidKeyException if it is impossible or unsafe to
+ * wrap the key with this cipher (e.g., a hardware protected key is
+ * being passed to a software only cipher).
+ */
+ protected byte[] engineWrap(Key key)
+ throws IllegalBlockSizeException, InvalidKeyException {
+ return core.wrap(key);
+ }
+
+ /**
+ * Unwrap a previously wrapped key.
+ *
+ * @param wrappedKey the key to be unwrapped.
+ *
+ * @param wrappedKeyAlgorithm the algorithm the wrapped key is for.
+ *
+ * @param wrappedKeyType the type of the wrapped key.
+ * This is one of <code>Cipher.SECRET_KEY</code>,
+ * <code>Cipher.PRIVATE_KEY</code>, or <code>Cipher.PUBLIC_KEY</code>.
+ *
+ * @return the unwrapped key.
+ *
+ * @exception NoSuchAlgorithmException if no installed providers
+ * can create keys of type <code>wrappedKeyType</code> for the
+ * <code>wrappedKeyAlgorithm</code>.
+ *
+ * @exception InvalidKeyException if <code>wrappedKey</code> does not
+ * represent a wrapped key of type <code>wrappedKeyType</code> for
+ * the <code>wrappedKeyAlgorithm</code>.
+ */
+ protected Key engineUnwrap(byte[] wrappedKey,
+ String wrappedKeyAlgorithm,
+ int wrappedKeyType)
+ throws InvalidKeyException, NoSuchAlgorithmException {
+ return core.unwrap(wrappedKey, wrappedKeyAlgorithm,
+ wrappedKeyType);
+ }
+}
Added: trunk/core/src/openjdk/com/com/sun/crypto/provider/AESConstants.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/crypto/provider/AESConstants.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/crypto/provider/AESConstants.java 2009-02-14 20:29:54 UTC (rev 5025)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code 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 General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.crypto.provider;
+
+/**
+ * This class defines the constants used by the AES implementation.
+ *
+ * @author Valerie Peng
+ *
+ *
+ * @see AESCipher
+ */
+
+interface AESConstants {
+
+ // AES block size in bytes.
+ int AES_BLOCK_SIZE = 16;
+
+ // Valid AES key sizes in bytes.
+ // NOTE: The values need to be listed in an *increasing* order
+ // since DHKeyAgreement depends on this fact.
+ int[] AES_KEYSIZES = { 16, 24, 32 };
+}
Added: trunk/core/src/openjdk/com/com/...
[truncated message content] |
|
From: <ls...@us...> - 2009-02-16 20:42:01
|
Revision: 5036
http://jnode.svn.sourceforge.net/jnode/?rev=5036&view=rev
Author: lsantha
Date: 2009-02-16 20:41:55 +0000 (Mon, 16 Feb 2009)
Log Message:
-----------
OpenJDK integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/security/AlgorithmParameterGenerator.java
trunk/core/src/openjdk/java/java/security/AllPermission.java
trunk/core/src/openjdk/java/java/security/BasicPermission.java
trunk/core/src/openjdk/java/java/security/DigestInputStream.java
trunk/core/src/openjdk/java/java/security/DigestOutputStream.java
trunk/core/src/openjdk/java/java/security/GuardedObject.java
trunk/core/src/openjdk/java/java/security/Identity.java
trunk/core/src/openjdk/java/java/security/IdentityScope.java
trunk/core/src/openjdk/java/java/security/KeyFactory.java
trunk/core/src/openjdk/java/java/security/MessageDigest.java
trunk/core/src/openjdk/java/java/security/MessageDigestSpi.java
trunk/core/src/openjdk/java/java/security/Permission.java
trunk/core/src/openjdk/java/java/security/PermissionCollection.java
trunk/core/src/openjdk/java/java/security/Permissions.java
trunk/core/src/openjdk/java/java/security/SecureRandom.java
trunk/core/src/openjdk/java/java/security/Security.java
trunk/core/src/openjdk/java/java/security/SecurityPermission.java
trunk/core/src/openjdk/java/java/security/Signature.java
trunk/core/src/openjdk/java/java/security/SignedObject.java
trunk/core/src/openjdk/java/java/security/Signer.java
trunk/core/src/openjdk/java/java/security/UnresolvedPermission.java
trunk/core/src/openjdk/java/java/security/UnresolvedPermissionCollection.java
trunk/core/src/openjdk/java/java/util/jar/Attributes.java
trunk/core/src/openjdk/java/java/util/jar/JarEntry.java
trunk/core/src/openjdk/java/java/util/jar/JarException.java
trunk/core/src/openjdk/java/java/util/jar/JarFile.java
trunk/core/src/openjdk/java/java/util/jar/JarInputStream.java
trunk/core/src/openjdk/java/java/util/jar/JarOutputStream.java
trunk/core/src/openjdk/java/java/util/jar/JarVerifier.java
trunk/core/src/openjdk/java/java/util/jar/Manifest.java
trunk/core/src/openjdk/java/java/util/jar/package.html
trunk/core/src/openjdk/sun/sun/security/provider/ConfigSpiFile.java
trunk/core/src/openjdk/sun/sun/security/provider/PolicySpiFile.java
trunk/core/src/openjdk/sun/sun/security/provider/SecureRandom.java
trunk/core/src/openjdk/sun/sun/security/provider/SeedGenerator.java
trunk/core/src/openjdk/sun/sun/security/provider/Sun.java
trunk/core/src/openjdk/sun/sun/security/provider/SunEntries.java
trunk/core/src/openjdk/sun/sun/security/provider/VerificationProvider.java
trunk/core/src/openjdk/sun/sun/security/util/ManifestEntryVerifier.java
trunk/core/src/openjdk/svm/sun/security/
trunk/core/src/openjdk/svm/sun/security/provider/
trunk/core/src/openjdk/svm/sun/security/provider/NativePRNG.java
trunk/core/src/openjdk/vm/java/util/jar/
trunk/core/src/openjdk/vm/java/util/jar/NativeJarFile.java
trunk/core/src/openjdk/vm/sun/security/
trunk/core/src/openjdk/vm/sun/security/provider/
trunk/core/src/openjdk/vm/sun/security/provider/NativeSeedGenerator.java
Removed Paths:
-------------
trunk/core/src/classpath/java/java/security/AlgorithmParameterGenerator.java
trunk/core/src/classpath/java/java/security/AllPermission.java
trunk/core/src/classpath/java/java/security/BasicPermission.java
trunk/core/src/classpath/java/java/security/DigestInputStream.java
trunk/core/src/classpath/java/java/security/DigestOutputStream.java
trunk/core/src/classpath/java/java/security/DummyMessageDigest.java
trunk/core/src/classpath/java/java/security/DummySignature.java
trunk/core/src/classpath/java/java/security/GuardedObject.java
trunk/core/src/classpath/java/java/security/Identity.java
trunk/core/src/classpath/java/java/security/IdentityScope.java
trunk/core/src/classpath/java/java/security/IntersectingDomainCombiner.java
trunk/core/src/classpath/java/java/security/KeyFactory.java
trunk/core/src/classpath/java/java/security/MessageDigest.java
trunk/core/src/classpath/java/java/security/MessageDigestSpi.java
trunk/core/src/classpath/java/java/security/Permission.java
trunk/core/src/classpath/java/java/security/PermissionCollection.java
trunk/core/src/classpath/java/java/security/Permissions.java
trunk/core/src/classpath/java/java/security/SecureRandom.java
trunk/core/src/classpath/java/java/security/Security.java
trunk/core/src/classpath/java/java/security/SecurityPermission.java
trunk/core/src/classpath/java/java/security/Signature.java
trunk/core/src/classpath/java/java/security/SignedObject.java
trunk/core/src/classpath/java/java/security/Signer.java
trunk/core/src/classpath/java/java/security/UnresolvedPermission.java
trunk/core/src/classpath/java/java/util/jar/
Deleted: trunk/core/src/classpath/java/java/security/AlgorithmParameterGenerator.java
===================================================================
--- trunk/core/src/classpath/java/java/security/AlgorithmParameterGenerator.java 2009-02-16 20:38:42 UTC (rev 5035)
+++ trunk/core/src/classpath/java/java/security/AlgorithmParameterGenerator.java 2009-02-16 20:41:55 UTC (rev 5036)
@@ -1,259 +0,0 @@
-/* AlgorithmParameterGenerator.java --- Algorithm Parameter Generator
- Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath 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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.security;
-
-import gnu.java.security.Engine;
-
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * <code>AlgorithmParameterGenerator</code> is used to generate algorithm
- * parameters for specified algorithms.
- *
- * <p>In case the client does not explicitly initialize the
- * <code>AlgorithmParameterGenerator</code> (via a call to an
- * <code>init()</code> method), each provider must supply (and document) a
- * default initialization. For example, the <b>GNU</b> provider uses a default
- * modulus prime size of <code>1024</code> bits for the generation of <i>DSA</i>
- * parameters.
- *
- * @author Mark Benvenuto
- * @since 1.2
- * @see AlgorithmParameters
- * @see AlgorithmParameterSpec
- */
-public class AlgorithmParameterGenerator
-{
- /** Service name for algorithm parameter generators. */
- private static final String ALGORITHM_PARAMETER_GENERATOR =
- "AlgorithmParameterGenerator";
-
- private AlgorithmParameterGeneratorSpi paramGenSpi;
- private Provider provider;
- private String algorithm;
-
- /**
- * Constructs a new instance of <code>AlgorithmParameterGenerator</code>.
- *
- * @param paramGenSpi
- * the generator to use.
- * @param provider
- * the provider to use.
- * @param algorithm
- * the algorithm to use.
- */
- protected AlgorithmParameterGenerator(AlgorithmParameterGeneratorSpi
- paramGenSpi, Provider provider,
- String algorithm)
- {
- this.paramGenSpi = paramGenSpi;
- this.provider = provider;
- this.algorithm = algorithm;
- }
-
- /** @return the name of the algorithm. */
- public final String getAlgorithm()
- {
- return algorithm;
- }
-
- /**
- * Returns a new <code>AlgorithmParameterGenerator</code> instance which
- * generates algorithm parameters for the specified algorithm.
- *
- * @param algorithm
- * the name of algorithm to use.
- * @return the new instance.
- * @throws NoSuchAlgorithmException
- * if <code>algorithm</code> is not implemented by any provider.
- */
- public static AlgorithmParameterGenerator getInstance(String algorithm)
- throws NoSuchAlgorithmException
- {
- Provider[] p = Security.getProviders();
- for (int i = 0; i < p.length; i++)
- try
- {
- return getInstance(algorithm, p[i]);
- }
- catch (NoSuchAlgorithmException e)
- {
- // Ignore.
- }
-
- throw new NoSuchAlgorithmException(algorithm);
- }
-
- /**
- * Returns a new <code>AlgorithmParameterGenerator</code> instance which
- * generates algorithm parameters for the specified algorithm.
- *
- * @param algorithm
- * the name of algorithm to use.
- * @param provider
- * the name of the {@link Provider} to use.
- * @return the new instance.
- * @throws NoSuchAlgorithmException
- * if the algorithm is not implemented by the named provider.
- * @throws NoSuchProviderException
- * if the named provider was not found.
- */
- public static AlgorithmParameterGenerator getInstance(String algorithm,
- String provider)
- throws NoSuchAlgorithmException, NoSuchProviderException
- {
- if (provider == null || provider.length() == 0)
- throw new IllegalArgumentException("Illegal provider");
-
- Provider p = Security.getProvider(provider);
- if (p == null)
- throw new NoSuchProviderException(provider);
-
- return getInstance(algorithm, p);
- }
-
- /**
- * Returns a new <code>AlgorithmParameterGenerator</code> instance which
- * generates algorithm parameters for the specified algorithm.
- *
- * @param algorithm
- * the name of algorithm to use.
- * @param provider
- * the {@link Provider} to use.
- * @return the new instance.
- * @throws NoSuchAlgorithmException
- * if the algorithm is not implemented by {@link Provider}.
- * @since 1.4
- * @see Provider
- */
- public static AlgorithmParameterGenerator getInstance(String algorithm,
- Provider provider)
- throws NoSuchAlgorithmException
- {
- if (provider == null)
- throw new IllegalArgumentException("Illegal provider");
-
- try
- {
- return new AlgorithmParameterGenerator(
- (AlgorithmParameterGeneratorSpi) Engine.getInstance(
- ALGORITHM_PARAMETER_GENERATOR, algorithm, provider),
- provider, algorithm);
- }
- catch (java.lang.reflect.InvocationTargetException ite)
- {
- throw new NoSuchAlgorithmException(algorithm);
- }
- catch (ClassCastException cce)
- {
- throw new NoSuchAlgorithmException(algorithm);
- }
- }
-
- /** @return the {@link Provider} of this generator. */
- public final Provider getProvider()
- {
- return provider;
- }
-
- /**
- * Initializes this instance with the specified size. Since no source of
- * randomness is supplied, a default one will be used.
- *
- * @param size
- * size (in bits) to use.
- */
- public final void init(int size)
- {
- init(size, new SecureRandom());
- }
-
- /**
- * Initializes this instance with the specified key-size and source of
- * randomness.
- *
- * @param size
- * the size (in bits) to use.
- * @param random
- * the {@link SecureRandom} to use.
- */
- public final void init(int size, SecureRandom random)
- {
- paramGenSpi.engineInit(size, random);
- }
-
- /**
- * Initializes this instance with the specified {@link AlgorithmParameterSpec}.
- * Since no source of randomness is supplied, a default one will be used.
- *
- * @param genParamSpec
- * the {@link AlgorithmParameterSpec} to use.
- * @throws InvalidAlgorithmParameterException
- * if <code>genParamSpec</code> is invalid.
- */
- public final void init(AlgorithmParameterSpec genParamSpec)
- throws InvalidAlgorithmParameterException
- {
- init(genParamSpec, new SecureRandom());
- }
-
- /**
- * Initializes this instance with the specified {@link AlgorithmParameterSpec}
- * and source of randomness.
- *
- * @param genParamSpec
- * the {@link AlgorithmParameterSpec} to use.
- * @param random
- * the {@link SecureRandom} to use.
- * @throws InvalidAlgorithmParameterException
- * if <code>genParamSpec</code> is invalid.
- */
- public final void init(AlgorithmParameterSpec genParamSpec,
- SecureRandom random)
- throws InvalidAlgorithmParameterException
- {
- paramGenSpi.engineInit(genParamSpec, random);
- }
-
- /** @return a new instance of {@link AlgorithmParameters}. */
- public final AlgorithmParameters generateParameters()
- {
- return paramGenSpi.engineGenerateParameters();
- }
-}
Deleted: trunk/core/src/classpath/java/java/security/AllPermission.java
===================================================================
--- trunk/core/src/classpath/java/java/security/AllPermission.java 2009-02-16 20:38:42 UTC (rev 5035)
+++ trunk/core/src/classpath/java/java/security/AllPermission.java 2009-02-16 20:41:55 UTC (rev 5036)
@@ -1,198 +0,0 @@
-/* AllPermission.java -- Permission to do anything
- Copyright (C) 1998, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath 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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.security;
-
-import gnu.java.util.EmptyEnumeration;
-
-import java.util.Collections;
-import java.util.Enumeration;
-
-/**
- * This class is a permission that implies all other permissions. Granting
- * this permission effectively grants all others. Extreme caution should
- * be exercised in granting this permission.
- *
- * @author Aaron M. Renn (ar...@ur...)
- * @author Eric Blake (eb...@em...)
- * @see AccessController
- * @see Permissions
- * @see SecurityManager
- * @since 1.1
- * @status updated to 1.4
- */
-public final class AllPermission extends Permission
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -2916474571451318075L;
-
- /**
- * Create a new AllPermission object.
- */
- public AllPermission()
- {
- super("*");
- }
-
- /**
- * Create a new AllPermission object. The parameters are ignored, as all
- * permission implies ALL PERMISSION.
- *
- * @param name ignored
- * @param actions ignored
- */
- public AllPermission(String name, String actions)
- {
- super("*");
- }
-
- /**
- * This method always returns <code>true</code> to indicate that this
- * permission always implies that any other permission is also granted.
- *
- * @param perm ignored
- * @return true, the permission is implied
- */
- public boolean implies(Permission perm)
- {
- return true;
- }
-
- /**
- * Checks an object for equality. All AllPermissions are equal.
- *
- * @param obj the <code>Object</code> to test for equality
- */
- public boolean equals(Object obj)
- {
- return obj instanceof AllPermission;
- }
-
- /**
- * This method returns a hash code for this object. This returns 1.
- *
- * @return a hash value for this object
- */
- public int hashCode()
- {
- return 1;
- }
-
- /**
- * This method returns the list of actions associated with this object.
- * This will always be the empty string ("") for this class.
- *
- * @return the action list
- */
- public String getActions()
- {
- return "";
- }
-
- /**
- * Returns a PermissionCollection which can hold AllPermission.
- *
- * @return a permission collection
- */
- public PermissionCollection newPermissionCollection()
- {
- return new AllPermissionCollection();
- }
-
- /**
- * Implements AllPermission.newPermissionCollection, and obeys serialization
- * of JDK.
- *
- * @author Eric Blake (eb...@em...)
- */
- private static final class AllPermissionCollection extends PermissionCollection
- {
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -4023755556366636806L;
-
- /**
- * Whether an AllPermission has been added to the collection.
- *
- * @serial if all permission is in the collection yet
- */
- private boolean all_allowed;
-
- /**
- * Add an AllPermission.
- *
- * @param perm the permission to add
- * @throws IllegalArgumentException if perm is not an AllPermission
- * @throws SecurityException if the collection is read-only
- */
- public void add(Permission perm)
- {
- if (isReadOnly())
- throw new SecurityException();
- if (! (perm instanceof AllPermission))
- throw new IllegalArgumentException();
- all_allowed = true;
- }
-
- /**
- * Returns true if this collection implies a permission.
- *
- * @param perm the permission to check
- * @return true if this collection contains an AllPermission
- */
- public boolean implies(Permission perm)
- {
- return all_allowed;
- }
-
- /**
- * Returns an enumeration of the elements in the collection.
- *
- * @return the elements in the collection
- */
- public Enumeration elements()
- {
- return all_allowed
- ? Collections.enumeration(Collections.singleton(new AllPermission()))
- : EmptyEnumeration.getInstance();
- }
- } // class AllPermissionCollection
-} // class AllPermission
Deleted: trunk/core/src/classpath/java/java/security/BasicPermission.java
===================================================================
--- trunk/core/src/classpath/java/java/security/BasicPermission.java 2009-02-16 20:38:42 UTC (rev 5035)
+++ trunk/core/src/classpath/java/java/security/BasicPermission.java 2009-02-16 20:41:55 UTC (rev 5036)
@@ -1,308 +0,0 @@
-/* BasicPermission.java -- implements a simple named permission
- Copyright (C) 1998, 1999, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath 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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.security;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-/**
- * This class implements a simple model for named permissions without an
- * associated action list. That is, either the named permission is granted
- * or it is not.
- *
- * <p>It also supports trailing wildcards to allow the easy granting of
- * permissions in a hierarchical fashion. (For example, the name "org.gnu.*"
- * might grant all permissions under the "org.gnu" permissions hierarchy).
- * The only valid wildcard character is a '*' which matches anything. It
- * must be the rightmost element in the permission name and must follow a
- * '.' or else the Permission name must consist of only a '*'. Any other
- * occurrence of a '*' is not valid.
- *
- * <p>This class ignores the action list. Subclasses can choose to implement
- * actions on top of this class if desired.
- *
- * @author Aaron M. Renn (ar...@ur...)
- * @author Eric Blake (eb...@em...)
- * @see Permission
- * @see Permissions
- * @see PermissionCollection
- * @see RuntimePermission
- * @see SecurityPermission
- * @see PropertyPermission
- * @see AWTPermission
- * @see NetPermission
- * @see SecurityManager
- * @since 1.1
- * @status updated to 1.4
- */
-public abstract class BasicPermission extends Permission
- implements Serializable
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 6279438298436773498L;
-
- /**
- * Create a new instance with the specified permission name. If the
- * name is empty an exception is thrown.
- *
- * @param name the name of this permission
- * @throws NullPointerException if name is null
- * @throws IllegalArgumentException if name is invalid
- */
- public BasicPermission(String name)
- {
- super(name);
-
- // This routine used to check for illegal wildcards, but no such
- // requirement exists in the specification and Sun's runtime
- // doesn't appear to do it.
-
- if (name.equals(""))
- throw new IllegalArgumentException("Empty name");
- }
-
- /**
- * Create a new instance with the specified permission name. If the name
- * is empty, or contains an illegal wildcard character, an exception is
- * thrown. The actions parameter is ignored.
- *
- * @param name the name of this permission
- * @param actions ignored
- * @throws NullPointerException if name is null
- * @throws IllegalArgumentException if name is invalid
- */
- public BasicPermission(String name, String actions)
- {
- this(name);
- }
-
- /**
- * This method tests to see if the specified permission is implied by this
- * permission. This will be true if the following conditions are met:<ul>
- * <li>The specified object is an instance of the same class as this
- * object.</li>
- * <li>The name of the specified permission is implied by this permission's
- * name based on wildcard matching. For example, "a.*" implies "a.b".</li>
- * </ul>
- *
- * @param perm the <code>Permission</code> object to test against
- * @return true if the specified permission is implied
- */
- public boolean implies(Permission perm)
- {
- if (! getClass().isInstance(perm))
- return false;
-
- String otherName = perm.getName();
- String name = getName();
-
- if (name.equals(otherName))
- return true;
-
- int last = name.length() - 1;
- return name.charAt(last) == '*'
- && otherName.startsWith(name.substring(0, last));
- }
-
- /**
- * This method tests to see if this object is equal to the specified
- * <code>Object</code>. This will be true if and only if the specified
- * object meets the following conditions:<ul>
- * <li>It is an instance of the same class as this.</li>
- * <li>It has the same name as this permission.</li>
- * </ul>
- *
- * @param obj the <code>Object</code> to test for equality
- * @return true if obj is semantically equal to this
- */
- public boolean equals(Object obj)
- {
- return getClass().isInstance(obj)
- && getName().equals(((BasicPermission) obj).getName());
- }
-
- /**
- * This method returns a hash code for this permission object. The hash
- * code returned is the value returned by calling the <code>hashCode</code>
- * method on the <code>String</code> that is the name of this permission.
- *
- * @return a hash value for this object
- */
- public int hashCode()
- {
- return getName().hashCode();
- }
-
- /**
- * This method returns a list of the actions associated with this
- * permission. This method always returns the empty string ("") since
- * this class ignores actions.
- *
- * @return the action list
- */
- public String getActions()
- {
- return "";
- }
-
- /**
- * This method returns an instance of <code>PermissionCollection</code>
- * suitable for storing <code>BasicPermission</code> objects. The
- * collection returned can only store objects of the same type as this.
- * Subclasses which use actions must override this method; but a class with
- * no actions will work fine with this.
- *
- * @return a new empty <code>PermissionCollection</code> object
- */
- public PermissionCollection newPermissionCollection()
- {
- return new BasicPermissionCollection(getClass());
- }
-
- /**
- * Implements AllPermission.newPermissionCollection, and obeys serialization
- * of JDK.
- *
- * @author Eric Blake (eb...@em...)
- */
- private static final class BasicPermissionCollection extends PermissionCollection
- {
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 739301742472979399L;
-
- /**
- * The permissions in the collection.
- *
- * @serial a hash mapping name to permissions, all of type permClass
- */
- private final Hashtable permissions = new Hashtable();
-
- /**
- * If "*" is in the collection.
- *
- * @serial true if a permission named "*" is in the collection
- */
- private boolean all_allowed;
-
- /**
- * The runtime class which all entries in the table must belong to.
- *
- * @serial the limiting subclass of this collection
- */
- private final Class permClass;
-
- /**
- * Construct a collection over the given runtime class.
- *
- * @param c the class
- */
- BasicPermissionCollection(Class c)
- {
- permClass = c;
- }
-
- /**
- * Add a Permission. It must be of the same type as the permission which
- * created this collection.
- *
- * @param perm the permission to add
- * @throws IllegalArgumentException if perm is not the correct type
- * @throws SecurityException if the collection is read-only
- */
- public void add(Permission perm)
- {
- if (isReadOnly())
- throw new SecurityException("readonly");
- if (! permClass.isInstance(perm))
- throw new IllegalArgumentException("Expecting instance of " + permClass);
- BasicPermission bp = (BasicPermission) perm;
- String name = bp.getName();
- if (name.equals("*"))
- all_allowed = true;
- permissions.put(name, bp);
- }
-
- /**
- * Returns true if this collection implies the given permission.
- *
- * @param permission the permission to check
- * @return true if it is implied by this
- */
- public boolean implies(Permission permission)
- {
- if (! permClass.isInstance(permission))
- return false;
- if (all_allowed)
- return true;
- BasicPermission toImply = (BasicPermission) permission;
- String name = toImply.getName();
- if (name.equals("*"))
- return false;
- int prefixLength = name.length();
- if (name.endsWith("*"))
- prefixLength -= 2;
-
- w...
[truncated message content] |
|
From: <ls...@us...> - 2009-03-01 08:55:35
|
Revision: 5077
http://jnode.svn.sourceforge.net/jnode/?rev=5077&view=rev
Author: lsantha
Date: 2009-03-01 08:55:23 +0000 (Sun, 01 Mar 2009)
Log Message:
-----------
OpenJDK integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/lang/ref/
trunk/core/src/openjdk/java/java/lang/ref/FinalReference.java
trunk/core/src/openjdk/java/java/lang/ref/Finalizer.java
trunk/core/src/openjdk/java/java/lang/ref/PhantomReference.java
trunk/core/src/openjdk/java/java/lang/ref/Reference.java
trunk/core/src/openjdk/java/java/lang/ref/ReferenceQueue.java
trunk/core/src/openjdk/java/java/lang/ref/SoftReference.java
trunk/core/src/openjdk/java/java/lang/ref/WeakReference.java
trunk/core/src/openjdk/java/java/lang/ref/package.html
trunk/core/src/openjdk/vm/java/lang/ref/
trunk/core/src/openjdk/vm/java/lang/ref/NativeFinalizer.java
Removed Paths:
-------------
trunk/core/src/classpath/java/java/lang/ref/
Added: trunk/core/src/openjdk/java/java/lang/ref/FinalReference.java
===================================================================
--- trunk/core/src/openjdk/java/java/lang/ref/FinalReference.java (rev 0)
+++ trunk/core/src/openjdk/java/java/lang/ref/FinalReference.java 2009-03-01 08:55:23 UTC (rev 5077)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code 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 General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.lang.ref;
+
+
+/* Final references, used to implement finalization */
+
+class FinalReference<T> extends Reference<T> {
+
+ public FinalReference(T referent, ReferenceQueue<? super T> q) {
+ super(referent, q);
+ }
+
+}
Added: trunk/core/src/openjdk/java/java/lang/ref/Finalizer.java
===================================================================
--- trunk/core/src/openjdk/java/java/lang/ref/Finalizer.java (rev 0)
+++ trunk/core/src/openjdk/java/java/lang/ref/Finalizer.java 2009-03-01 08:55:23 UTC (rev 5077)
@@ -0,0 +1,197 @@
+/*
+ * Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code 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 General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.lang.ref;
+
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+
+
+final class Finalizer extends FinalReference { /* Package-private; must be in
+ same package as the Reference
+ class */
+
+ /* A native method that invokes an arbitrary object's finalize method is
+ required since the finalize method is protected
+ */
+ static native void invokeFinalizeMethod(Object o) throws Throwable;
+
+ static private ReferenceQueue queue = new ReferenceQueue();
+ static private Finalizer unfinalized = null;
+ static private Object lock = new Object();
+
+ private Finalizer
+ next = null,
+ prev = null;
+
+ private boolean hasBeenFinalized() {
+ return (next == this);
+ }
+
+ private void add() {
+ synchronized (lock) {
+ if (unfinalized != null) {
+ this.next = unfinalized;
+ unfinalized.prev = this;
+ }
+ unfinalized = this;
+ }
+ }
+
+ private void remove() {
+ synchronized (lock) {
+ if (unfinalized == this) {
+ if (this.next != null) {
+ unfinalized = this.next;
+ } else {
+ unfinalized = this.prev;
+ }
+ }
+ if (this.next != null) {
+ this.next.prev = this.prev;
+ }
+ if (this.prev != null) {
+ this.prev.next = this.next;
+ }
+ this.next = this; /* Indicates that this has been finalized */
+ this.prev = this;
+ }
+ }
+
+ private Finalizer(Object finalizee) {
+ super(finalizee, queue);
+ add();
+ }
+
+ /* Invoked by VM */
+ static void register(Object finalizee) {
+ new Finalizer(finalizee);
+ }
+
+ private void runFinalizer() {
+ synchronized (this) {
+ if (hasBeenFinalized()) return;
+ remove();
+ }
+ try {
+ Object finalizee = this.get();
+ if (finalizee != null && !(finalizee instanceof java.lang.Enum)) {
+ invokeFinalizeMethod(finalizee);
+ /* Clear stack slot containing this variable, to decrease
+ the chances of false retention with a conservative GC */
+ finalizee = null;
+ }
+ } catch (Throwable x) { }
+ super.clear();
+ }
+
+ /* Create a privileged secondary finalizer thread in the system thread
+ group for the given Runnable, and wait for it to complete.
+
+ This method is used by both runFinalization and runFinalizersOnExit.
+ The former method invokes all pending finalizers, while the latter
+ invokes all uninvoked finalizers if on-exit finalization has been
+ enabled.
+
+ These two methods could have been implemented by offloading their work
+ to the regular finalizer thread and waiting for that thread to finish.
+ The advantage of creating a fresh thread, however, is that it insulates
+ invokers of these methods from a stalled or deadlocked finalizer thread.
+ */
+ private static void forkSecondaryFinalizer(final Runnable proc) {
+ PrivilegedAction pa = new PrivilegedAction() {
+ public Object run() {
+ ThreadGroup tg = Thread.currentThread().getThreadGroup();
+ for (ThreadGroup tgn = tg;
+ tgn != null;
+ tg = tgn, tgn = tg.getParent());
+ Thread sft = new Thread(tg, proc, "Secondary finalizer");
+ sft.start();
+ try {
+ sft.join();
+ } catch (InterruptedException x) {
+ /* Ignore */
+ }
+ return null;
+ }};
+ AccessController.doPrivileged(pa);
+ }
+
+ /* Called by Runtime.runFinalization() */
+ static void runFinalization() {
+ forkSecondaryFinalizer(new Runnable() {
+ public void run() {
+ for (;;) {
+ Finalizer f = (Finalizer)queue.poll();
+ if (f == null) break;
+ f.runFinalizer();
+ }
+ }
+ });
+ }
+
+ /* Invoked by java.lang.Shutdown */
+ static void runAllFinalizers() {
+ forkSecondaryFinalizer(new Runnable() {
+ public void run() {
+ for (;;) {
+ Finalizer f;
+ synchronized (lock) {
+ f = unfinalized;
+ if (f == null) break;
+ unfinalized = f.next;
+ }
+ f.runFinalizer();
+ }}});
+ }
+
+ private static class FinalizerThread extends Thread {
+ FinalizerThread(ThreadGroup g) {
+ super(g, "Finalizer");
+ }
+ public void run() {
+ for (;;) {
+ try {
+ Finalizer f = (Finalizer)queue.remove();
+ f.runFinalizer();
+ } catch (InterruptedException x) {
+ continue;
+ }
+ }
+ }
+ }
+
+ static {
+ ThreadGroup tg = Thread.currentThread().getThreadGroup();
+ for (ThreadGroup tgn = tg;
+ tgn != null;
+ tg = tgn, tgn = tg.getParent());
+ Thread finalizer = new FinalizerThread(tg);
+ finalizer.setPriority(Thread.MAX_PRIORITY - 2);
+ finalizer.setDaemon(true);
+ finalizer.start();
+ }
+
+}
Added: trunk/core/src/openjdk/java/java/lang/ref/PhantomReference.java
===================================================================
--- trunk/core/src/openjdk/java/java/lang/ref/PhantomReference.java (rev 0)
+++ trunk/core/src/openjdk/java/java/lang/ref/PhantomReference.java 2009-03-01 08:55:23 UTC (rev 5077)
@@ -0,0 +1,83 @@
+/*
+ * Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code 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 General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.lang.ref;
+
+
+/**
+ * Phantom reference objects, which are enqueued after the collector
+ * determines that their referents may otherwise be reclaimed. Phantom
+ * references are most often used for scheduling pre-mortem cleanup actions in
+ * a more flexible way than is possible with the Java finalization mechanism.
+ *
+ * <p> If the garbage collector determines at a certain point in time that the
+ * referent of a phantom reference is <a
+ * href="package-summary.html#reachability">phantom reachable</a>, then at that
+ * time or at some later time it will enqueue the reference.
+ *
+ * <p> In order to ensure that a reclaimable object remains so, the referent of
+ * a phantom reference may not be retrieved: The <code>get</code> method of a
+ * phantom reference always returns <code>null</code>.
+ *
+ * <p> Unlike soft and weak references, phantom references are not
+ * automatically cleared by the garbage collector as they are enqueued. An
+ * object that is reachable via phantom references will remain so until all
+ * such references are cleared or themselves become unreachable.
+ *
+ * @author Mark Reinhold
+ * @since 1.2
+ */
+
+public class PhantomReference<T> extends Reference<T> {
+
+ /**
+ * Returns this reference object's referent. Because the referent of a
+ * phantom reference is always inaccessible, this method always returns
+ * <code>null</code>.
+ *
+ * @return <code>null</code>
+ */
+ public T get() {
+ return null;
+ }
+
+ /**
+ * Creates a new phantom reference that refers to the given object and
+ * is registered with the given queue.
+ *
+ * <p> It is possible to create a phantom reference with a <tt>null</tt>
+ * queue, but such a reference is completely useless: Its <tt>get</tt>
+ * method will always return null and, since it does not have a queue, it
+ * will never be enqueued.
+ *
+ * @param referent the object the new phantom reference will refer to
+ * @param q the queue with which the reference is to be registered,
+ * or <tt>null</tt> if registration is not required
+ */
+ public PhantomReference(T referent, ReferenceQueue<? super T> q) {
+ super(referent, q);
+ }
+
+}
Added: trunk/core/src/openjdk/java/java/lang/ref/Reference.java
===================================================================
--- trunk/core/src/openjdk/java/java/lang/ref/Reference.java (rev 0)
+++ trunk/core/src/openjdk/java/java/lang/ref/Reference.java 2009-03-01 08:55:23 UTC (rev 5077)
@@ -0,0 +1,238 @@
+/*
+ * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code 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 General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.lang.ref;
+
+import sun.misc.Cleaner;
+
+
+/**
+ * Abstract base class for reference objects. This class defines the
+ * operations common to all reference objects. Because reference objects are
+ * implemented in close cooperation with the garbage collector, this class may
+ * not be subclassed directly.
+ *
+ * @author Mark Reinhold
+ * @since 1.2
+ */
+
+public abstract class Reference<T> {
+
+ /* A Reference instance is in one of four possible internal states:
+ *
+ * Active: Subject to special treatment by the garbage collector. Some
+ * time after the collector detects that the reachability of the
+ * referent has changed to the appropriate state, it changes the
+ * instance's state to either Pending or Inactive, depending upon
+ * whether or not the instance was registered with a queue when it was
+ * created. In the former case it also adds the instance to the
+ * pending-Reference list. Newly-created instances are Active.
+ *
+ * Pending: An element of the pending-Reference list, waiting to be
+ * enqueued by the Reference-handler thread. Unregistered instances
+ * are never in this state.
+ *
+ * Enqueued: An element of the queue with which the instance was
+ * registered when it was created. When an instance is removed from
+ * its ReferenceQueue, it is made Inactive. Unregistered instances are
+ * never in this state.
+ *
+ * Inactive: Nothing more to do. Once an instance becomes Inactive its
+ * state will never change again.
+ *
+ * The state is encoded in the queue and next fields as follows:
+ *
+ * Active: queue = ReferenceQueue with which instance is registered, or
+ * ReferenceQueue.NULL if it was not registered with a queue; next =
+ * null.
+ *
+ * Pending: queue = ReferenceQueue with which instance is registered;
+ * next = Following instance in queue, or this if at end of list.
+ *
+ * Enqueued: queue = ReferenceQueue.ENQUEUED; next = Following instance
+ * in queue, or this if at end of list.
+ *
+ * Inactive: queue = ReferenceQueue.NULL; next = this.
+ *
+ * With this scheme the collector need only examine the next field in order
+ * to determine whether a Reference instance requires special treatment: If
+ * the next field is null then the instance is active; if it is non-null,
+ * then the collector should treat the instance normally.
+ *
+ * To ensure that concurrent collector can discover active Reference
+ * objects without interfering with application threads that may apply
+ * the enqueue() method to those objects, collectors should link
+ * discovered objects through the discovered field.
+ */
+
+ private T referent; /* Treated specially by GC */
+
+ ReferenceQueue<? super T> queue;
+
+ Reference next;
+ transient private Reference<T> discovered; /* used by VM */
+
+
+ /* Object used to synchronize with the garbage collector. The collector
+ * must acquire this lock at the beginning of each collection cycle. It is
+ * therefore critical that any code holding this lock complete as quickly
+ * as possible, allocate no new objects, and avoid calling user code.
+ */
+ static private class Lock { };
+ private static Lock lock = new Lock();
+
+
+ /* List of References waiting to be enqueued. The collector adds
+ * References to this list, while the Reference-handler thread removes
+ * them. This list is protected by the above lock object.
+ */
+ private static Reference pending = null;
+
+ /* High-priority thread to enqueue pending References
+ */
+ private static class ReferenceHandler extends Thread {
+
+ ReferenceHandler(ThreadGroup g, String name) {
+ super(g, name);
+ }
+
+ public void run() {
+ for (;;) {
+
+ Reference r;
+ synchronized (lock) {
+ if (pending != null) {
+ r = pending;
+ Reference rn = r.next;
+ pending = (rn == r) ? null : rn;
+ r.next = r;
+ } else {
+ try {
+ lock.wait();
+ } catch (InterruptedException x) { }
+ continue;
+ }
+ }
+
+ // Fast path for cleaners
+ if (r instanceof Cleaner) {
+ ((Cleaner)r).clean();
+ continue;
+ }
+
+ ReferenceQueue q = r.queue;
+ if (q != ReferenceQueue.NULL) q.enqueue(r);
+ }
+ }
+ }
+
+ static {
+ ThreadGroup tg = Thread.currentThread().getThreadGroup();
+ for (ThreadGroup tgn = tg;
+ tgn != null;
+ tg = tgn, tgn = tg.getParent());
+ Thread handler = new ReferenceHandler(tg, "Reference Handler");
+ /* If there were a special system-only priority greater than
+ * MAX_PRIORITY, it would be used here
+ */
+ handler.setPriority(Thread.MAX_PRIORITY);
+ handler.setDaemon(true);
+ handler.start();
+ }
+
+
+ /* -- Referent accessor and setters -- */
+
+ /**
+ * Returns this reference object's referent. If this reference object has
+ * been cleared, either by the program or by the garbage collector, then
+ * this method returns <code>null</code>.
+ *
+ * @return The object to which this reference refers, or
+ * <code>null</code> if this reference object has been cleared
+ */
+ public T get() {
+ return this.referent;
+ }
+
+ /**
+ * Clears this reference object. Invoking this method will not cause this
+ * object to be enqueued.
+ *
+ * <p> This method is invoked only by Java code; when the garbage collector
+ * clears references it does so directly, without invoking this method.
+ */
+ public void clear() {
+ this.referent = null;
+ }
+
+
+ /* -- Queue operations -- */
+
+ /**
+ * Tells whether or not this reference object has been enqueued, either by
+ * the program or by the garbage collector. If this reference object was
+ * not registered with a queue when it was created, then this method will
+ * always return <code>false</code>.
+ *
+ * @return <code>true</code> if and only if this reference object has
+ * been enqueued
+ */
+ public boolean isEnqueued() {
+ /* In terms of the internal states, this predicate actually tests
+ whether the instance is either Pending or Enqueued */
+ synchronized (this) {
+ return (this.queue != ReferenceQueue.NULL) && (this.next != null);
+ }
+ }
+
+ /**
+ * Adds this reference object to the queue with which it is registered,
+ * if any.
+ *
+ * <p> This method is invoked only by Java code; when the garbage collector
+ * enqueues references it does so directly, without invoking this method.
+ *
+ * @return <code>true</code> if this reference object was successfully
+ * enqueued; <code>false</code> if it was already enqueued or if
+ * it was not registered with a queue when it was created
+ */
+ public boolean enqueue() {
+ return this.queue.enqueue(this);
+ }
+
+
+ /* -- Constructors -- */
+
+ Reference(T referent) {
+ this(referent, null);
+ }
+
+ Reference(T referent, ReferenceQueue<? super T> queue) {
+ this.referent = referent;
+ this.queue = (queue == null) ? ReferenceQueue.NULL : queue;
+ }
+
+}
Added: trunk/core/src/openjdk/java/java/lang/ref/ReferenceQueue.java
===================================================================
--- trunk/core/src/openjdk/java/java/lang/ref/ReferenceQueue.java (rev 0)
+++ trunk/core/src/openjdk/java/java/lang/ref/ReferenceQueue.java 2009-03-01 08:55:23 UTC (rev 5077)
@@ -0,0 +1,152 @@
+/*
+ * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code 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 General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.lang.ref;
+
+/**
+ * Reference queues, to which registered reference objects are appended by the
+ * garbage collector after the appropriate reachability changes are detected.
+ *
+ * @author Mark Reinhold
+ * @since 1.2
+ */
+
+public class ReferenceQueue<T> {
+
+ /**
+ * Constructs a new reference-object queue.
+ */
+ public ReferenceQueue() { }
+
+ private static class Null extends ReferenceQueue {
+ boolean enqueue(Reference r) {
+ return false;
+ }
+ }
+
+ static ReferenceQueue NULL = new Null();
+ static ReferenceQueue ENQUEUED = new Null();
+
+ static private class Lock { };
+ private Lock lock = new Lock();
+ private Reference<? extends T> head = null;
+ private long queueLength = 0;
+
+ boolean enqueue(Reference<? extends T> r) { /* Called only by Reference class */
+ synchronized (r) {
+ if (r.queue == ENQUEUED) return false;
+ synchronized (lock) {
+ r.queue = ENQUEUED;
+ r.next = (head == null) ? r : head;
+ head = r;
+ queueLength++;
+ if (r instanceof FinalReference) {
+ sun.misc.VM.addFinalRefCount(1);
+ }
+ lock.notifyAll();
+ return true;
+ }
+ }
+ }
+
+ private Reference<? extends T> reallyPoll() { /* Must hold lock */
+ if (head != null) {
+ Reference<? extends T> r = head;
+ head = (r.next == r) ? null : r.next;
+ r.queue = NULL;
+ r.next = r;
+ queueLength--;
+ if (r instanceof FinalReference) {
+ sun.misc.VM.addFinalRefCount(-1);
+ }
+ return r;
+ }
+ return null;
+ }
+
+ /**
+ * Polls this queue to see if a reference object is available. If one is
+ * available without further delay then it is removed from the queue and
+ * returned. Otherwise this method immediately returns <tt>null</tt>.
+ *
+ * @return A reference object, if one was immediately available,
+ * otherwise <code>null</code>
+ */
+ public Reference<? extends T> poll() {
+ synchronized (lock) {
+ return reallyPoll();
+ }
+ }
+
+ /**
+ * Removes the next reference object in this queue, blocking until either
+ * one becomes available or the given timeout period expires.
+ *
+ * <p> This method does not offer real-time guarantees: It schedules the
+ * timeout as if by invoking the {@link Object#wait(long)} method.
+ *
+ * @param timeout If positive, block for up to <code>timeout</code>
+ * milliseconds while waiting for a reference to be
+ * added to this queue. If zero, block indefinitely.
+ *
+ * @return A reference object, if one was available within the specified
+ * timeout period, otherwise <code>null</code>
+ *
+ * @throws IllegalArgumentException
+ * If the value of the timeout argument is negative
+ *
+ * @throws InterruptedException
+ * If the timeout wait is interrupted
+ */
+ public Reference<? extends T> remove(long timeout)
+ throws IllegalArgumentException, InterruptedException
+ {
+ if (timeout < 0) {
+ throw new IllegalArgumentException("Negative timeout value");
+ }
+ synchronized (lock) {
+ Reference<? extends T> r = reallyPoll();
+ if (r != null) return r;
+ for (;;) {
+ lock.wait(timeout);
+ r = reallyPoll();
+ if (r != null) return r;
+ if (timeout != 0) return null;
+ }
+ }
+ }
+
+ /**
+ * Removes the next reference object in this queue, blocking until one
+ * becomes available.
+ *
+ * @return A reference object, blocking until one becomes available
+ * @throws InterruptedException If the wait is interrupted
+ */
+ public Reference<? extends T> remove() throws InterruptedException {
+ return remove(0);
+ }
+
+}
Added: trunk/core/src/openjdk/java/java/lang/ref/SoftReference.java
===================================================================
--- trunk/core/src/openjdk/java/java/lang/ref/SoftReference.java (rev 0)
+++ trunk/core/src/openjdk/java/java/lang/ref/SoftReference.java 2009-03-01 08:55:23 UTC (rev 5077)
@@ -0,0 +1,115 @@
+/*
+ * Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code 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 General Public License
+ * version 2 for more details (a co...
[truncated message content] |
|
From: <ls...@us...> - 2009-03-01 09:15:36
|
Revision: 5078
http://jnode.svn.sourceforge.net/jnode/?rev=5078&view=rev
Author: lsantha
Date: 2009-03-01 09:15:24 +0000 (Sun, 01 Mar 2009)
Log Message:
-----------
Improved String interning.
Modified Paths:
--------------
trunk/core/src/core/org/jnode/util/BootableHashMap.java
trunk/core/src/core/org/jnode/vm/VmSystemObject.java
trunk/core/src/core/org/jnode/vm/classmgr/SelectorMap.java
trunk/core/src/core/org/jnode/vm/classmgr/Signature.java
trunk/core/src/core/org/jnode/vm/classmgr/VmCP.java
trunk/core/src/core/org/jnode/vm/classmgr/VmConstClass.java
trunk/core/src/core/org/jnode/vm/classmgr/VmMember.java
trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java
trunk/core/src/core/org/jnode/vm/classmgr/VmType.java
trunk/core/src/core/org/jnode/vm/classmgr/VmUTF8Convert.java
trunk/core/src/openjdk/vm/java/lang/NativeString.java
Added Paths:
-----------
trunk/core/src/core/org/jnode/vm/InternString.java
Modified: trunk/core/src/core/org/jnode/util/BootableHashMap.java
===================================================================
--- trunk/core/src/core/org/jnode/util/BootableHashMap.java 2009-03-01 08:55:23 UTC (rev 5077)
+++ trunk/core/src/core/org/jnode/util/BootableHashMap.java 2009-03-01 09:15:24 UTC (rev 5078)
@@ -250,4 +250,7 @@
locked = true;
}
+ public boolean isLocked() {
+ return locked;
+ }
}
Added: trunk/core/src/core/org/jnode/vm/InternString.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/InternString.java (rev 0)
+++ trunk/core/src/core/org/jnode/vm/InternString.java 2009-03-01 09:15:24 UTC (rev 5078)
@@ -0,0 +1,48 @@
+package org.jnode.vm;
+
+import org.jnode.util.BootableHashMap;
+
+/**
+ *
+ */
+public class InternString extends VmSystemObject {
+ private static BootableHashMap<String, String> bootInternTable;
+ private static boolean booted = false;
+
+ public static String internString(String instance) {
+ if (booted) {
+ return instance.intern();
+ } else {
+ if (Vm.getVm().isBootstrap()) {
+ if (bootInternTable == null) {
+ bootInternTable = new BootableHashMap<String, String>();
+ }
+
+ instance = instance.intern();
+ //todo the string interned after emiting bootInternTable will be lost
+ if (!bootInternTable.isLocked()) {
+ synchronized (bootInternTable) {
+ final String str = bootInternTable.get(instance);
+ if (str != null) {
+ return str;
+ }
+ bootInternTable.put(instance, instance);
+ }
+ }
+ return instance;
+ } else {
+ return instance.intern();
+ }
+ }
+ }
+
+ //todo protect it
+ public static void boot() {
+ booted = true;
+ }
+
+ //todo protect it
+ public static BootableHashMap<String, String> getBootInternTable() {
+ return bootInternTable;
+ }
+}
Modified: trunk/core/src/core/org/jnode/vm/VmSystemObject.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmSystemObject.java 2009-03-01 08:55:23 UTC (rev 5077)
+++ trunk/core/src/core/org/jnode/vm/VmSystemObject.java 2009-03-01 09:15:24 UTC (rev 5078)
@@ -43,7 +43,7 @@
res.append(Integer.toHexString(ch));
}
}
- return res.toString().intern();
+ return InternString.internString(res.toString());
}
/**
@@ -64,7 +64,7 @@
res.append(v.length());
res.append(v);
}
- return res.toString().intern();
+ return InternString.internString(res.toString());
}
/**
Modified: trunk/core/src/core/org/jnode/vm/classmgr/SelectorMap.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/SelectorMap.java 2009-03-01 08:55:23 UTC (rev 5077)
+++ trunk/core/src/core/org/jnode/vm/classmgr/SelectorMap.java 2009-03-01 09:15:24 UTC (rev 5078)
@@ -22,6 +22,7 @@
import org.jnode.util.BootableHashMap;
import org.jnode.vm.VmSystemObject;
+import org.jnode.vm.InternString;
/**
* This class is used to maintain a mapping between a method signature (name+type)
@@ -42,7 +43,7 @@
* @return The global unique selector
*/
public int get(String name, String signature) {
- final String id = (name + '#' + signature).intern();
+ final String id = InternString.internString(name + '#' + signature);
final Integer selector = (Integer) map.get(id);
if (selector != null) {
return selector.intValue();
Modified: trunk/core/src/core/org/jnode/vm/classmgr/Signature.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/Signature.java 2009-03-01 08:55:23 UTC (rev 5077)
+++ trunk/core/src/core/org/jnode/vm/classmgr/Signature.java 2009-03-01 09:15:24 UTC (rev 5078)
@@ -23,6 +23,7 @@
import java.util.ArrayList;
import org.jnode.vm.JvmType;
+import org.jnode.vm.InternString;
/**
* <description>
@@ -247,8 +248,8 @@
}
}
ofs++;
- String sig = new String(signature, start, ofs - start).intern()
- .replace('/', '.');
+ String sig = new String(signature, start, ofs - start).replace('/', '.');
+ sig = InternString.internString(sig);
vmClass = loader.loadClass(sig, true);
break;
}
@@ -258,8 +259,8 @@
while (signature[ofs] != ';') {
ofs++;
}
- String sig = new String(signature, start, ofs - start).intern()
- .replace('/', '.');
+ String sig = new String(signature, start, ofs - start).replace('/', '.');
+ sig = InternString.internString(sig);
ofs++;
vmClass = loader.loadClass(sig, true);
break;
Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmCP.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/VmCP.java 2009-03-01 08:55:23 UTC (rev 5077)
+++ trunk/core/src/core/org/jnode/vm/classmgr/VmCP.java 2009-03-01 09:15:24 UTC (rev 5078)
@@ -21,6 +21,7 @@
package org.jnode.vm.classmgr;
import org.jnode.vm.VmSystemObject;
+import org.jnode.vm.InternString;
/**
* A VmCP is the runtime representation of a constant pool
@@ -162,7 +163,7 @@
}
protected void setUTF8(int index, String value) {
- set(index, value.intern());
+ set(index, InternString.internString(value));
}
public VmConstString getString(int index) {
Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmConstClass.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/VmConstClass.java 2009-03-01 08:55:23 UTC (rev 5077)
+++ trunk/core/src/core/org/jnode/vm/classmgr/VmConstClass.java 2009-03-01 09:15:24 UTC (rev 5078)
@@ -20,6 +20,8 @@
package org.jnode.vm.classmgr;
+import org.jnode.vm.InternString;
+
/**
* Entry of a constantpool describing a class reference.
*
@@ -38,7 +40,7 @@
* @param name
*/
VmConstClass(String name) {
- this.data = name.replace('/', '.').intern();
+ this.data = InternString.internString(name.replace('/', '.'));
}
/**
Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmMember.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/VmMember.java 2009-03-01 08:55:23 UTC (rev 5077)
+++ trunk/core/src/core/org/jnode/vm/classmgr/VmMember.java 2009-03-01 09:15:24 UTC (rev 5078)
@@ -21,6 +21,7 @@
package org.jnode.vm.classmgr;
import org.jnode.vm.annotation.KernelSpace;
+import org.jnode.vm.InternString;
import org.vmmagic.pragma.Uninterruptible;
/**
@@ -68,7 +69,7 @@
if (Modifier.isWide(signature)) {
modifiers |= Modifier.ACC_WIDE;
}
- this.name = name.intern(); //todo review interning, this might not be needed here
+ this.name = InternString.internString(name); //todo review interning, this might not be needed here
this.signature = signature;
this.modifiers = modifiers;
this.declaringClass = declaringClass;
Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java 2009-03-01 08:55:23 UTC (rev 5077)
+++ trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java 2009-03-01 09:15:24 UTC (rev 5078)
@@ -27,6 +27,7 @@
import org.jnode.vm.LoadCompileService;
import org.jnode.vm.Vm;
import org.jnode.vm.VmAddress;
+import org.jnode.vm.InternString;
import org.jnode.vm.annotation.MagicPermission;
import org.jnode.vm.isolate.VmIsolateLocal;
import org.vmmagic.unboxed.Address;
@@ -254,8 +255,8 @@
*/
public final String getMangledName() {
if (mangledName == null) {
- mangledName = (declaringClass.getMangledName()
- + mangle("#" + getName() + '.' + getSignature())).intern();
+ mangledName = InternString.internString(declaringClass.getMangledName()
+ + mangle("#" + getName() + '.' + getSignature()));
}
return mangledName;
}
Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmType.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/VmType.java 2009-03-01 08:55:23 UTC (rev 5077)
+++ trunk/core/src/core/org/jnode/vm/classmgr/VmType.java 2009-03-01 09:15:24 UTC (rev 5078)
@@ -38,6 +38,7 @@
import org.jnode.vm.VmMagic;
import org.jnode.vm.VmReflection;
import org.jnode.vm.VmSystemClassLoader;
+import org.jnode.vm.InternString;
import org.jnode.vm.annotation.Inline;
import org.jnode.vm.annotation.KernelSpace;
import org.jnode.vm.annotation.LoadStatics;
@@ -313,10 +314,9 @@
}
}
- this.name = name.intern();
+ this.name = InternString.internString(name);
this.superClass = superClass;
- this.superClassName = (superClassName == null) ? null : superClassName
- .intern();
+ this.superClassName = (superClassName == null) ? null : InternString.internString(superClassName);
this.modifiers = modifiers;
this.state = VmTypeState.ST_LOADED;
this.loader = loader;
@@ -507,7 +507,7 @@
result[i + 2] = name.charAt(i);
}
}
- arrayClassName = new String(result).intern();
+ arrayClassName = InternString.internString(new String(result));
}
return arrayClassName;
}
Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmUTF8Convert.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/VmUTF8Convert.java 2009-03-01 08:55:23 UTC (rev 5077)
+++ trunk/core/src/core/org/jnode/vm/classmgr/VmUTF8Convert.java 2009-03-01 09:15:24 UTC (rev 5078)
@@ -22,6 +22,7 @@
import java.io.UTFDataFormatException;
import java.nio.ByteBuffer;
+import org.jnode.vm.InternString;
/**
* VM_UTF8Convert
@@ -127,7 +128,7 @@
+ i);
}
}
- return new String(result, 0, result_index).intern();
+ return InternString.internString(new String(result, 0, result_index));
}
/**
Modified: trunk/core/src/openjdk/vm/java/lang/NativeString.java
===================================================================
--- trunk/core/src/openjdk/vm/java/lang/NativeString.java 2009-03-01 08:55:23 UTC (rev 5077)
+++ trunk/core/src/openjdk/vm/java/lang/NativeString.java 2009-03-01 09:15:24 UTC (rev 5078)
@@ -17,25 +17,53 @@
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
+
package java.lang;
import java.lang.ref.WeakReference;
import java.util.WeakHashMap;
+import org.jnode.vm.InternString;
+import org.jnode.vm.annotation.SharedStatics;
+import org.jnode.util.BootableHashMap;
+
/**
*
*/
+@SharedStatics
public class NativeString {
- static final WeakHashMap<String, WeakReference<String>> internTable = new WeakHashMap<String, WeakReference<String>>();
+ static final WeakHashMap<String, WeakReference<String>> internTable =
+ new WeakHashMap<String, WeakReference<String>>();
+ static boolean booted = false;
+ //keeps live refrences to the string in bootheap
+ //TODO cleanup might still be good in case the bootiamge builder interns unnecessary strings
+ static BootableHashMap<String, String> bootInternTable;
+ static void boot() {
+ bootInternTable = InternString.getBootInternTable();
+ for (String instance : bootInternTable.values()) {
+ final WeakReference<String> ref = internTable.get(instance);
+ if(ref == null) {
+ internTable.put(instance, new WeakReference<String>(instance));
+ } else {
+ final String s = ref.get();
+ if(s == null) {
+ internTable.put(instance, new WeakReference<String>(instance));
+ }
+ }
+ }
+ InternString.boot();
+ }
+
/**
- *
- * @param instance
- * @return
- * @see String#intern()
+ * @see String#intern()
*/
private static String intern(String instance){
synchronized (internTable) {
+ if(!booted) {
+ boot();
+ booted = true;
+ }
+
final WeakReference<String> ref = internTable.get(instance);
if (ref != null) {
final String s = ref.get();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|