8248652: Shenandoah: SATB buffer handling may assume no forwarded objects

Reviewed-by: rkennke
This commit is contained in:
Aleksey Shipilev 2020-07-10 10:37:12 +02:00
parent d3d29a4f82
commit 0a38584c10
5 changed files with 9 additions and 26 deletions

View File

@ -82,7 +82,7 @@ inline 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<false>(obj)) return;
if (!_heap->requires_marking(obj)) return;
ShenandoahThreadLocalData::satb_mark_queue(Thread::current()).enqueue_known_active(obj);
}

View File

@ -203,26 +203,19 @@ public:
}
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);
}
}
};

View File

@ -656,7 +656,6 @@ 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();

View File

@ -326,12 +326,8 @@ inline oop ShenandoahHeap::evacuate_object(oop p, Thread* thread) {
}
}
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);
}

View File

@ -36,7 +36,6 @@ SATBMarkQueue& ShenandoahSATBMarkQueueSet::satb_queue_for_thread(Thread* const t
return ShenandoahThreadLocalData::satb_mark_queue(t);
}
template <bool RESOLVE>
class ShenandoahSATBMarkQueueFilterFn {
ShenandoahHeap* const _heap;
@ -46,17 +45,13 @@ public:
// 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() {