changeset 60124:1b1ac7db8b0d

8248652: Shenandoah: SATB buffer handling may assume no forwarded objects Reviewed-by: rkennke
author shade
date Fri, 10 Jul 2020 10:37:12 +0200
parents f5196c0828a7
children 844236b5995d
files src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.inline.hpp src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp
diffstat 5 files changed, 9 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp	Fri Jul 10 02:51:04 2020 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp	Fri Jul 10 10:37:12 2020 +0200
@@ -82,7 +82,7 @@
   // Filter marked objects before hitting the SATB queues. The same predicate would
   // be used by SATBMQ::filter to eliminate already marked objects downstream, but
   // filtering here helps to avoid wasteful SATB queueing work to begin with.
-  if (!_heap->requires_marking<false>(obj)) return;
+  if (!_heap->requires_marking(obj)) return;
 
   ShenandoahThreadLocalData::satb_mark_queue(Thread::current()).enqueue_known_active(obj);
 }
--- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.inline.hpp	Fri Jul 10 02:51:04 2020 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.inline.hpp	Fri Jul 10 10:37:12 2020 +0200
@@ -203,26 +203,19 @@
   }
 
   void do_buffer(void **buffer, size_t size) {
-    if (_heap->has_forwarded_objects()) {
-      if (ShenandoahStringDedup::is_enabled()) {
-        do_buffer_impl<RESOLVE, ENQUEUE_DEDUP>(buffer, size);
-      } else {
-        do_buffer_impl<RESOLVE, NO_DEDUP>(buffer, size);
-      }
+    assert(size == 0 || !_heap->has_forwarded_objects(), "Forwarded objects are not expected here");
+    if (ShenandoahStringDedup::is_enabled()) {
+      do_buffer_impl<ENQUEUE_DEDUP>(buffer, size);
     } else {
-      if (ShenandoahStringDedup::is_enabled()) {
-        do_buffer_impl<NONE, ENQUEUE_DEDUP>(buffer, size);
-      } else {
-        do_buffer_impl<NONE, NO_DEDUP>(buffer, size);
-      }
+      do_buffer_impl<NO_DEDUP>(buffer, size);
     }
   }
 
-  template<UpdateRefsMode UPDATE_REFS, StringDedupMode STRING_DEDUP>
+  template<StringDedupMode STRING_DEDUP>
   void do_buffer_impl(void **buffer, size_t size) {
     for (size_t i = 0; i < size; ++i) {
       oop *p = (oop *) &buffer[i];
-      ShenandoahConcurrentMark::mark_through_ref<oop, UPDATE_REFS, STRING_DEDUP>(p, _heap, _queue, _mark_context);
+      ShenandoahConcurrentMark::mark_through_ref<oop, NONE, STRING_DEDUP>(p, _heap, _queue, _mark_context);
     }
   }
 };
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp	Fri Jul 10 02:51:04 2020 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp	Fri Jul 10 10:37:12 2020 +0200
@@ -656,7 +656,6 @@
   void reset_mark_bitmap();
 
   // SATB barriers hooks
-  template<bool RESOLVE>
   inline bool requires_marking(const void* entry) const;
   void force_satb_flush_all_threads();
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp	Fri Jul 10 02:51:04 2020 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp	Fri Jul 10 10:37:12 2020 +0200
@@ -326,12 +326,8 @@
   }
 }
 
-template<bool RESOLVE>
 inline bool ShenandoahHeap::requires_marking(const void* entry) const {
   oop obj = oop(entry);
-  if (RESOLVE) {
-    obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
-  }
   return !_marking_context->is_marked(obj);
 }
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp	Fri Jul 10 02:51:04 2020 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp	Fri Jul 10 10:37:12 2020 +0200
@@ -36,7 +36,6 @@
   return ShenandoahThreadLocalData::satb_mark_queue(t);
 }
 
-template <bool RESOLVE>
 class ShenandoahSATBMarkQueueFilterFn {
   ShenandoahHeap* const _heap;
 
@@ -46,17 +45,13 @@
   // Return true if entry should be filtered out (removed), false if
   // it should be retained.
   bool operator()(const void* entry) const {
-    return !_heap->requires_marking<RESOLVE>(entry);
+    return !_heap->requires_marking(entry);
   }
 };
 
 void ShenandoahSATBMarkQueueSet::filter(SATBMarkQueue* queue) {
   ShenandoahHeap* heap = ShenandoahHeap::heap();
-  if (heap->has_forwarded_objects()) {
-    apply_filter(ShenandoahSATBMarkQueueFilterFn<true>(heap), queue);
-  } else {
-    apply_filter(ShenandoahSATBMarkQueueFilterFn<false>(heap), queue);
-  }
+  apply_filter(ShenandoahSATBMarkQueueFilterFn(heap), queue);
 }
 
 void ShenandoahSATBMarkQueue::handle_completed_buffer() {