diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-08-26 18:26:08 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-08-26 18:26:08 +0000 |
commit | 68c576a29bdfe787b94895b6c01391c5e199fbab (patch) | |
tree | 24ae883ce29d93c714f38a6e5151cceb2f0e529d | |
parent | a944bc5dd0ec23daa16fa086f6078a9fcc68cd59 (diff) |
2006-08-26 Andrew John Hughes <gnu_andrew@member.fsf.org>
* link.cc:
Increment loaded classes when printing verbose output.
* gnu/java/lang/management/natVMMemoryMXBeanImpl.cc:
Added comments.
* gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.cc:
(getMemoryManagerNames(jstring)): Implemented.
(isValid(jstring)): Implemented.
* gnu/java/lang/management/natVMClassLoadingMXBeanImpl.cc:
(getLoadedClassCount()): Implemented.
(getUnloadedClassCount()): Likewise.
(isVerbose()): Likewise.
(setVerbose(jboolean)): Likewise.
* java/lang/management/natVMManagementFactory.cc:
(getMemoryPoolNames()): Implemented.
(getMemoryManagerNames()): Likewise.
(getGarbageCollectorNames()): Likewise.
* include/jvm.h:
Add loaded and unloaded class counts.
* defineclasses.c:
Increment loaded classes count.
* prims.cc:
Add loaded and unloaded class counts.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcj-eclipse@116474 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libjava/ChangeLog | 25 | ||||
-rw-r--r-- | libjava/defineclass.cc | 1 | ||||
-rw-r--r-- | libjava/gnu/java/lang/management/natVMClassLoadingMXBeanImpl.cc | 31 | ||||
-rw-r--r-- | libjava/gnu/java/lang/management/natVMMemoryMXBeanImpl.cc | 17 | ||||
-rw-r--r-- | libjava/gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.cc | 26 | ||||
-rw-r--r-- | libjava/include/jvm.h | 5 | ||||
-rw-r--r-- | libjava/java/lang/management/natVMManagementFactory.cc | 29 | ||||
-rw-r--r-- | libjava/link.cc | 9 | ||||
-rw-r--r-- | libjava/prims.cc | 6 |
9 files changed, 128 insertions, 21 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 5de62120300..e054e17c025 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,28 @@ +2006-08-26 Andrew John Hughes <gnu_andrew@member.fsf.org> + + * link.cc: + Increment loaded classes when printing verbose output. + * gnu/java/lang/management/natVMMemoryMXBeanImpl.cc: + Added comments. + * gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.cc: + (getMemoryManagerNames(jstring)): Implemented. + (isValid(jstring)): Implemented. + * gnu/java/lang/management/natVMClassLoadingMXBeanImpl.cc: + (getLoadedClassCount()): Implemented. + (getUnloadedClassCount()): Likewise. + (isVerbose()): Likewise. + (setVerbose(jboolean)): Likewise. + * java/lang/management/natVMManagementFactory.cc: + (getMemoryPoolNames()): Implemented. + (getMemoryManagerNames()): Likewise. + (getGarbageCollectorNames()): Likewise. + * include/jvm.h: + Add loaded and unloaded class counts. + * defineclasses.c: + Increment loaded classes count. + * prims.cc: + Add loaded and unloaded class counts. + 2006-08-16 Tom Tromey <tromey@redhat.com> * include/posix-threads.h (_Jv_MutexLock): No longer inline. diff --git a/libjava/defineclass.cc b/libjava/defineclass.cc index 2ec474f4bd4..5b18b9a00c1 100644 --- a/libjava/defineclass.cc +++ b/libjava/defineclass.cc @@ -417,6 +417,7 @@ _Jv_ClassReader::parse () def->state = JV_STATE_READ; if (gcj::verbose_class_flag) _Jv_Linker::print_class_loaded (def); + ++gcj::loadedClasses; def->notifyAll (); } diff --git a/libjava/gnu/java/lang/management/natVMClassLoadingMXBeanImpl.cc b/libjava/gnu/java/lang/management/natVMClassLoadingMXBeanImpl.cc index b76e861407c..5958b1f1dc9 100644 --- a/libjava/gnu/java/lang/management/natVMClassLoadingMXBeanImpl.cc +++ b/libjava/gnu/java/lang/management/natVMClassLoadingMXBeanImpl.cc @@ -1,32 +1,49 @@ +/* Copyright (C) 2006 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +/** + * @author Andrew John Hughes <gnu_andrew@member.fsf.org> + * @date Sun 20 Aug 2006 */ +/* Written using online API docs for JDK 1.5 beta from http://java.sun.com. + * Status: Believed complete and correct. + */ + #include <config.h> +#include <jvm.h> + #include <gnu/java/lang/management/VMClassLoadingMXBeanImpl.h> -#include <gcj/cni.h> -#include <java/lang/UnsupportedOperationException.h> jint gnu::java::lang::management::VMClassLoadingMXBeanImpl::getLoadedClassCount () { - throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("gnu::java::lang::management::VMClassLoadingMXBeanImpl::getLoadedClassCount () not implemented")); + /* FIXME: We never unload, so this never goes down again */ + return ::gcj::loadedClasses; } jlong gnu::java::lang::management::VMClassLoadingMXBeanImpl::getUnloadedClassCount () { - throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("gnu::java::lang::management::VMClassLoadingMXBeanImpl::getUnloadedClassCount () not implemented")); + /* FIXME: We never unload, so this always == 0 */ + return ::gcj::unloadedClasses; } jboolean gnu::java::lang::management::VMClassLoadingMXBeanImpl::isVerbose () { - throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("gnu::java::lang::management::VMClassLoadingMXBeanImpl::isVerbose () not implemented")); + return ::gcj::verbose_class_flag; } void -gnu::java::lang::management::VMClassLoadingMXBeanImpl::setVerbose (jboolean) +gnu::java::lang::management::VMClassLoadingMXBeanImpl::setVerbose (jboolean b) { - throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("gnu::java::lang::management::VMClassLoadingMXBeanImpl::setVerbose (jboolean) not implemented")); + ::gcj::verbose_class_flag = b; } diff --git a/libjava/gnu/java/lang/management/natVMMemoryMXBeanImpl.cc b/libjava/gnu/java/lang/management/natVMMemoryMXBeanImpl.cc index 4df4fd28e56..8b59815f551 100644 --- a/libjava/gnu/java/lang/management/natVMMemoryMXBeanImpl.cc +++ b/libjava/gnu/java/lang/management/natVMMemoryMXBeanImpl.cc @@ -1,7 +1,22 @@ +/* Copyright (C) 2006 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +/** + * @author Andrew John Hughes <gnu_andrew@member.fsf.org> + * @date Tue 08 Aug 2006 */ +/* + * Status: Stubbed. + */ + #include <config.h> -#include <gnu/java/lang/management/VMMemoryMXBeanImpl.h> #include <gcj/cni.h> +#include <gnu/java/lang/management/VMMemoryMXBeanImpl.h> #include <java/lang/UnsupportedOperationException.h> ::java::lang::management::MemoryUsage * diff --git a/libjava/gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.cc b/libjava/gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.cc index 6374a6ecea6..b7a250955ad 100644 --- a/libjava/gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.cc +++ b/libjava/gnu/java/lang/management/natVMMemoryPoolMXBeanImpl.cc @@ -1,11 +1,26 @@ +/* Copyright (C) 2006 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +/** + * @author Andrew John Hughes <gnu_andrew@member.fsf.org> + * @date Tue 08 Aug 2006 */ +/* Implemented for our sole pool, the heap (we ignore the name input). + * Status: Stubbed. + */ + #include <config.h> -#include <gnu/java/lang/management/VMMemoryPoolMXBeanImpl.h> #include <gcj/cni.h> +#include <gnu/java/lang/management/VMMemoryPoolMXBeanImpl.h> #include <java/lang/UnsupportedOperationException.h> ::java::lang::management::MemoryUsage * -gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getCollectionUsage (::java::lang::String *) +gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getCollectionUsage(jstring n) { throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getCollectionUsage (::java::lang::String *) not implemented")); } @@ -26,9 +41,10 @@ gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getCollectionUsageThreshold JArray< ::java::lang::String *> * -gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getMemoryManagerNames (::java::lang::String *) +gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getMemoryManagerNames(jstring n) { - throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getMemoryManagerNames (::java::lang::String *) not implemented")); + return (JArray<jstring>*) + JvNewObjectArray(1, &::java::lang::String::class$, JvNewStringLatin1("BoehmGC")); } @@ -70,7 +86,7 @@ gnu::java::lang::management::VMMemoryPoolMXBeanImpl::getUsageThresholdCount (::j jboolean gnu::java::lang::management::VMMemoryPoolMXBeanImpl::isValid (::java::lang::String *) { - throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("gnu::java::lang::management::VMMemoryPoolMXBeanImpl::isValid (::java::lang::String *) not implemented")); + return true; } diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h index c8cf98793cd..f9d7341542f 100644 --- a/libjava/include/jvm.h +++ b/libjava/include/jvm.h @@ -242,6 +242,11 @@ namespace gcj /* The VM arguments */ extern JArray<jstring>* vmArgs; + // Currently loaded classes + extern jint loadedClasses; + + // Unloaded classes + extern jlong unloadedClasses; } // This class handles all aspects of class preparation and linking. diff --git a/libjava/java/lang/management/natVMManagementFactory.cc b/libjava/java/lang/management/natVMManagementFactory.cc index 3bcce6cf9ff..35a418bb338 100644 --- a/libjava/java/lang/management/natVMManagementFactory.cc +++ b/libjava/java/lang/management/natVMManagementFactory.cc @@ -1,25 +1,44 @@ +/* Copyright (C) 2006 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +/** + * @author Andrew John Hughes <gnu_andrew@member.fsf.org> + * @date Tue 08 Aug 2006 */ +/* Implemented for our sole pool, the heap, and our sole memory + * manager/garbage collector, Boehm GC. + * Status: Believed complete and correct. + */ + #include <config.h> -#include <java/lang/management/VMManagementFactory.h> #include <gcj/cni.h> -#include <java/lang/UnsupportedOperationException.h> +#include <java/lang/String.h> +#include <java/lang/management/VMManagementFactory.h> JArray< ::java::lang::String *> * java::lang::management::VMManagementFactory::getMemoryPoolNames () { - throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("java::lang::management::VMManagementFactory::getMemoryPoolNames () not implemented")); + return (JArray<jstring>*) + JvNewObjectArray(1, &java::lang::String::class$, JvNewStringLatin1("Heap")); } JArray< ::java::lang::String *> * java::lang::management::VMManagementFactory::getMemoryManagerNames () { - throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("java::lang::management::VMManagementFactory::getMemoryManagerNames () not implemented")); + return (JArray<jstring>*) + JvNewObjectArray(0, &java::lang::String::class$, NULL); } JArray< ::java::lang::String *> * java::lang::management::VMManagementFactory::getGarbageCollectorNames () { - throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("java::lang::management::VMManagementFactory::getGarbageCollectorNames () not implemented")); + return (JArray<jstring>*) + JvNewObjectArray(1, &java::lang::String::class$, JvNewStringLatin1("BoehmGC")); } diff --git a/libjava/link.cc b/libjava/link.cc index 4e0eef1817d..8a07b7fed0b 100644 --- a/libjava/link.cc +++ b/libjava/link.cc @@ -1932,11 +1932,14 @@ _Jv_Linker::wait_for_state (jclass klass, int state) // Print some debugging info if requested. Interpreted classes are // handled in defineclass, so we only need to handle the two // pre-compiled cases here. - if (gcj::verbose_class_flag - && (klass->state == JV_STATE_COMPILED + if ((klass->state == JV_STATE_COMPILED || klass->state == JV_STATE_PRELOADING) && ! _Jv_IsInterpretedClass (klass)) - print_class_loaded (klass); + { + if (gcj::verbose_class_flag) + print_class_loaded (klass); + ++gcj::loadedClasses; + } try { diff --git a/libjava/prims.cc b/libjava/prims.cc index b3f270b2e4a..744dd6657bf 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -1121,6 +1121,12 @@ namespace gcj // Arguments passed to the VM JArray<jstring>* vmArgs; + + // Currently loaded classes + jint loadedClasses = 0; + + // Unloaded classes + jlong unloadedClasses = 0; } // We accept all non-standard options accepted by Sun's java command, |