8214522: Last runtime locking issues for concurrent class unloading
authoreosterlund
Wed, 05 Dec 2018 08:55:42 +0100
changeset 52846 6ed72482de52
parent 52845 6419f8d3cc3e
child 52847 27ebaa5566ea
8214522: Last runtime locking issues for concurrent class unloading Reviewed-by: coleenp, pliden
src/hotspot/share/classfile/classLoaderDataGraph.cpp
src/hotspot/share/classfile/dictionary.cpp
src/hotspot/share/memory/metaspace.cpp
src/hotspot/share/memory/metaspace/virtualSpaceList.cpp
--- a/src/hotspot/share/classfile/classLoaderDataGraph.cpp	Wed Dec 05 15:39:04 2018 +0530
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.cpp	Wed Dec 05 08:55:42 2018 +0100
@@ -583,7 +583,6 @@
 }
 
 void ClassLoaderDataGraph::purge() {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
   ClassLoaderData* list = _unloading;
   _unloading = NULL;
   ClassLoaderData* next = list;
--- a/src/hotspot/share/classfile/dictionary.cpp	Wed Dec 05 15:39:04 2018 +0530
+++ b/src/hotspot/share/classfile/dictionary.cpp	Wed Dec 05 08:55:42 2018 +0100
@@ -235,7 +235,7 @@
 
 
 void Dictionary::do_unloading() {
-  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
+  assert_locked_or_safepoint(SystemDictionary_lock);
 
   // The NULL class loader doesn't initiate loading classes from other class loaders
   if (loader_data() == ClassLoaderData::the_null_class_loader_data()) {
--- a/src/hotspot/share/memory/metaspace.cpp	Wed Dec 05 15:39:04 2018 +0530
+++ b/src/hotspot/share/memory/metaspace.cpp	Wed Dec 05 08:55:42 2018 +0100
@@ -865,6 +865,7 @@
 
 // Utils to check if a pointer or range is part of a committed metaspace region.
 metaspace::VirtualSpaceNode* MetaspaceUtils::find_enclosing_virtual_space(const void* p) {
+  MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
   VirtualSpaceNode* vsn = Metaspace::space_list()->find_enclosing_space(p);
   if (Metaspace::using_class_space() && vsn == NULL) {
     vsn = Metaspace::class_space_list()->find_enclosing_space(p);
--- a/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp	Wed Dec 05 15:39:04 2018 +0530
+++ b/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp	Wed Dec 05 08:55:42 2018 +0100
@@ -89,7 +89,6 @@
 // nodes with a 0 container_count.  Remove Metachunks in
 // the node from their respective freelists.
 void VirtualSpaceList::purge(ChunkManager* chunk_manager) {
-  assert(SafepointSynchronize::is_at_safepoint(), "must be called at safepoint for contains to work");
   assert_lock_strong(MetaspaceExpand_lock);
   // Don't use a VirtualSpaceListIterator because this
   // list is being changed and a straightforward use of an iterator is not safe.