changeset 52589:a16777c0a6c5

8210881: ZGC: Introduce ZRootsIteratorClosure Reviewed-by: eosterlund
author pliden
date Wed, 19 Sep 2018 19:12:18 +0200
parents 15094d12a632
children eef954e29714
files src/hotspot/share/gc/z/zHeap.cpp src/hotspot/share/gc/z/zHeapIterator.cpp src/hotspot/share/gc/z/zMark.cpp src/hotspot/share/gc/z/zOopClosures.hpp src/hotspot/share/gc/z/zOopClosures.inline.hpp src/hotspot/share/gc/z/zRelocate.cpp src/hotspot/share/gc/z/zRootsIterator.cpp src/hotspot/share/gc/z/zRootsIterator.hpp
diffstat 8 files changed, 134 insertions(+), 126 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/z/zHeap.cpp	Wed Sep 19 09:24:40 2018 -0700
+++ b/src/hotspot/share/gc/z/zHeap.cpp	Wed Sep 19 19:12:18 2018 +0200
@@ -304,6 +304,17 @@
   _mark.flush_and_free(thread);
 }
 
+class ZFixupPartialLoadsClosure : public ZRootsIteratorClosure {
+public:
+  virtual void do_oop(oop* p) {
+    ZBarrier::mark_barrier_on_root_oop_field(p);
+  }
+
+  virtual void do_oop(narrowOop* p) {
+    ShouldNotReachHere();
+  }
+};
+
 class ZFixupPartialLoadsTask : public ZTask {
 private:
   ZThreadRootsIterator _thread_roots;
@@ -314,7 +325,7 @@
       _thread_roots() {}
 
   virtual void work() {
-    ZMarkRootOopClosure cl;
+    ZFixupPartialLoadsClosure cl;
     _thread_roots.oops_do(&cl);
   }
 };
--- a/src/hotspot/share/gc/z/zHeapIterator.cpp	Wed Sep 19 09:24:40 2018 -0700
+++ b/src/hotspot/share/gc/z/zHeapIterator.cpp	Wed Sep 19 19:12:18 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
   }
 };
 
-class ZHeapIteratorRootOopClosure : public OopClosure {
+class ZHeapIteratorRootOopClosure : public ZRootsIteratorClosure {
 private:
   ZHeapIterator* const _iter;
   ObjectClosure* const _cl;
--- a/src/hotspot/share/gc/z/zMark.cpp	Wed Sep 19 09:24:40 2018 -0700
+++ b/src/hotspot/share/gc/z/zMark.cpp	Wed Sep 19 19:12:18 2018 +0200
@@ -117,6 +117,24 @@
   }
 }
 
+class ZMarkRootsIteratorClosure : public ZRootsIteratorClosure {
+public:
+  virtual void do_thread(Thread* thread) {
+    ZRootsIteratorClosure::do_thread(thread);
+
+    // Update thread local address bad mask
+    ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask);
+  }
+
+  virtual void do_oop(oop* p) {
+    ZBarrier::mark_barrier_on_root_oop_field(p);
+  }
+
+  virtual void do_oop(narrowOop* p) {
+    ShouldNotReachHere();
+  }
+};
+
 class ZMarkRootsTask : public ZTask {
 private:
   ZMark* const   _mark;
@@ -129,7 +147,7 @@
       _roots() {}
 
   virtual void work() {
-    ZMarkRootOopClosure cl;
+    ZMarkRootsIteratorClosure cl;
     _roots.oops_do(&cl);
 
     // Flush and free worker stacks. Needed here since
--- a/src/hotspot/share/gc/z/zOopClosures.hpp	Wed Sep 19 09:24:40 2018 -0700
+++ b/src/hotspot/share/gc/z/zOopClosures.hpp	Wed Sep 19 19:12:18 2018 +0200
@@ -25,6 +25,7 @@
 #define SHARE_GC_Z_ZOOPCLOSURES_HPP
 
 #include "memory/iterator.hpp"
+#include "gc/z/zRootsIterator.hpp"
 
 class ZLoadBarrierOopClosure : public BasicOopIterateClosure {
 public:
@@ -38,18 +39,6 @@
 #endif
 };
 
-class ZMarkRootOopClosure : public OopClosure {
-public:
-  virtual void do_oop(oop* p);
-  virtual void do_oop(narrowOop* p);
-};
-
-class ZRelocateRootOopClosure : public OopClosure {
-public:
-  virtual void do_oop(oop* p);
-  virtual void do_oop(narrowOop* p);
-};
-
 template <bool finalizable>
 class ZMarkBarrierOopClosure : public BasicOopIterateClosure {
 public:
@@ -70,13 +59,13 @@
   virtual bool do_object_b(oop o);
 };
 
-class ZPhantomKeepAliveOopClosure : public OopClosure {
+class ZPhantomKeepAliveOopClosure : public ZRootsIteratorClosure {
 public:
   virtual void do_oop(oop* p);
   virtual void do_oop(narrowOop* p);
 };
 
-class ZPhantomCleanOopClosure : public OopClosure {
+class ZPhantomCleanOopClosure : public ZRootsIteratorClosure {
 public:
   virtual void do_oop(oop* p);
   virtual void do_oop(narrowOop* p);
@@ -97,7 +86,7 @@
 #endif
 };
 
-class ZVerifyRootOopClosure : public OopClosure {
+class ZVerifyRootOopClosure : public ZRootsIteratorClosure {
 public:
   ZVerifyRootOopClosure();
 
--- a/src/hotspot/share/gc/z/zOopClosures.inline.hpp	Wed Sep 19 09:24:40 2018 -0700
+++ b/src/hotspot/share/gc/z/zOopClosures.inline.hpp	Wed Sep 19 19:12:18 2018 +0200
@@ -40,22 +40,6 @@
   ShouldNotReachHere();
 }
 
-inline void ZMarkRootOopClosure::do_oop(oop* p) {
-  ZBarrier::mark_barrier_on_root_oop_field(p);
-}
-
-inline void ZMarkRootOopClosure::do_oop(narrowOop* p) {
-  ShouldNotReachHere();
-}
-
-inline void ZRelocateRootOopClosure::do_oop(oop* p) {
-  ZBarrier::relocate_barrier_on_root_oop_field(p);
-}
-
-inline void ZRelocateRootOopClosure::do_oop(narrowOop* p) {
-  ShouldNotReachHere();
-}
-
 template <bool finalizable>
 inline ZMarkBarrierOopClosure<finalizable>::ZMarkBarrierOopClosure() :
     BasicOopIterateClosure(finalizable ? NULL : ZHeap::heap()->reference_discoverer()) {}
--- a/src/hotspot/share/gc/z/zRelocate.cpp	Wed Sep 19 09:24:40 2018 -0700
+++ b/src/hotspot/share/gc/z/zRelocate.cpp	Wed Sep 19 19:12:18 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,24 @@
 ZRelocate::ZRelocate(ZWorkers* workers) :
     _workers(workers) {}
 
+class ZRelocateRootsIteratorClosure : public ZRootsIteratorClosure {
+public:
+  virtual void do_thread(Thread* thread) {
+    ZRootsIteratorClosure::do_thread(thread);
+
+    // Update thread local address bad mask
+    ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask);
+  }
+
+  virtual void do_oop(oop* p) {
+    ZBarrier::relocate_barrier_on_root_oop_field(p);
+  }
+
+  virtual void do_oop(narrowOop* p) {
+    ShouldNotReachHere();
+  }
+};
+
 class ZRelocateRootsTask : public ZTask {
 private:
   ZRootsIterator _roots;
@@ -46,7 +64,7 @@
   virtual void work() {
     // During relocation we need to visit the JVMTI
     // export weak roots to rehash the JVMTI tag map
-    ZRelocateRootOopClosure cl;
+    ZRelocateRootsIteratorClosure cl;
     _roots.oops_do(&cl, true /* visit_jvmti_weak_export */);
   }
 };
--- a/src/hotspot/share/gc/z/zRootsIterator.cpp	Wed Sep 19 09:24:40 2018 -0700
+++ b/src/hotspot/share/gc/z/zRootsIterator.cpp	Wed Sep 19 19:12:18 2018 +0200
@@ -73,25 +73,25 @@
 static const ZStatSubPhase ZSubPhaseConcurrentWeakRootsJNIWeakHandles("Concurrent Weak Roots JNIWeakHandles");
 static const ZStatSubPhase ZSubPhaseConcurrentWeakRootsStringTable("Concurrent Weak Roots StringTable");
 
-template <typename T, void (T::*F)(OopClosure*)>
+template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
 ZSerialOopsDo<T, F>::ZSerialOopsDo(T* iter) :
     _iter(iter),
     _claimed(false) {}
 
-template <typename T, void (T::*F)(OopClosure*)>
-void ZSerialOopsDo<T, F>::oops_do(OopClosure* cl) {
+template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
+void ZSerialOopsDo<T, F>::oops_do(ZRootsIteratorClosure* cl) {
   if (!_claimed && Atomic::cmpxchg(true, &_claimed, false) == false) {
     (_iter->*F)(cl);
   }
 }
 
-template <typename T, void (T::*F)(OopClosure*)>
+template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
 ZParallelOopsDo<T, F>::ZParallelOopsDo(T* iter) :
     _iter(iter),
     _completed(false) {}
 
-template <typename T, void (T::*F)(OopClosure*)>
-void ZParallelOopsDo<T, F>::oops_do(OopClosure* cl) {
+template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
+void ZParallelOopsDo<T, F>::oops_do(ZRootsIteratorClosure* cl) {
   if (!_completed) {
     (_iter->*F)(cl);
     if (!_completed) {
@@ -100,25 +100,25 @@
   }
 }
 
-template <typename T, void (T::*F)(BoolObjectClosure*, OopClosure*)>
+template <typename T, void (T::*F)(BoolObjectClosure*, ZRootsIteratorClosure*)>
 ZSerialWeakOopsDo<T, F>::ZSerialWeakOopsDo(T* iter) :
     _iter(iter),
     _claimed(false) {}
 
-template <typename T, void (T::*F)(BoolObjectClosure*, OopClosure*)>
-void ZSerialWeakOopsDo<T, F>::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* cl) {
+template <typename T, void (T::*F)(BoolObjectClosure*, ZRootsIteratorClosure*)>
+void ZSerialWeakOopsDo<T, F>::weak_oops_do(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl) {
   if (!_claimed && Atomic::cmpxchg(true, &_claimed, false) == false) {
     (_iter->*F)(is_alive, cl);
   }
 }
 
-template <typename T, void (T::*F)(BoolObjectClosure*, OopClosure*)>
+template <typename T, void (T::*F)(BoolObjectClosure*, ZRootsIteratorClosure*)>
 ZParallelWeakOopsDo<T, F>::ZParallelWeakOopsDo(T* iter) :
     _iter(iter),
     _completed(false) {}
 
-template <typename T, void (T::*F)(BoolObjectClosure*, OopClosure*)>
-void ZParallelWeakOopsDo<T, F>::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* cl) {
+template <typename T, void (T::*F)(BoolObjectClosure*, ZRootsIteratorClosure*)>
+void ZParallelWeakOopsDo<T, F>::weak_oops_do(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl) {
   if (!_completed) {
     (_iter->*F)(is_alive, cl);
     if (!_completed) {
@@ -158,80 +158,60 @@
   Threads::assert_all_threads_claimed();
 }
 
-void ZRootsIterator::do_universe(OopClosure* cl) {
+void ZRootsIterator::do_universe(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsUniverse);
   Universe::oops_do(cl);
 }
 
-void ZRootsIterator::do_jni_handles(OopClosure* cl) {
+void ZRootsIterator::do_jni_handles(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsJNIHandles);
   _jni_handles_iter.oops_do(cl);
 }
 
-void ZRootsIterator::do_object_synchronizer(OopClosure* cl) {
+void ZRootsIterator::do_object_synchronizer(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsObjectSynchronizer);
   ObjectSynchronizer::oops_do(cl);
 }
 
-void ZRootsIterator::do_management(OopClosure* cl) {
+void ZRootsIterator::do_management(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsManagement);
   Management::oops_do(cl);
 }
 
-void ZRootsIterator::do_jvmti_export(OopClosure* cl) {
+void ZRootsIterator::do_jvmti_export(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsJVMTIExport);
   JvmtiExport::oops_do(cl);
 }
 
-void ZRootsIterator::do_jvmti_weak_export(OopClosure* cl) {
+void ZRootsIterator::do_jvmti_weak_export(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsJVMTIWeakExport);
   AlwaysTrueClosure always_alive;
   JvmtiExport::weak_oops_do(&always_alive, cl);
 }
 
-void ZRootsIterator::do_system_dictionary(OopClosure* cl) {
+void ZRootsIterator::do_system_dictionary(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsSystemDictionary);
   SystemDictionary::oops_do(cl);
 }
 
-void ZRootsIterator::do_class_loader_data_graph(OopClosure* cl) {
+void ZRootsIterator::do_class_loader_data_graph(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsClassLoaderDataGraph);
   CLDToOopClosure cld_cl(cl);
   ClassLoaderDataGraph::cld_do(&cld_cl);
 }
 
-class ZRootsIteratorThreadClosure : public ThreadClosure {
-private:
-  OopClosure* const _cl;
-
-public:
-  ZRootsIteratorThreadClosure(OopClosure* cl) :
-      _cl(cl) {}
-
-  virtual void do_thread(Thread* thread) {
-    if (thread->is_Java_thread()) {
-      // Update thread local address bad mask
-      ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask);
-    }
-
-    // Process thread oops
-    thread->oops_do(_cl, NULL);
-  }
-};
-
-void ZRootsIterator::do_threads(OopClosure* cl) {
+void ZRootsIterator::do_threads(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsThreads);
   ResourceMark rm;
-  ZRootsIteratorThreadClosure thread_cl(cl);
-  Threads::possibly_parallel_threads_do(true, &thread_cl);
+  Threads::possibly_parallel_threads_do(true, cl);
 }
 
-void ZRootsIterator::do_code_cache(OopClosure* cl) {
+void ZRootsIterator::do_code_cache(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsCodeCache);
   ZNMethodTable::oops_do(cl);
 }
 
-void ZRootsIterator::oops_do(OopClosure* cl, bool visit_jvmti_weak_export) {
+void ZRootsIterator::oops_do(ZRootsIteratorClosure* cl, bool visit_jvmti_weak_export) {
   ZStatTimer timer(ZSubPhasePauseRoots);
   _universe.oops_do(cl);
   _object_synchronizer.oops_do(cl);
@@ -258,25 +238,25 @@
   ZStatTimer timer(ZSubPhasePauseWeakRootsTeardown);
 }
 
-void ZWeakRootsIterator::do_jvmti_weak_export(BoolObjectClosure* is_alive, OopClosure* cl) {
+void ZWeakRootsIterator::do_jvmti_weak_export(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseWeakRootsJVMTIWeakExport);
   JvmtiExport::weak_oops_do(is_alive, cl);
 }
 
-void ZWeakRootsIterator::do_jfr_weak(BoolObjectClosure* is_alive, OopClosure* cl) {
+void ZWeakRootsIterator::do_jfr_weak(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl) {
 #if INCLUDE_JFR
   ZStatTimer timer(ZSubPhasePauseWeakRootsJFRWeak);
   Jfr::weak_oops_do(is_alive, cl);
 #endif
 }
 
-void ZWeakRootsIterator::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* cl) {
+void ZWeakRootsIterator::weak_oops_do(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseWeakRoots);
   _jvmti_weak_export.weak_oops_do(is_alive, cl);
   _jfr_weak.weak_oops_do(is_alive, cl);
 }
 
-void ZWeakRootsIterator::oops_do(OopClosure* cl) {
+void ZWeakRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
   AlwaysTrueClosure always_alive;
   weak_oops_do(&always_alive, cl);
 }
@@ -295,27 +275,27 @@
   StringTable::finish_dead_counter();
 }
 
-void ZConcurrentWeakRootsIterator::do_vm_weak_handles(OopClosure* cl) {
+void ZConcurrentWeakRootsIterator::do_vm_weak_handles(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhaseConcurrentWeakRootsVMWeakHandles);
   _vm_weak_handles_iter.oops_do(cl);
 }
 
-void ZConcurrentWeakRootsIterator::do_jni_weak_handles(OopClosure* cl) {
+void ZConcurrentWeakRootsIterator::do_jni_weak_handles(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhaseConcurrentWeakRootsJNIWeakHandles);
   _jni_weak_handles_iter.oops_do(cl);
 }
 
-class ZStringTableDeadCounterOopClosure : public OopClosure  {
+class ZStringTableDeadCounterClosure : public ZRootsIteratorClosure  {
 private:
-  OopClosure* const _cl;
-  size_t            _ndead;
+  ZRootsIteratorClosure* const _cl;
+  size_t                       _ndead;
 
 public:
-  ZStringTableDeadCounterOopClosure(OopClosure* cl) :
+  ZStringTableDeadCounterClosure(ZRootsIteratorClosure* cl) :
       _cl(cl),
       _ndead(0) {}
 
-  ~ZStringTableDeadCounterOopClosure() {
+  ~ZStringTableDeadCounterClosure() {
     StringTable::inc_dead_counter(_ndead);
   }
 
@@ -331,13 +311,13 @@
   }
 };
 
-void ZConcurrentWeakRootsIterator::do_string_table(OopClosure* cl) {
+void ZConcurrentWeakRootsIterator::do_string_table(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhaseConcurrentWeakRootsStringTable);
-  ZStringTableDeadCounterOopClosure counter_cl(cl);
+  ZStringTableDeadCounterClosure counter_cl(cl);
   _string_table_iter.oops_do(&counter_cl);
 }
 
-void ZConcurrentWeakRootsIterator::oops_do(OopClosure* cl) {
+void ZConcurrentWeakRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhaseConcurrentWeakRoots);
   _vm_weak_handles.oops_do(cl);
   _jni_weak_handles.oops_do(cl);
@@ -356,13 +336,13 @@
   Threads::assert_all_threads_claimed();
 }
 
-void ZThreadRootsIterator::do_threads(OopClosure* cl) {
+void ZThreadRootsIterator::do_threads(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsThreads);
   ResourceMark rm;
   Threads::possibly_parallel_oops_do(true, cl, NULL);
 }
 
-void ZThreadRootsIterator::oops_do(OopClosure* cl) {
+void ZThreadRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRoots);
   _threads.oops_do(cl);
 }
--- a/src/hotspot/share/gc/z/zRootsIterator.hpp	Wed Sep 19 09:24:40 2018 -0700
+++ b/src/hotspot/share/gc/z/zRootsIterator.hpp	Wed Sep 19 19:12:18 2018 +0200
@@ -27,12 +27,20 @@
 #include "gc/shared/oopStorageParState.hpp"
 #include "memory/allocation.hpp"
 #include "memory/iterator.hpp"
+#include "runtime/thread.hpp"
 #include "utilities/globalDefinitions.hpp"
 
+class ZRootsIteratorClosure : public OopClosure, public ThreadClosure {
+public:
+  virtual void do_thread(Thread* thread) {
+    thread->oops_do(this, NULL);
+  }
+};
+
 typedef OopStorage::ParState<false /* concurrent */, false /* is_const */> ZOopStorageIterator;
 typedef OopStorage::ParState<true /* concurrent */, false /* is_const */>  ZConcurrentOopStorageIterator;
 
-template <typename T, void (T::*F)(OopClosure*)>
+template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
 class ZSerialOopsDo {
 private:
   T* const      _iter;
@@ -40,10 +48,10 @@
 
 public:
   ZSerialOopsDo(T* iter);
-  void oops_do(OopClosure* cl);
+  void oops_do(ZRootsIteratorClosure* cl);
 };
 
-template <typename T, void (T::*F)(OopClosure*)>
+template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
 class ZParallelOopsDo {
 private:
   T* const      _iter;
@@ -51,10 +59,10 @@
 
 public:
   ZParallelOopsDo(T* iter);
-  void oops_do(OopClosure* cl);
+  void oops_do(ZRootsIteratorClosure* cl);
 };
 
-template <typename T, void (T::*F)(BoolObjectClosure*, OopClosure*)>
+template <typename T, void (T::*F)(BoolObjectClosure*, ZRootsIteratorClosure*)>
 class ZSerialWeakOopsDo {
 private:
   T* const      _iter;
@@ -62,10 +70,10 @@
 
 public:
   ZSerialWeakOopsDo(T* iter);
-  void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* cl);
+  void weak_oops_do(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl);
 };
 
-template <typename T, void (T::*F)(BoolObjectClosure*, OopClosure*)>
+template <typename T, void (T::*F)(BoolObjectClosure*, ZRootsIteratorClosure*)>
 class ZParallelWeakOopsDo {
 private:
   T* const      _iter;
@@ -73,23 +81,23 @@
 
 public:
   ZParallelWeakOopsDo(T* iter);
-  void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* cl);
+  void weak_oops_do(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl);
 };
 
 class ZRootsIterator {
 private:
   ZOopStorageIterator _jni_handles_iter;
 
-  void do_universe(OopClosure* cl);
-  void do_jni_handles(OopClosure* cl);
-  void do_object_synchronizer(OopClosure* cl);
-  void do_management(OopClosure* cl);
-  void do_jvmti_export(OopClosure* cl);
-  void do_jvmti_weak_export(OopClosure* cl);
-  void do_system_dictionary(OopClosure* cl);
-  void do_class_loader_data_graph(OopClosure* cl);
-  void do_threads(OopClosure* cl);
-  void do_code_cache(OopClosure* cl);
+  void do_universe(ZRootsIteratorClosure* cl);
+  void do_jni_handles(ZRootsIteratorClosure* cl);
+  void do_object_synchronizer(ZRootsIteratorClosure* cl);
+  void do_management(ZRootsIteratorClosure* cl);
+  void do_jvmti_export(ZRootsIteratorClosure* cl);
+  void do_jvmti_weak_export(ZRootsIteratorClosure* cl);
+  void do_system_dictionary(ZRootsIteratorClosure* cl);
+  void do_class_loader_data_graph(ZRootsIteratorClosure* cl);
+  void do_threads(ZRootsIteratorClosure* cl);
+  void do_code_cache(ZRootsIteratorClosure* cl);
 
   ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_universe>                  _universe;
   ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_object_synchronizer>       _object_synchronizer;
@@ -106,13 +114,13 @@
   ZRootsIterator();
   ~ZRootsIterator();
 
-  void oops_do(OopClosure* cl, bool visit_jvmti_weak_export = false);
+  void oops_do(ZRootsIteratorClosure* cl, bool visit_jvmti_weak_export = false);
 };
 
 class ZWeakRootsIterator {
 private:
-  void do_jvmti_weak_export(BoolObjectClosure* is_alive, OopClosure* cl);
-  void do_jfr_weak(BoolObjectClosure* is_alive, OopClosure* cl);
+  void do_jvmti_weak_export(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl);
+  void do_jfr_weak(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl);
 
   ZSerialWeakOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_jvmti_weak_export>  _jvmti_weak_export;
   ZSerialWeakOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_jfr_weak>           _jfr_weak;
@@ -121,8 +129,8 @@
   ZWeakRootsIterator();
   ~ZWeakRootsIterator();
 
-  void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* cl);
-  void oops_do(OopClosure* cl);
+  void weak_oops_do(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl);
+  void oops_do(ZRootsIteratorClosure* cl);
 };
 
 class ZConcurrentWeakRootsIterator {
@@ -131,9 +139,9 @@
   ZConcurrentOopStorageIterator _jni_weak_handles_iter;
   ZConcurrentOopStorageIterator _string_table_iter;
 
-  void do_vm_weak_handles(OopClosure* cl);
-  void do_jni_weak_handles(OopClosure* cl);
-  void do_string_table(OopClosure* cl);
+  void do_vm_weak_handles(ZRootsIteratorClosure* cl);
+  void do_jni_weak_handles(ZRootsIteratorClosure* cl);
+  void do_string_table(ZRootsIteratorClosure* cl);
 
   ZParallelOopsDo<ZConcurrentWeakRootsIterator, &ZConcurrentWeakRootsIterator::do_vm_weak_handles>  _vm_weak_handles;
   ZParallelOopsDo<ZConcurrentWeakRootsIterator, &ZConcurrentWeakRootsIterator::do_jni_weak_handles> _jni_weak_handles;
@@ -143,12 +151,12 @@
   ZConcurrentWeakRootsIterator();
   ~ZConcurrentWeakRootsIterator();
 
-  void oops_do(OopClosure* cl);
+  void oops_do(ZRootsIteratorClosure* cl);
 };
 
 class ZThreadRootsIterator {
 private:
-  void do_threads(OopClosure* cl);
+  void do_threads(ZRootsIteratorClosure* cl);
 
   ZParallelOopsDo<ZThreadRootsIterator, &ZThreadRootsIterator::do_threads> _threads;
 
@@ -156,7 +164,7 @@
   ZThreadRootsIterator();
   ~ZThreadRootsIterator();
 
-  void oops_do(OopClosure* cl);
+  void oops_do(ZRootsIteratorClosure* cl);
 };
 
 #endif // SHARE_GC_Z_ZROOTSITERATOR_HPP