8203232: Shenandoah: Resolve oops in SATB filter
Reviewed-by: shade
This commit is contained in:
parent
2cc6f5951c
commit
96e4678510
@ -335,7 +335,7 @@ void ShenandoahBarrierSet::enqueue(oop obj) {
|
||||
// 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()) {
|
||||
|
@ -676,6 +676,7 @@ public:
|
||||
void reset_mark_bitmap();
|
||||
|
||||
// SATB barriers hooks
|
||||
template<bool RESOLVE>
|
||||
inline bool requires_marking(const void* entry) const;
|
||||
void force_satb_flush_all_threads();
|
||||
|
||||
|
@ -316,8 +316,13 @@ inline oop ShenandoahHeap::evacuate_object(oop p, Thread* thread) {
|
||||
}
|
||||
}
|
||||
|
||||
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>
|
||||
|
@ -49,12 +49,9 @@ SATBMarkQueue& ShenandoahSATBMarkQueueSet::satb_queue_for_thread(JavaThread* con
|
||||
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 @@ public:
|
||||
// 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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user