--- 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<false>(obj)) return;
Thread* thr = Thread::current();
if (thr->is_Java_thread()) {
--- 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<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 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<bool RESOLVE>
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 <class T>
--- 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 <bool RESOLVE>
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<RESOLVE>(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<true>(_heap), queue);
+ } else {
+ apply_filter(ShenandoahSATBMarkQueueFilterFn<false>(_heap), queue);
+ }
}
bool ShenandoahSATBMarkQueue::should_enqueue_buffer() {