199
200 GrowableArray<KlassHandle>* LoadedClassesEnumerator::_loaded_classes = NULL;
201 Thread* LoadedClassesEnumerator::_current_thread = NULL;
202
203 LoadedClassesEnumerator::LoadedClassesEnumerator(Thread* cur_thread) {
204 assert(cur_thread == Thread::current(), "Check current thread");
205
206 int init_size = ClassLoadingService::loaded_class_count();
207 _klass_handle_array = new GrowableArray<KlassHandle>(init_size);
208
209 // For consistency of the loaded classes, grab the SystemDictionary lock
210 MutexLocker sd_mutex(SystemDictionary_lock);
211
212 // Set _loaded_classes and _current_thread and begin enumerating all classes.
213 // Only one thread will do the enumeration at a time.
214 // These static variables are needed and they are used by the static method
215 // add_loaded_class called from classes_do().
216 _loaded_classes = _klass_handle_array;
217 _current_thread = cur_thread;
218
219 SystemDictionary::classes_do(&add_loaded_class);
220
221 // FIXME: Exclude array klasses for now
222 // Universe::basic_type_classes_do(&add_loaded_class);
223 }
224
225 #endif // INCLUDE_MANAGEMENT
|
199
200 GrowableArray<KlassHandle>* LoadedClassesEnumerator::_loaded_classes = NULL;
201 Thread* LoadedClassesEnumerator::_current_thread = NULL;
202
203 LoadedClassesEnumerator::LoadedClassesEnumerator(Thread* cur_thread) {
204 assert(cur_thread == Thread::current(), "Check current thread");
205
206 int init_size = ClassLoadingService::loaded_class_count();
207 _klass_handle_array = new GrowableArray<KlassHandle>(init_size);
208
209 // For consistency of the loaded classes, grab the SystemDictionary lock
210 MutexLocker sd_mutex(SystemDictionary_lock);
211
212 // Set _loaded_classes and _current_thread and begin enumerating all classes.
213 // Only one thread will do the enumeration at a time.
214 // These static variables are needed and they are used by the static method
215 // add_loaded_class called from classes_do().
216 _loaded_classes = _klass_handle_array;
217 _current_thread = cur_thread;
218
219 ClassLoaderDataGraph::classes_do(&add_loaded_class);
220
221 // FIXME: Exclude array klasses for now
222 // Universe::basic_type_classes_do(&add_loaded_class);
223 }
224
225 #endif // INCLUDE_MANAGEMENT
|