< prev index next >

src/share/vm/prims/jvmtiGetLoadedClasses.cpp

Print this page

        

*** 68,78 **** } }; // The closure for GetClassLoaderClasses class JvmtiGetLoadedClassesClosure : public StackObj { ! // Since the SystemDictionary::classes_do callback // doesn't pass a closureData pointer, // we use a thread-local slot to hold a pointer to // a stack allocated instance of this structure. private: jobject _initiatingLoader; --- 68,78 ---- } }; // The closure for GetClassLoaderClasses class JvmtiGetLoadedClassesClosure : public StackObj { ! // Since the ClassLoaderDataGraph::dictionary_all_entries_do callback // doesn't pass a closureData pointer, // we use a thread-local slot to hold a pointer to // a stack allocated instance of this structure. private: jobject _initiatingLoader;
*** 201,221 **** for (int index = 0; index < _count; index += 1) { result[index] = (jclass) env->jni_reference(get_element(index)); } } ! static void increment_with_loader(Klass* k, ClassLoaderData* loader_data) { JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); oop class_loader = loader_data->class_loader(); if (class_loader == JNIHandles::resolve(that->get_initiatingLoader())) { for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) { that->set_count(that->get_count() + 1); } } } ! static void add_with_loader(Klass* k, ClassLoaderData* loader_data) { JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); if (that->available()) { oop class_loader = loader_data->class_loader(); if (class_loader == JNIHandles::resolve(that->get_initiatingLoader())) { Thread *thread = Thread::current(); --- 201,221 ---- for (int index = 0; index < _count; index += 1) { result[index] = (jclass) env->jni_reference(get_element(index)); } } ! static void increment_with_loader(InstanceKlass* k, ClassLoaderData* loader_data) { JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); oop class_loader = loader_data->class_loader(); if (class_loader == JNIHandles::resolve(that->get_initiatingLoader())) { for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) { that->set_count(that->get_count() + 1); } } } ! static void add_with_loader(InstanceKlass* k, ClassLoaderData* loader_data) { JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); if (that->available()) { oop class_loader = loader_data->class_loader(); if (class_loader == JNIHandles::resolve(that->get_initiatingLoader())) { Thread *thread = Thread::current();
*** 283,293 **** } jvmtiError JvmtiGetLoadedClasses::getClassLoaderClasses(JvmtiEnv *env, jobject initiatingLoader, jint* classCountPtr, jclass** classesPtr) { ! // Since SystemDictionary::classes_do only takes a function pointer // and doesn't call back with a closure data pointer, // we can only pass static methods. JvmtiGetLoadedClassesClosure closure(initiatingLoader); { // To get a consistent list of classes we need MultiArray_lock to ensure --- 283,293 ---- } jvmtiError JvmtiGetLoadedClasses::getClassLoaderClasses(JvmtiEnv *env, jobject initiatingLoader, jint* classCountPtr, jclass** classesPtr) { ! // Since ClassLoaderDataGraph::dictionary_all_entries_do only takes a function pointer // and doesn't call back with a closure data pointer, // we can only pass static methods. JvmtiGetLoadedClassesClosure closure(initiatingLoader); { // To get a consistent list of classes we need MultiArray_lock to ensure
*** 298,312 **** // First, count the classes in the system dictionary which have this loader recorded // as an initiating loader. For basic type arrays this information is not recorded // so GetClassLoaderClasses will return all of the basic type arrays. This is okay // because the defining loader for basic type arrays is always the boot class loader // and these classes are "visible" to all loaders. ! SystemDictionary::classes_do(&JvmtiGetLoadedClassesClosure::increment_with_loader); Universe::basic_type_classes_do(&JvmtiGetLoadedClassesClosure::increment_for_basic_type_arrays); // Next, fill in the classes closure.allocate(); ! SystemDictionary::classes_do(&JvmtiGetLoadedClassesClosure::add_with_loader); Universe::basic_type_classes_do(&JvmtiGetLoadedClassesClosure::add_for_basic_type_arrays); // Drop the SystemDictionary_lock, so the results could be wrong from here, // but we still have a snapshot. } // Post results --- 298,312 ---- // First, count the classes in the system dictionary which have this loader recorded // as an initiating loader. For basic type arrays this information is not recorded // so GetClassLoaderClasses will return all of the basic type arrays. This is okay // because the defining loader for basic type arrays is always the boot class loader // and these classes are "visible" to all loaders. ! ClassLoaderDataGraph::dictionary_all_entries_do(&JvmtiGetLoadedClassesClosure::increment_with_loader); Universe::basic_type_classes_do(&JvmtiGetLoadedClassesClosure::increment_for_basic_type_arrays); // Next, fill in the classes closure.allocate(); ! ClassLoaderDataGraph::dictionary_all_entries_do(&JvmtiGetLoadedClassesClosure::add_with_loader); Universe::basic_type_classes_do(&JvmtiGetLoadedClassesClosure::add_for_basic_type_arrays); // Drop the SystemDictionary_lock, so the results could be wrong from here, // but we still have a snapshot. } // Post results
< prev index next >