< prev index next >

src/hotspot/share/memory/metaspace/virtualSpaceList.cpp

Concurrent class unloading
 
 // Walk the list of VirtualSpaceNodes and delete
 // 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(UseZGC || 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.
   VirtualSpaceNode* purged_vsl = NULL;
   VirtualSpaceNode* prev_vsl = virtual_space_list();

@@ -123,10 +123,12 // This function looks at the mmap regions in the metaspace without locking. // The chunks are added with store ordering and not deleted except for at // unloading time during a safepoint. bool VirtualSpaceList::contains(const void* ptr) { + MutexLockerEx cl(MetaspaceExpand_lock, + Mutex::_no_safepoint_check_flag); // List should be stable enough to use an iterator here because removing virtual // space nodes is only allowed at a safepoint. VirtualSpaceListIterator iter(virtual_space_list()); while (iter.repeat()) { VirtualSpaceNode* vsn = iter.get_next();
@@ -382,6 +384,5 i ++; } } } // namespace metaspace -
< prev index next >