# HG changeset patch # User rkennke # Date 1550676569 -3600 # Node ID f42c58bab9736b449df26ad166eeaafd83cf89a5 # Parent 46ef4dea49e55d4ee21090c810b373d13441c84e 8203232: Shenandoah: Resolve oops in SATB filter Reviewed-by: shade diff -r 46ef4dea49e5 -r f42c58bab973 src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp Wed Feb 20 10:22:46 2019 -0500 +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp Wed Feb 20 16:29:29 2019 +0100 @@ -335,7 +335,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(obj)) return; + if (!_heap->requires_marking(obj)) return; Thread* thr = Thread::current(); if (thr->is_Java_thread()) { diff -r 46ef4dea49e5 -r f42c58bab973 src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Wed Feb 20 10:22:46 2019 -0500 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Wed Feb 20 16:29:29 2019 +0100 @@ -676,6 +676,7 @@ void reset_mark_bitmap(); // SATB barriers hooks + template inline bool requires_marking(const void* entry) const; void force_satb_flush_all_threads(); diff -r 46ef4dea49e5 -r f42c58bab973 src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp Wed Feb 20 10:22:46 2019 -0500 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp Wed Feb 20 16:29:29 2019 +0100 @@ -316,8 +316,13 @@ } } +template inline bool ShenandoahHeap::requires_marking(const void* entry) const { - return !_marking_context->is_marked(oop(entry)); + oop obj = oop(entry); + if (RESOLVE) { + obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); + } + return !_marking_context->is_marked(obj); } template diff -r 46ef4dea49e5 -r f42c58bab973 src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp Wed Feb 20 10:22:46 2019 -0500 +++ b/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp Wed Feb 20 16:29:29 2019 +0100 @@ -49,12 +49,9 @@ return ShenandoahThreadLocalData::satb_mark_queue(t); } -static inline bool discard_entry(const void* entry, ShenandoahHeap* heap) { - return !heap->requires_marking(entry); -} - +template class ShenandoahSATBMarkQueueFilterFn { - ShenandoahHeap* _heap; + ShenandoahHeap* const _heap; public: ShenandoahSATBMarkQueueFilterFn(ShenandoahHeap* heap) : _heap(heap) {} @@ -62,13 +59,17 @@ // Return true if entry should be filtered out (removed), false if // it should be retained. bool operator()(const void* entry) const { - return discard_entry(entry, _heap); + return !_heap->requires_marking(entry); } }; void ShenandoahSATBMarkQueueSet::filter(SATBMarkQueue* queue) { assert(_heap != NULL, "SATB queue set not initialized"); - apply_filter(ShenandoahSATBMarkQueueFilterFn(_heap), queue); + if (_heap->has_forwarded_objects()) { + apply_filter(ShenandoahSATBMarkQueueFilterFn(_heap), queue); + } else { + apply_filter(ShenandoahSATBMarkQueueFilterFn(_heap), queue); + } } bool ShenandoahSATBMarkQueue::should_enqueue_buffer() {