< prev index next >
src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp
Print this page
rev 53870 : imported patch shade-shenandoah-ptrqueue
rev 53871 : [mq]: shenandoah_merge_attach
*** 335,351 ****
// 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;
! Thread* thr = Thread::current();
! if (thr->is_Java_thread()) {
! ShenandoahThreadLocalData::satb_mark_queue(thr).enqueue(obj);
! } else {
! MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag);
! _satb_mark_queue_set.shared_satb_queue()->enqueue(obj);
! }
}
void ShenandoahBarrierSet::on_thread_create(Thread* thread) {
// Create thread local data
ShenandoahThreadLocalData::create(thread);
--- 335,345 ----
// 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;
! ShenandoahThreadLocalData::satb_mark_queue(Thread::current()).enqueue(obj);
}
void ShenandoahBarrierSet::on_thread_create(Thread* thread) {
// Create thread local data
ShenandoahThreadLocalData::create(thread);
*** 354,376 ****
void ShenandoahBarrierSet::on_thread_destroy(Thread* thread) {
// Destroy thread local data
ShenandoahThreadLocalData::destroy(thread);
}
! void ShenandoahBarrierSet::on_thread_attach(JavaThread* thread) {
! assert(!SafepointSynchronize::is_at_safepoint(), "We should not be at a safepoint");
! assert(!ShenandoahThreadLocalData::satb_mark_queue(thread).is_active(), "SATB queue should not be active");
! assert(ShenandoahThreadLocalData::satb_mark_queue(thread).is_empty(), "SATB queue should be empty");
! if (ShenandoahBarrierSet::satb_mark_queue_set().is_active()) {
! ShenandoahThreadLocalData::satb_mark_queue(thread).set_active(true);
! }
ShenandoahThreadLocalData::set_gc_state(thread, _heap->gc_state());
ShenandoahThreadLocalData::initialize_gclab(thread);
}
! void ShenandoahBarrierSet::on_thread_detach(JavaThread* thread) {
! ShenandoahThreadLocalData::satb_mark_queue(thread).flush();
PLAB* gclab = ShenandoahThreadLocalData::gclab(thread);
if (gclab != NULL) {
gclab->retire();
}
}
--- 348,375 ----
void ShenandoahBarrierSet::on_thread_destroy(Thread* thread) {
// Destroy thread local data
ShenandoahThreadLocalData::destroy(thread);
}
! void ShenandoahBarrierSet::on_thread_attach(Thread *thread) {
! assert(!thread->is_Java_thread() || !SafepointSynchronize::is_at_safepoint(),
! "We should not be at a safepoint");
! SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
! assert(!queue.is_active(), "SATB queue should not be active");
! assert( queue.is_empty(), "SATB queue should be empty");
! queue.set_active(_satb_mark_queue_set.is_active());
! if (thread->is_Java_thread()) {
ShenandoahThreadLocalData::set_gc_state(thread, _heap->gc_state());
ShenandoahThreadLocalData::initialize_gclab(thread);
+ }
}
! void ShenandoahBarrierSet::on_thread_detach(Thread *thread) {
! SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
! queue.flush();
! if (thread->is_Java_thread()) {
PLAB* gclab = ShenandoahThreadLocalData::gclab(thread);
if (gclab != NULL) {
gclab->retire();
}
+ }
}
< prev index next >