8210155: Lock ClassLoaderDataGraph

In preparation for concurrent class unloading.

Reviewed-by: hseigel, eosterlund
This commit is contained in:
Coleen Phillimore 2018-08-31 07:03:46 -04:00
parent 71479d029a
commit eb9259138f
19 changed files with 199 additions and 82 deletions

View file

@ -1919,6 +1919,7 @@ void SystemDictionary::well_known_klasses_do(MetaspaceClosure* it) {
void SystemDictionary::methods_do(void f(Method*)) {
// Walk methods in loaded classes
MutexLocker ml(ClassLoaderDataGraph_lock);
ClassLoaderDataGraph::methods_do(f);
// Walk method handle intrinsics
invoke_method_table()->methods_do(f);
@ -1936,6 +1937,7 @@ class RemoveClassesClosure : public CLDClosure {
void SystemDictionary::remove_classes_in_error_state() {
ClassLoaderData::the_null_class_loader_data()->dictionary()->remove_classes_in_error_state();
RemoveClassesClosure rcc;
MutexLocker ml(ClassLoaderDataGraph_lock);
ClassLoaderDataGraph::cld_do(&rcc);
}