8209738: Remove ClassLoaderDataGraph::*oops_do functions
authorcoleenp
Tue, 21 Aug 2018 09:33:41 -0400
changeset 51470 84d3126858d5
parent 51469 8a9e5819eab5
child 51471 05223cebd7a2
8209738: Remove ClassLoaderDataGraph::*oops_do functions Summary: Make walking CLDG more consistent. Reviewed-by: dholmes, tschatzl
src/hotspot/share/classfile/classLoaderData.cpp
src/hotspot/share/classfile/classLoaderData.hpp
src/hotspot/share/classfile/systemDictionaryShared.hpp
src/hotspot/share/gc/parallel/pcTasks.cpp
src/hotspot/share/gc/parallel/psParallelCompact.cpp
src/hotspot/share/prims/jvmtiTagMap.cpp
--- a/src/hotspot/share/classfile/classLoaderData.cpp	Tue Aug 21 13:12:15 2018 +0200
+++ b/src/hotspot/share/classfile/classLoaderData.cpp	Tue Aug 21 09:33:41 2018 -0400
@@ -1119,28 +1119,6 @@
   return loader_data;
 }
 
-void ClassLoaderDataGraph::oops_do(OopClosure* f, bool must_claim) {
-  for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
-    cld->oops_do(f, must_claim);
-  }
-}
-
-void ClassLoaderDataGraph::keep_alive_oops_do(OopClosure* f, bool must_claim) {
-  for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
-    if (cld->keep_alive()) {
-      cld->oops_do(f, must_claim);
-    }
-  }
-}
-
-void ClassLoaderDataGraph::always_strong_oops_do(OopClosure* f, bool must_claim) {
-  if (ClassUnloading) {
-    keep_alive_oops_do(f, must_claim);
-  } else {
-    oops_do(f, must_claim);
-  }
-}
-
 void ClassLoaderDataGraph::cld_do(CLDClosure* cl) {
   for (ClassLoaderData* cld = _head; cl != NULL && cld != NULL; cld = cld->next()) {
     cl->do_cld(cld);
--- a/src/hotspot/share/classfile/classLoaderData.hpp	Tue Aug 21 13:12:15 2018 +0200
+++ b/src/hotspot/share/classfile/classLoaderData.hpp	Tue Aug 21 09:33:41 2018 -0400
@@ -100,11 +100,7 @@
   static void clean_module_and_package_info();
   static void purge();
   static void clear_claimed_marks();
-  // oops do
-  static void oops_do(OopClosure* f, bool must_claim);
-  static void keep_alive_oops_do(OopClosure* blk, bool must_claim);
-  static void always_strong_oops_do(OopClosure* blk, bool must_claim);
-  // cld do
+  // Iteration through CLDG inside a safepoint; GC support
   static void cld_do(CLDClosure* cl);
   static void cld_unloading_do(CLDClosure* cl);
   static void roots_cld_do(CLDClosure* strong, CLDClosure* weak);
--- a/src/hotspot/share/classfile/systemDictionaryShared.hpp	Tue Aug 21 13:12:15 2018 +0200
+++ b/src/hotspot/share/classfile/systemDictionaryShared.hpp	Tue Aug 21 09:33:41 2018 -0400
@@ -293,9 +293,6 @@
 
   static void allocate_shared_data_arrays(int size, TRAPS);
   static void oops_do(OopClosure* f);
-  static void roots_oops_do(OopClosure* f) {
-    oops_do(f);
-  }
 
   // Check if sharing is supported for the class loader.
   static bool is_sharing_possible(ClassLoaderData* loader_data);
--- a/src/hotspot/share/gc/parallel/pcTasks.cpp	Tue Aug 21 13:12:15 2018 +0200
+++ b/src/hotspot/share/gc/parallel/pcTasks.cpp	Tue Aug 21 09:33:41 2018 -0400
@@ -107,8 +107,10 @@
       SystemDictionary::oops_do(&mark_and_push_closure);
       break;
 
-    case class_loader_data:
-      ClassLoaderDataGraph::always_strong_oops_do(&mark_and_push_closure, true);
+    case class_loader_data: {
+        CLDToOopClosure cld_closure(&mark_and_push_closure);
+        ClassLoaderDataGraph::always_strong_cld_do(&cld_closure);
+      }
       break;
 
     case code_cache:
--- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp	Tue Aug 21 13:12:15 2018 +0200
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp	Tue Aug 21 09:33:41 2018 -0400
@@ -2188,7 +2188,8 @@
   Management::oops_do(&oop_closure);
   JvmtiExport::oops_do(&oop_closure);
   SystemDictionary::oops_do(&oop_closure);
-  ClassLoaderDataGraph::oops_do(&oop_closure, true);
+  CLDToOopClosure cld_closure(&oop_closure);
+  ClassLoaderDataGraph::cld_do(&cld_closure);
 
   // Now adjust pointers in remaining weak roots.  (All of which should
   // have been cleared if they pointed to non-surviving objects.)
--- a/src/hotspot/share/prims/jvmtiTagMap.cpp	Tue Aug 21 13:12:15 2018 +0200
+++ b/src/hotspot/share/prims/jvmtiTagMap.cpp	Tue Aug 21 09:33:41 2018 -0400
@@ -3009,7 +3009,8 @@
   // Preloaded classes and loader from the system dictionary
   blk.set_kind(JVMTI_HEAP_REFERENCE_SYSTEM_CLASS);
   SystemDictionary::oops_do(&blk);
-  ClassLoaderDataGraph::always_strong_oops_do(&blk, false);
+  CLDToOopClosure cld_closure(&blk, false);
+  ClassLoaderDataGraph::always_strong_cld_do(&cld_closure);
   if (blk.stopped()) {
     return false;
   }