src/hotspot/share/runtime/serviceThread.cpp
changeset 57828 35db8fba55f9
parent 55740 b3ff56f955c8
child 57906 e17f768b3b71
--- a/src/hotspot/share/runtime/serviceThread.cpp	Wed Aug 21 16:19:17 2019 -0400
+++ b/src/hotspot/share/runtime/serviceThread.cpp	Wed Aug 21 18:42:30 2019 -0400
@@ -27,6 +27,8 @@
 #include "classfile/stringTable.hpp"
 #include "classfile/symbolTable.hpp"
 #include "classfile/systemDictionary.hpp"
+#include "gc/shared/oopStorage.hpp"
+#include "gc/shared/oopStorageSet.hpp"
 #include "memory/universe.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
@@ -83,22 +85,14 @@
   }
 }
 
-static void cleanup_oopstorages(OopStorage* const* storages, size_t size) {
-  for (size_t i = 0; i < size; ++i) {
-    storages[i]->delete_empty_blocks();
+static void cleanup_oopstorages() {
+  OopStorageSet::Iterator it = OopStorageSet::all_iterator();
+  for ( ; !it.is_end(); ++it) {
+    it->delete_empty_blocks();
   }
 }
 
 void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
-  OopStorage* const oopstorages[] = {
-    JNIHandles::global_handles(),
-    JNIHandles::weak_global_handles(),
-    StringTable::weak_storage(),
-    SystemDictionary::vm_global_oop_storage(),
-    SystemDictionary::vm_weak_oop_storage()
-  };
-  const size_t oopstorage_count = ARRAY_SIZE(oopstorages);
-
   while (true) {
     bool sensors_changed = false;
     bool has_jvmti_events = false;
@@ -178,7 +172,7 @@
     }
 
     if (oopstorage_work) {
-      cleanup_oopstorages(oopstorages, oopstorage_count);
+      cleanup_oopstorages();
     }
   }
 }