# HG changeset patch # User sspitsyn # Date 1489763945 25200 # Node ID da075aa9241f745f1fc4a19abedcbcf0d3bfe361 # Parent cef2c78aaa56b1eb3475127021cbdb06c215c065 8176831: Dead code: function jmm_GetLoadedClasses is not used in jmm_interface Summary: Remove the dead code Reviewed-by: dholmes, coleenp diff -r cef2c78aaa56 -r da075aa9241f hotspot/src/share/vm/services/classLoadingService.cpp --- a/hotspot/src/share/vm/services/classLoadingService.cpp Wed Dec 14 09:14:16 2016 +0100 +++ b/hotspot/src/share/vm/services/classLoadingService.cpp Fri Mar 17 08:19:05 2017 -0700 @@ -197,26 +197,4 @@ LogConfiguration::configure_stdout(level, false, LOG_TAGS(class, unload)); } -GrowableArray* LoadedClassesEnumerator::_loaded_classes = NULL; - -LoadedClassesEnumerator::LoadedClassesEnumerator() { - - int init_size = ClassLoadingService::loaded_class_count(); - _klass_array = new GrowableArray(init_size); - - // For consistency of the loaded classes, grab the SystemDictionary lock - MutexLocker sd_mutex(SystemDictionary_lock); - - // Set _loaded_classes and begin enumerating all classes. - // Only one thread will do the enumeration at a time. - // These static variables are needed and they are used by the static method - // add_loaded_class called from classes_do(). - _loaded_classes = _klass_array; - - SystemDictionary::classes_do(&add_loaded_class); - - // FIXME: Exclude array klasses for now - // Universe::basic_type_classes_do(&add_loaded_class); -} - #endif // INCLUDE_MANAGEMENT diff -r cef2c78aaa56 -r da075aa9241f hotspot/src/share/vm/services/classLoadingService.hpp --- a/hotspot/src/share/vm/services/classLoadingService.hpp Wed Dec 14 09:14:16 2016 +0100 +++ b/hotspot/src/share/vm/services/classLoadingService.hpp Fri Mar 17 08:19:05 2017 -0700 @@ -117,28 +117,4 @@ } }; -// FIXME: make this piece of code to be shared by M&M and JVMTI -class LoadedClassesEnumerator : public StackObj { -private: - static GrowableArray* _loaded_classes; - GrowableArray* _klass_array; - -public: - LoadedClassesEnumerator(); - - int num_loaded_classes() { return _klass_array->length(); } - Klass* get_klass(int index) { return _klass_array->at(index); } - - static void add_loaded_class(Klass* k) { - // FIXME: For now - don't include array klasses - // The spec is unclear at this point to count array klasses or not - // and also indirect creation of array of super class and secondaries - // - // for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) { - // _loaded_classes->append(l); - // } - _loaded_classes->append(k); - } -}; - #endif // SHARE_VM_SERVICES_CLASSLOADINGSERVICE_HPP diff -r cef2c78aaa56 -r da075aa9241f hotspot/src/share/vm/services/management.cpp --- a/hotspot/src/share/vm/services/management.cpp Wed Dec 14 09:14:16 2016 +0100 +++ b/hotspot/src/share/vm/services/management.cpp Fri Mar 17 08:19:05 2017 -0700 @@ -1291,25 +1291,6 @@ return (jobjectArray) JNIHandles::make_local(env, result_h()); JVM_END -// Returns an array of Class objects. -JVM_ENTRY(jobjectArray, jmm_GetLoadedClasses(JNIEnv *env)) - ResourceMark rm(THREAD); - - LoadedClassesEnumerator lce; - - int num_classes = lce.num_loaded_classes(); - objArrayOop r = oopFactory::new_objArray(SystemDictionary::Class_klass(), num_classes, CHECK_0); - objArrayHandle classes_ah(THREAD, r); - - for (int i = 0; i < num_classes; i++) { - Klass* k = lce.get_klass(i); - oop mirror = k->java_mirror(); - classes_ah->obj_at_put(i, mirror); - } - - return (jobjectArray) JNIHandles::make_local(env, classes_ah()); -JVM_END - // Reset statistic. Return true if the requested statistic is reset. // Otherwise, return false. //