src/hotspot/share/gc/z/zHeap.cpp
changeset 55603 3868dde58ebb
parent 55311 d60b24a09900
child 57901 53ed0cf870b0
--- a/src/hotspot/share/gc/z/zHeap.cpp	Tue Jul 02 12:24:26 2019 +0200
+++ b/src/hotspot/share/gc/z/zHeap.cpp	Mon Jun 10 13:04:12 2019 +0200
@@ -41,6 +41,7 @@
 #include "gc/z/zTask.hpp"
 #include "gc/z/zThread.hpp"
 #include "gc/z/zTracer.inline.hpp"
+#include "gc/z/zVerify.hpp"
 #include "gc/z/zVirtualMemory.inline.hpp"
 #include "gc/z/zWorkers.inline.hpp"
 #include "logging/log.hpp"
@@ -340,6 +341,9 @@
   // Enter mark completed phase
   ZGlobalPhase = ZPhaseMarkCompleted;
 
+  // Verify after mark
+  ZVerify::after_mark();
+
   // Update statistics
   ZStatSample(ZSamplerHeapUsedAfterMark, used());
   ZStatHeap::set_at_mark_end(capacity(), allocated(), used());
@@ -468,11 +472,11 @@
                                  used(), used_high(), used_low());
 }
 
-void ZHeap::object_iterate(ObjectClosure* cl, bool visit_referents) {
+void ZHeap::object_iterate(ObjectClosure* cl, bool visit_weaks) {
   assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
 
   ZHeapIterator iter;
-  iter.objects_do(cl, visit_referents);
+  iter.objects_do(cl, visit_weaks);
 }
 
 void ZHeap::serviceability_initialize() {
@@ -518,40 +522,11 @@
   st->cr();
 }
 
-class ZVerifyRootsTask : public ZTask {
-private:
-  ZStatTimerDisable  _disable;
-  ZRootsIterator     _strong_roots;
-  ZWeakRootsIterator _weak_roots;
-
-public:
-  ZVerifyRootsTask() :
-      ZTask("ZVerifyRootsTask"),
-      _disable(),
-      _strong_roots(),
-      _weak_roots() {}
-
-  virtual void work() {
-    ZStatTimerDisable disable;
-    ZVerifyOopClosure cl;
-    _strong_roots.oops_do(&cl);
-    _weak_roots.oops_do(&cl);
-  }
-};
-
 void ZHeap::verify() {
   // Heap verification can only be done between mark end and
   // relocate start. This is the only window where all oop are
   // good and the whole heap is in a consistent state.
   guarantee(ZGlobalPhase == ZPhaseMarkCompleted, "Invalid phase");
 
-  {
-    ZVerifyRootsTask task;
-    _workers.run_parallel(&task);
-  }
-
-  {
-    ZVerifyObjectClosure cl;
-    object_iterate(&cl, false /* visit_referents */);
-  }
+  ZVerify::after_weak_processing();
 }