112 }
113
114 return closure.get_result(env, classCountPtr, classesPtr);
115 }
116
117 jvmtiError
118 JvmtiGetLoadedClasses::getClassLoaderClasses(JvmtiEnv *env, jobject initiatingLoader,
119 jint* classCountPtr, jclass** classesPtr) {
120
121 LoadedClassesClosure closure(env, true);
122 {
123 // To get a consistent list of classes we need MultiArray_lock to ensure
124 // array classes aren't created during this walk.
125 MutexLocker ma(MultiArray_lock);
126 MutexLocker sd(SystemDictionary_lock);
127 oop loader = JNIHandles::resolve(initiatingLoader);
128 // All classes loaded from this loader as initiating loader are
129 // requested, so only need to walk this loader's ClassLoaderData
130 // dictionary, or the NULL ClassLoaderData dictionary for bootstrap loader.
131 if (loader != NULL) {
132 ClassLoaderData* data = java_lang_ClassLoader::loader_data(loader);
133 // ClassLoader may not be used yet for loading.
134 if (data != NULL && data->dictionary() != NULL) {
135 data->dictionary()->all_entries_do(&closure);
136 }
137 } else {
138 ClassLoaderData::the_null_class_loader_data()->dictionary()->all_entries_do(&closure);
139 }
140 // Get basic arrays for all loaders.
141 Universe::basic_type_classes_do(&closure);
142 }
143
144 return closure.get_result(env, classCountPtr, classesPtr);
145 }
|
112 }
113
114 return closure.get_result(env, classCountPtr, classesPtr);
115 }
116
117 jvmtiError
118 JvmtiGetLoadedClasses::getClassLoaderClasses(JvmtiEnv *env, jobject initiatingLoader,
119 jint* classCountPtr, jclass** classesPtr) {
120
121 LoadedClassesClosure closure(env, true);
122 {
123 // To get a consistent list of classes we need MultiArray_lock to ensure
124 // array classes aren't created during this walk.
125 MutexLocker ma(MultiArray_lock);
126 MutexLocker sd(SystemDictionary_lock);
127 oop loader = JNIHandles::resolve(initiatingLoader);
128 // All classes loaded from this loader as initiating loader are
129 // requested, so only need to walk this loader's ClassLoaderData
130 // dictionary, or the NULL ClassLoaderData dictionary for bootstrap loader.
131 if (loader != NULL) {
132 ClassLoaderData* data = java_lang_ClassLoader::loader_data_acquire(loader);
133 // ClassLoader may not be used yet for loading.
134 if (data != NULL && data->dictionary() != NULL) {
135 data->dictionary()->all_entries_do(&closure);
136 }
137 } else {
138 ClassLoaderData::the_null_class_loader_data()->dictionary()->all_entries_do(&closure);
139 }
140 // Get basic arrays for all loaders.
141 Universe::basic_type_classes_do(&closure);
142 }
143
144 return closure.get_result(env, classCountPtr, classesPtr);
145 }
|