summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/vm/reference/gnu
diff options
context:
space:
mode:
authordoko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-03 23:18:43 +0000
committerdoko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-03 23:18:43 +0000
commit5bf762459121cc397663d22498d62d71fa179ef6 (patch)
treea9c9e7d91c484d53fe154f9285fc57325572ce50 /libjava/classpath/vm/reference/gnu
parent6d7301dc346a198a89ac987c1008aac09f191ee6 (diff)
downloadppe42-gcc-5bf762459121cc397663d22498d62d71fa179ef6.tar.gz
ppe42-gcc-5bf762459121cc397663d22498d62d71fa179ef6.zip
libjava/classpath/ChangeLog.gcj:
2007-05-31 Matthias Klose <doko@ubuntu.com> * javax/management/NotificationBroadcasterSupport.java (getNotificationInfo): Add cast. * native/jni/qt-peer/Makefile.am (AM_CXXFLAGS): Add libstdc++ include directories. * native/jni/qt-peer/Makefile.in: Regenerate. libjava/ChangeLog: 2007-06-03 Matthias Klose <doko@ubuntu.com> * java/io/natFileWin32.cc (setFilePermissions): New (stub only). _access: Handle EXEC query, stub only. 2007-06-03 Matthias Klose <doko@ubuntu.com> Merged from classpath: * gnu/java/nio/SelectorProviderImpl.java: Whitespace merge. * java/lang/System.java(inheritedChannel): New. * java/lang/Character.java: Remove stray`;'. * java/net/MulticastSocket.java: Merged. * java/text/DateFormatSymbols.java(getInstance): New, comment updates. * java/text/Collator.java(getInstance): Merged. * java/util/Calendar.java: New attributes ALL_STYLES, SHORT, LONG. getDisplayName, getDisplayNames: New. * java/util/logging/Logger.java: Merged. * Regenerate .class and .h files. 2007-06-03 Matthias Klose <doko@ubuntu.com> * java/io/File.java: Merge with classpath-0.95, new method setFilePermissions, new attribute EXEC. * java/io/natFilePosix.cc (setFilePermissions): New. _access: Handle EXEC query. * classpath/lib/java/io/File.class, java/io/File.h: Regenerate. 2007-06-03 Matthias Klose <doko@ubuntu.com> Imported GNU Classpath 0.95. * classpath/Makefile.in, classpath/native/jni/midi-dssi/Makefile.in, classpath/native/jni/classpath/Makefile.in, classpath/native/jni/Makefile.in, classpath/native/jni/gconf-peer/Makefile.in, classpath/native/jni/java-io/Makefile.in, classpath/native/jni/native-lib/Makefile.in, classpath/native/jni/java-util/Makefile.in, classpath/native/jni/midi-alsa/Makefile.in, classpath/native/jni/java-lang/Makefile.in, classpath/native/jni/java-nio/Makefile.in, classpath/native/jni/java-net/Makefile.in, classpath/native/jni/xmlj/Makefile.in, classpath/native/jni/qt-peer/Makefile.in, classpath/native/jni/gtk-peer/Makefile.in, classpath/native/Makefile.in, classpath/native/jawt/Makefile.in, classpath/native/fdlibm/Makefile.in, classpath/native/plugin/Makefile.in, classpath/resource/Makefile.in, classpath/scripts/Makefile.in, classpath/tools/Makefile.in, classpath/doc/Makefile.in, classpath/doc/api/Makefile.in, classpath/lib/Makefile.in, classpath/external/Makefile.in, classpath/external/jsr166/Makefile.in, classpath/external/sax/Makefile.in, classpath/external/w3c_dom/Makefile.in, classpath/external/relaxngDatatype/Makefile.in, classpath/include/Makefile.in, classpath/examples/Makefile.in: Regenerate. * classpath/config.guess, classpath/config.sub, classpath/ltmain.sh : Update. * classpath/configure, classpath/depcomp, classpath/missing, classpath/aclocal.m4, classpath/install-sh: Regenerate. * gnu/classpath/Configuration.java (CLASSPATH_VERSION): Now 0.95. * sources.am: Regenerate. * Makefile.in: Regenerate. * Update the .class files and generated CNI header files, add new .class and generated CNI header files. * Remove generated files for removed java source files: classpath/gnu/java/net/BASE64.java, classpath/gnu/java/security/util/Base64.java, classpath/gnu/java/awt/peer/gtk/GThreadMutex.java, classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java, classpath/gnu/java/awt/font/autofit/Scaler.java, classpath/gnu/classpath/jdwp/util/Value.java, classpath/gnu/javax/net/ssl/Base64.java. * Remove empty directories. * Makefile.am(nat_source_files): Add natVMOperatingSystemMXBeanImpl.cc. * java/lang/Class.java(setAccessible): Merge from classpath. * java/util/Locale.java: Remove. * gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java, gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc: New. * gcj/javaprims.h: Update class declarations. * scripts/classes.pl: Update usage. * HACKING: Mention to build all peers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125302 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/vm/reference/gnu')
-rw-r--r--libjava/classpath/vm/reference/gnu/classpath/jdwp/VMFrame.java30
-rw-r--r--libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java8
-rw-r--r--libjava/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java149
-rw-r--r--libjava/classpath/vm/reference/gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java68
-rw-r--r--libjava/classpath/vm/reference/gnu/java/lang/management/VMThreadMXBeanImpl.java29
5 files changed, 255 insertions, 29 deletions
diff --git a/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMFrame.java b/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMFrame.java
index cd213025a72..eec7b63d67b 100644
--- a/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMFrame.java
+++ b/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMFrame.java
@@ -40,6 +40,7 @@ exception statement from your version. */
package gnu.classpath.jdwp;
import gnu.classpath.jdwp.util.Location;
+import gnu.classpath.jdwp.value.Value;
/**
* Reference implementation of VM hooks for JDWP Frame access.
@@ -53,6 +54,9 @@ public class VMFrame
* Returns the size of a frame ID over JDWP
*/
public static final int SIZE = 8;
+
+ //The thread this frame resides in
+ private Thread thread;
// The object this frame resides in
private Object obj;
@@ -64,6 +68,20 @@ public class VMFrame
private long id;
/**
+ * Create a new VMFrame object.
+ *
+ * @param thr a Thread, the thread this frame is in
+ * @param frame_id a long, the jframeID of this frame
+ * @param frame_loc a Location, the location of this frame
+ */
+ public VMFrame(Thread thr, long frame_id, Location frame_loc)
+ {
+ thread = thr;
+ id = frame_id;
+ loc = frame_loc;
+ }
+
+ /**
* Gets the current location of the frame.
*/
public Location getLocation()
@@ -76,14 +94,22 @@ public class VMFrame
*
* @param slot the slot containing the variable
*/
- public native Object getValue(int slot);
+ public native Value getValue(int slot, byte sig);
/**
* Assigns the given variable to the given value.
* @param slot The slot which contains the variable
* @param value The value to assign the variable to
*/
- public native void setValue(int slot, Object value);
+ public native void setValue(int slot, Value value);
+
+ /**
+ * Get the thread this frame is in.
+ */
+ public Thread getThread()
+ {
+ return thread;
+ }
/**
* Get the object which is represented by 'this' in the context of the frame,
diff --git a/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java b/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java
index 8d423e9b0d6..9360e764dfb 100644
--- a/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java
+++ b/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java
@@ -337,6 +337,10 @@ public class VMIdManager
*/
public ObjectId getObjectId (Object theObject)
{
+ // Special case: null
+ if (theObject == null)
+ return new NullObjectId ();
+
ReferenceKey ref = new ReferenceKey (theObject, _refQueue);
ObjectId id = (ObjectId) _oidTable.get (ref);
if (id == null)
@@ -364,6 +368,10 @@ public class VMIdManager
public ObjectId get (long id)
throws InvalidObjectException
{
+ // Special case: null
+ if (id == 0)
+ return new NullObjectId ();
+
ObjectId oid = (ObjectId) _idTable.get (new Long (id));
if (oid == null)
throw new InvalidObjectException (id);
diff --git a/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java b/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
index d8616063d19..5c761941b50 100644
--- a/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
+++ b/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
@@ -1,7 +1,7 @@
/* VMVirtualMachine.java -- A reference implementation of a JDWP virtual
machine
- Copyright (C) 2005, 2006 Free Software Foundation
+ Copyright (C) 2005, 2006, 2007 Free Software Foundation
This file is part of GNU Classpath.
@@ -45,10 +45,12 @@ import gnu.classpath.jdwp.event.EventRequest;
import gnu.classpath.jdwp.exception.InvalidMethodException;
import gnu.classpath.jdwp.exception.JdwpException;
import gnu.classpath.jdwp.util.MethodResult;
+import gnu.classpath.jdwp.util.MonitorInfo;
+
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Collection;
/**
* A virtual machine according to JDWP.
@@ -57,18 +59,35 @@ import java.util.Iterator;
*/
public class VMVirtualMachine
{
+ // VM Capabilities
+ public static final boolean canWatchFieldModification = false;
+ public static final boolean canWatchFieldAccess = false;
+ public static final boolean canGetBytecodes = false;
+ public static final boolean canGetSyntheticAttribute = false;
+ public static final boolean canGetOwnedMonitorInfo = false;
+ public static final boolean canGetCurrentContendedMonitor = false;
+ public static final boolean canGetMonitorInfo = false;
+ public static final boolean canRedefineClasses = false;
+ public static final boolean canAddMethod = false;
+ public static final boolean canUnrestrictedlyRedefineClasses = false;
+ public static final boolean canPopFrames = false;
+ public static final boolean canUseInstanceFilters = false;
+ public static final boolean canGetSourceDebugExtension = false;
+ public static final boolean canRequestVMDeathEvent = false;
+ public static final boolean canSetDefaultStratum = false;
+
/**
* Suspend a thread
*
* @param thread the thread to suspend
*/
- public static native void suspendThread (Thread thread)
+ public static native void suspendThread(Thread thread)
throws JdwpException;
/**
* Suspend all threads
*/
- public static void suspendAllThreads ()
+ public static void suspendAllThreads()
throws JdwpException
{
// Our JDWP thread group -- don't suspend any of those threads
@@ -115,7 +134,7 @@ public class VMVirtualMachine
*
* @param thread the thread to resume
*/
- public static native void resumeThread (Thread thread)
+ public static native void resumeThread(Thread thread)
throws JdwpException;
/**
@@ -123,7 +142,7 @@ public class VMVirtualMachine
* suspend count. It can not be used to force the application
* to run.
*/
- public static void resumeAllThreads ()
+ public static void resumeAllThreads()
throws JdwpException
{
// Our JDWP thread group -- don't resume
@@ -166,19 +185,13 @@ public class VMVirtualMachine
* @param thread the thread whose suspend count is desired
* @return the number of times the thread has been suspended
*/
- public static native int getSuspendCount (Thread thread)
+ public static native int getSuspendCount(Thread thread)
throws JdwpException;
/**
- * Returns a count of the number of loaded classes in the VM
- */
- public static native int getAllLoadedClassesCount ()
- throws JdwpException;
-
- /**
- * Returns an iterator over all the loaded classes in the VM
+ * Returns a Collection of all classes loaded in the VM
*/
- public static native Iterator getAllLoadedClasses ()
+ public static native Collection getAllLoadedClasses()
throws JdwpException;
/**
@@ -188,7 +201,7 @@ public class VMVirtualMachine
* @return a flag containing the class's status
* @see JdwpConstants.ClassStatus
*/
- public static native int getClassStatus (Class clazz)
+ public static native int getClassStatus(Class clazz)
throws JdwpException;
/**
@@ -198,7 +211,7 @@ public class VMVirtualMachine
* @param klass the class whose methods are desired
* @return an array of virtual machine methods
*/
- public static native VMMethod[] getAllClassMethods (Class klass)
+ public static native VMMethod[] getAllClassMethods(Class klass)
{ return null; }
/**
@@ -223,7 +236,7 @@ public class VMVirtualMachine
* @param length number of frames to return (-1 for all frames)
* @return a list of frames
*/
- public static native ArrayList getFrames (Thread thread, int start,
+ public static native ArrayList getFrames(Thread thread, int start,
int length)
throws JdwpException;
@@ -237,7 +250,7 @@ public class VMVirtualMachine
* @param bb buffer containing the frame's ID
* @return the desired frame
*/
- public static native VMFrame getFrame (Thread thread, ByteBuffer bb)
+ public static native VMFrame getFrame(Thread thread, long frameID)
throws JdwpException;
/**
@@ -246,7 +259,7 @@ public class VMVirtualMachine
* @param thread the thread for which to get a frame count
* @return the number of frames in the thread's stack
*/
- public static native int getFrameCount (Thread thread)
+ public static native int getFrameCount(Thread thread)
throws JdwpException;
@@ -257,7 +270,7 @@ public class VMVirtualMachine
* @return integer status of the thread
* @see JdwpConstants.ThreadStatus
*/
- public static native int getThreadStatus (Thread thread)
+ public static native int getThreadStatus(Thread thread)
throws JdwpException;
/**
@@ -267,7 +280,7 @@ public class VMVirtualMachine
* @param cl the class loader
* @return a list of all visible classes
*/
- public static native ArrayList getLoadRequests (ClassLoader cl)
+ public static native ArrayList getLoadRequests(ClassLoader cl)
throws JdwpException;
/**
@@ -282,7 +295,7 @@ public class VMVirtualMachine
* (instance methods only) "
* @return a result object containing the results of the invocation
*/
- public static native MethodResult executeMethod (Object obj, Thread thread,
+ public static native MethodResult executeMethod(Object obj, Thread thread,
Class clazz, Method method,
Object[] values,
boolean nonVirtual)
@@ -295,7 +308,7 @@ public class VMVirtualMachine
* @return a string containing the source file name; "no path information
* for the file is included"
*/
- public static native String getSourceFile (Class clazz)
+ public static native String getSourceFile(Class clazz)
throws JdwpException;
/**
@@ -307,7 +320,7 @@ public class VMVirtualMachine
* or do some internal work to set up the event notification (useful for
* execution-related events like breakpoints, single-stepping, etc.).
*/
- public static native void registerEvent (EventRequest request)
+ public static native void registerEvent(EventRequest request)
throws JdwpException;
/**
@@ -315,7 +328,7 @@ public class VMVirtualMachine
*
* @param request the request to unregister
*/
- public static native void unregisterEvent (EventRequest request)
+ public static native void unregisterEvent(EventRequest request)
throws JdwpException;
@@ -324,6 +337,88 @@ public class VMVirtualMachine
*
* @param kind the type of events to clear
*/
- public static native void clearEvents (byte kind)
+ public static native void clearEvents(byte kind)
throws JdwpException;
+
+ /**
+ * Redefines the given types. VM must support canRedefineClasses
+ * capability (may also require canAddMethod and/or
+ * canUnrestrictedlyRedefineClasses capabilities)
+ *
+ * @param types the classes to redefine
+ * @param bytecodes the new bytecode definitions for the classes
+ */
+ public static native void redefineClasses(Class[] types, byte[][] bytecodes)
+ throws JdwpException;
+
+ /**
+ * Sets the default stratum. VM must support the
+ * canSetDefaultStratum capability.
+ *
+ * @param stratum the new default stratum or empty string to
+ * use the reference default
+ */
+ public static native void setDefaultStratum(String stratum)
+ throws JdwpException;
+
+ /**
+ * Returns the source debug extension. VM must support the
+ * canGetSourceDebugExtension capability.
+ *
+ * @param klass the class for which to return information
+ * @returns the source debug extension
+ */
+ public static native String getSourceDebugExtension(Class klass)
+ throws JdwpException;
+
+ /**
+ * Returns the bytecode for the given method. VM must support the
+ * canGetBytecodes capability.
+ *
+ * @param method the method for which to get bytecodes
+ * @returns the bytecodes
+ */
+ public static native byte[] getBytecodes(VMMethod method)
+ throws JdwpException;
+
+ /**
+ * Returns monitor information about an object. VM must support
+ * the canGetMonitorInformation capability.
+ *
+ * @param obj the object
+ * @returns monitor information (owner, entry count, waiters)
+ */
+ public static native MonitorInfo getMonitorInfo(Object obj)
+ throws JdwpException;
+
+ /**
+ * Returns a list of owned monitors. VM must support the
+ * canGetOwnedMonitorInfo capability.
+ *
+ * @param thread a thread
+ * @returns the list of monitors owned by this thread
+ */
+ public static native Object[] getOwnedMonitors(Thread thread)
+ throws JdwpException;
+
+ /**
+ * Returns the current contended monitor for a thread. VM must
+ * support canGetCurrentContendedMonitor capability.
+ *
+ * @param thread the thread
+ * @returns the contended monitor
+ */
+ public static native Object getCurrentContendedMonitor(Thread thread)
+ throws JdwpException;
+
+ /**
+ * Pop all frames up to and including the given frame. VM must
+ * support canPopFrames capability. It is the responsibility
+ * of the VM to check if the thread is suspended. If it is not,
+ * the VM should throw ThreadNotSuspendedException.
+ *
+ * @param thread the thread
+ * @param frame the frame ID
+ */
+ public static native void popFrames(Thread thread, long frameId);
}
diff --git a/libjava/classpath/vm/reference/gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java b/libjava/classpath/vm/reference/gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java
new file mode 100644
index 00000000000..20b3f9ed271
--- /dev/null
+++ b/libjava/classpath/vm/reference/gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java
@@ -0,0 +1,68 @@
+/* VMOperatingSystemMXBeanImpl.java - VM implementation of an OS bean
+ Copyright (C) 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.java.lang.management;
+
+import gnu.classpath.Configuration;
+
+/**
+ * Provides access to information about the operating system.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ */
+final class VMOperatingSystemMXBeanImpl
+{
+
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("javalangmanagement");
+ }
+ }
+
+ /**
+ * Returns the system load average from the last
+ * minute.
+ *
+ * @return the system load average from the last
+ * minute.
+ */
+ static native double getSystemLoadAverage();
+
+}
diff --git a/libjava/classpath/vm/reference/gnu/java/lang/management/VMThreadMXBeanImpl.java b/libjava/classpath/vm/reference/gnu/java/lang/management/VMThreadMXBeanImpl.java
index c5bcb631055..1c061aa9356 100644
--- a/libjava/classpath/vm/reference/gnu/java/lang/management/VMThreadMXBeanImpl.java
+++ b/libjava/classpath/vm/reference/gnu/java/lang/management/VMThreadMXBeanImpl.java
@@ -60,6 +60,16 @@ final class VMThreadMXBeanImpl
/**
* Returns the ids of cycles of deadlocked threads, occurring
+ * due to monitor ownership or ownable synchronizer ownership.
+ * This will only be called if ownable synchronizer monitoring
+ * is supported.
+ *
+ * @return the ids of the deadlocked threads.
+ */
+ static native long[] findDeadlockedThreads();
+
+ /**
+ * Returns the ids of cycles of deadlocked threads, occurring
* due to monitor ownership.
*
* @return the ids of the deadlocked threads.
@@ -138,6 +148,25 @@ final class VMThreadMXBeanImpl
}
/**
+ * Fill out the given {@link ThreadInfo} object
+ * with ownable synchronizer usage information.
+ * This is only called if ownable synchronizer
+ * usage monitoring is supported.
+ *
+ * @param info the {@link ThreadInfo} object to modify.
+ */
+ static native void getLockInfo(ThreadInfo info);
+
+ /**
+ * Fill out the given {@link ThreadInfo} object
+ * with monitor usage information. This is only
+ * called if monitor usage monitoring is supported.
+ *
+ * @param info the {@link ThreadInfo} object to modify.
+ */
+ static native void getMonitorInfo(ThreadInfo info);
+
+ /**
* Returns the current peak number of live threads.
*
* @return the peak number of live threads.
OpenPOWER on IntegriCloud