changeset 58285:942c6102590a

8236981: Remove ShenandoahTraversalUpdateRefsClosure Reviewed-by: shade, rkennke Contributed-by: adityam@microsoft.com
author rkennke
date Fri, 06 Mar 2020 13:41:14 +0100
parents b009dd349913
children cc8382a9118c
files src/hotspot/share/gc/shenandoah/shenandoahClosures.hpp src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp
diffstat 4 files changed, 9 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/shenandoah/shenandoahClosures.hpp	Fri Mar 06 11:40:03 2020 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahClosures.hpp	Fri Mar 06 13:41:14 2020 +0100
@@ -68,20 +68,6 @@
   inline void do_oop_work(T* p);
 };
 
-class ShenandoahTraversalUpdateRefsClosure: public OopClosure {
-private:
-  ShenandoahHeap* const           _heap;
-  ShenandoahHeapRegionSet* const  _traversal_set;
-
-public:
-  inline ShenandoahTraversalUpdateRefsClosure();
-  inline void do_oop(oop* p);
-  inline void do_oop(narrowOop* p);
-private:
-  template <class T>
-  inline void do_oop_work(T* p);
-};
-
 template <DecoratorSet MO = MO_UNORDERED>
 class ShenandoahEvacuateUpdateRootsClosure: public BasicOopIterateClosure {
 private:
--- a/src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp	Fri Mar 06 11:40:03 2020 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp	Fri Mar 06 13:41:14 2020 +0100
@@ -83,29 +83,6 @@
 void ShenandoahUpdateRefsClosure::do_oop(oop* p)       { do_oop_work(p); }
 void ShenandoahUpdateRefsClosure::do_oop(narrowOop* p) { do_oop_work(p); }
 
-ShenandoahTraversalUpdateRefsClosure::ShenandoahTraversalUpdateRefsClosure() :
-  _heap(ShenandoahHeap::heap()),
-  _traversal_set(ShenandoahHeap::heap()->traversal_gc()->traversal_set()) {
-  assert(_heap->is_traversal_mode(), "Why we here?");
-}
-
-template <class T>
-void ShenandoahTraversalUpdateRefsClosure::do_oop_work(T* p) {
-  T o = RawAccess<>::oop_load(p);
-  if (!CompressedOops::is_null(o)) {
-    oop obj = CompressedOops::decode_not_null(o);
-    if (_heap->in_collection_set(obj) || _traversal_set->is_in(obj)) {
-      obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
-      RawAccess<IS_NOT_NULL>::oop_store(p, obj);
-    } else {
-      shenandoah_assert_not_forwarded(p, obj);
-    }
-  }
-}
-
-void ShenandoahTraversalUpdateRefsClosure::do_oop(oop* p)       { do_oop_work(p); }
-void ShenandoahTraversalUpdateRefsClosure::do_oop(narrowOop* p) { do_oop_work(p); }
-
 template <DecoratorSet MO>
 ShenandoahEvacuateUpdateRootsClosure<MO>::ShenandoahEvacuateUpdateRootsClosure() :
   _heap(ShenandoahHeap::heap()), _thread(Thread::current()) {
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Fri Mar 06 11:40:03 2020 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Fri Mar 06 13:41:14 2020 +0100
@@ -2180,19 +2180,11 @@
   ShenandoahGCPhase phase(timing_phase);
   phase_timings()->record_workers_start(timing_phase);
   if (has_forwarded_objects()) {
-    if (is_traversal_mode()) {
-      ShenandoahForwardedIsAliveClosure is_alive;
-      ShenandoahTraversalUpdateRefsClosure keep_alive;
-      ShenandoahParallelWeakRootsCleaningTask<ShenandoahForwardedIsAliveClosure, ShenandoahTraversalUpdateRefsClosure>
-        cleaning_task(&is_alive, &keep_alive, num_workers, !ShenandoahConcurrentRoots::should_do_concurrent_class_unloading());
-      _workers->run_task(&cleaning_task);
-    } else {
-      ShenandoahForwardedIsAliveClosure is_alive;
-      ShenandoahUpdateRefsClosure keep_alive;
-      ShenandoahParallelWeakRootsCleaningTask<ShenandoahForwardedIsAliveClosure, ShenandoahUpdateRefsClosure>
-        cleaning_task(&is_alive, &keep_alive, num_workers, !ShenandoahConcurrentRoots::should_do_concurrent_class_unloading());
-      _workers->run_task(&cleaning_task);
-    }
+    ShenandoahForwardedIsAliveClosure is_alive;
+    ShenandoahUpdateRefsClosure keep_alive;
+    ShenandoahParallelWeakRootsCleaningTask<ShenandoahForwardedIsAliveClosure, ShenandoahUpdateRefsClosure>
+      cleaning_task(&is_alive, &keep_alive, num_workers, !ShenandoahConcurrentRoots::should_do_concurrent_class_unloading());
+    _workers->run_task(&cleaning_task);
   } else {
     ShenandoahIsAliveClosure is_alive;
 #ifdef ASSERT
--- a/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp	Fri Mar 06 11:40:03 2020 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp	Fri Mar 06 13:41:14 2020 +0100
@@ -605,8 +605,11 @@
     // that results the TLAB/GCLAB not usable. Retire them here.
     _heap->make_parsable(true);
 
+    // Do this fixup before the call to parallel_cleaning to ensure that all
+    // forwarded objects (including those that are no longer in the cset) are
+    // updated by the time we do weak root processing.
+    fixup_roots();
     _heap->parallel_cleaning(false);
-    fixup_roots();
 
     _heap->set_has_forwarded_objects(false);