8210061: ZGC: Remove STW weak processor mode
authoreosterlund
Thu, 30 Aug 2018 08:59:23 +0200
changeset 51587 b459c731901b
parent 51586 eaa569eeb856
child 51588 f36e08f052b1
8210061: ZGC: Remove STW weak processor mode Reviewed-by: pliden, kbarrett
src/hotspot/share/gc/z/zRootsIterator.cpp
src/hotspot/share/gc/z/zRootsIterator.hpp
src/hotspot/share/gc/z/z_globals.hpp
--- a/src/hotspot/share/gc/z/zRootsIterator.cpp	Thu Aug 30 08:19:13 2018 +0200
+++ b/src/hotspot/share/gc/z/zRootsIterator.cpp	Thu Aug 30 08:59:23 2018 +0200
@@ -69,11 +69,8 @@
 static const ZStatSubPhase ZSubPhasePauseWeakRootsSetup("Pause Weak Roots Setup");
 static const ZStatSubPhase ZSubPhasePauseWeakRoots("Pause Weak Roots");
 static const ZStatSubPhase ZSubPhasePauseWeakRootsTeardown("Pause Weak Roots Teardown");
-static const ZStatSubPhase ZSubPhasePauseWeakRootsVMWeakHandles("Pause Weak Roots VMWeakHandles");
-static const ZStatSubPhase ZSubPhasePauseWeakRootsJNIWeakHandles("Pause Weak Roots JNIWeakHandles");
 static const ZStatSubPhase ZSubPhasePauseWeakRootsJVMTIWeakExport("Pause Weak Roots JVMTIWeakExport");
 static const ZStatSubPhase ZSubPhasePauseWeakRootsJFRWeak("Pause Weak Roots JFRWeak");
-static const ZStatSubPhase ZSubPhasePauseWeakRootsStringTable("Pause Weak Roots StringTable");
 
 static const ZStatSubPhase ZSubPhaseConcurrentWeakRoots("Concurrent Weak Roots");
 static const ZStatSubPhase ZSubPhaseConcurrentWeakRootsVMWeakHandles("Concurrent Weak Roots VMWeakHandles");
@@ -293,14 +290,8 @@
 }
 
 ZWeakRootsIterator::ZWeakRootsIterator() :
-    _vm_weak_handles_iter(SystemDictionary::vm_weak_oop_storage()),
-    _jni_weak_handles_iter(JNIHandles::weak_global_handles()),
-    _string_table_iter(StringTable::weak_storage()),
     _jvmti_weak_export(this),
-    _jfr_weak(this),
-    _vm_weak_handles(this),
-    _jni_weak_handles(this),
-    _string_table(this) {
+    _jfr_weak(this) {
   assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
   ZStatTimer timer(ZSubPhasePauseWeakRootsSetup);
   StringTable::reset_dead_counter();
@@ -311,16 +302,6 @@
   StringTable::finish_dead_counter();
 }
 
-void ZWeakRootsIterator::do_vm_weak_handles(BoolObjectClosure* is_alive, OopClosure* cl) {
-  ZStatTimer timer(ZSubPhasePauseWeakRootsVMWeakHandles);
-  _vm_weak_handles_iter.weak_oops_do(is_alive, cl);
-}
-
-void ZWeakRootsIterator::do_jni_weak_handles(BoolObjectClosure* is_alive, OopClosure* cl) {
-  ZStatTimer timer(ZSubPhasePauseWeakRootsJNIWeakHandles);
-  _jni_weak_handles_iter.weak_oops_do(is_alive, cl);
-}
-
 void ZWeakRootsIterator::do_jvmti_weak_export(BoolObjectClosure* is_alive, OopClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseWeakRootsJVMTIWeakExport);
   JvmtiExport::weak_oops_do(is_alive, cl);
@@ -333,50 +314,11 @@
 #endif
 }
 
-class ZStringTableDeadCounterBoolObjectClosure : public BoolObjectClosure  {
-private:
-  BoolObjectClosure* const _cl;
-  size_t                   _ndead;
-
-public:
-  ZStringTableDeadCounterBoolObjectClosure(BoolObjectClosure* cl) :
-      _cl(cl),
-      _ndead(0) {}
-
-  ~ZStringTableDeadCounterBoolObjectClosure() {
-    StringTable::inc_dead_counter(_ndead);
-  }
-
-  virtual bool do_object_b(oop obj) {
-    if (_cl->do_object_b(obj)) {
-      return true;
-    }
-
-    _ndead++;
-    return false;
-  }
-};
-
-void ZWeakRootsIterator::do_string_table(BoolObjectClosure* is_alive, OopClosure* cl) {
-  ZStatTimer timer(ZSubPhasePauseWeakRootsStringTable);
-  ZStringTableDeadCounterBoolObjectClosure counter_is_alive(is_alive);
-  _string_table_iter.weak_oops_do(&counter_is_alive, cl);
-}
-
 void ZWeakRootsIterator::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseWeakRoots);
   if (ZWeakRoots) {
     _jvmti_weak_export.weak_oops_do(is_alive, cl);
     _jfr_weak.weak_oops_do(is_alive, cl);
-    if (!ZConcurrentVMWeakHandles) {
-      _vm_weak_handles.weak_oops_do(is_alive, cl);
-    }
-    if (!ZConcurrentJNIWeakGlobalHandles) {
-      _jni_weak_handles.weak_oops_do(is_alive, cl);
-    }
-    if (!ZConcurrentStringTable) {
-      _string_table.weak_oops_do(is_alive, cl);
-    }
   }
 }
 
@@ -444,15 +386,9 @@
 void ZConcurrentWeakRootsIterator::oops_do(OopClosure* cl) {
   ZStatTimer timer(ZSubPhaseConcurrentWeakRoots);
   if (ZWeakRoots) {
-    if (ZConcurrentVMWeakHandles) {
-      _vm_weak_handles.oops_do(cl);
-    }
-    if (ZConcurrentJNIWeakGlobalHandles) {
-      _jni_weak_handles.oops_do(cl);
-    }
-    if (ZConcurrentStringTable) {
-      _string_table.oops_do(cl);
-    }
+    _vm_weak_handles.oops_do(cl);
+    _jni_weak_handles.oops_do(cl);
+    _string_table.oops_do(cl);
   }
 }
 
--- a/src/hotspot/share/gc/z/zRootsIterator.hpp	Thu Aug 30 08:19:13 2018 +0200
+++ b/src/hotspot/share/gc/z/zRootsIterator.hpp	Thu Aug 30 08:59:23 2018 +0200
@@ -122,21 +122,11 @@
 
 class ZWeakRootsIterator {
 private:
-  ZOopStorageIterator _vm_weak_handles_iter;
-  ZOopStorageIterator _jni_weak_handles_iter;
-  ZOopStorageIterator _string_table_iter;
-
-  void do_vm_weak_handles(BoolObjectClosure* is_alive, OopClosure* cl);
-  void do_jni_weak_handles(BoolObjectClosure* is_alive, OopClosure* cl);
   void do_jvmti_weak_export(BoolObjectClosure* is_alive, OopClosure* cl);
   void do_jfr_weak(BoolObjectClosure* is_alive, OopClosure* cl);
-  void do_string_table(BoolObjectClosure* is_alive, OopClosure* cl);
 
   ZSerialWeakOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_jvmti_weak_export>  _jvmti_weak_export;
   ZSerialWeakOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_jfr_weak>           _jfr_weak;
-  ZParallelWeakOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_vm_weak_handles>  _vm_weak_handles;
-  ZParallelWeakOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_jni_weak_handles> _jni_weak_handles;
-  ZParallelWeakOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_string_table>     _string_table;
 
 public:
   ZWeakRootsIterator();
--- a/src/hotspot/share/gc/z/z_globals.hpp	Thu Aug 30 08:19:13 2018 +0200
+++ b/src/hotspot/share/gc/z/z_globals.hpp	Thu Aug 30 08:59:23 2018 +0200
@@ -82,15 +82,6 @@
   diagnostic(bool, ZWeakRoots, true,                                        \
           "Treat JNI WeakGlobalRefs and StringTable as weak roots")         \
                                                                             \
-  diagnostic(bool, ZConcurrentStringTable, true,                            \
-          "Clean StringTable concurrently")                                 \
-                                                                            \
-  diagnostic(bool, ZConcurrentVMWeakHandles, true,                          \
-          "Clean VM WeakHandles concurrently")                              \
-                                                                            \
-  diagnostic(bool, ZConcurrentJNIWeakGlobalHandles, true,                   \
-          "Clean JNI WeakGlobalRefs concurrently")                          \
-                                                                            \
   diagnostic(bool, ZOptimizeLoadBarriers, true,                             \
           "Apply load barrier optimizations")                               \
                                                                             \