< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp

Print this page
rev 54932 : 8221086: Shenandoah-specific workaround for JDK-8220671


 315   // be used by SATBMQ::filter to eliminate already marked objects downstream, but
 316   // filtering here helps to avoid wasteful SATB queueing work to begin with.
 317   if (!_heap->requires_marking<false>(obj)) return;
 318 
 319   ShenandoahThreadLocalData::satb_mark_queue(Thread::current()).enqueue(obj);
 320 }
 321 
 322 void ShenandoahBarrierSet::on_thread_create(Thread* thread) {
 323   // Create thread local data
 324   ShenandoahThreadLocalData::create(thread);
 325 }
 326 
 327 void ShenandoahBarrierSet::on_thread_destroy(Thread* thread) {
 328   // Destroy thread local data
 329   ShenandoahThreadLocalData::destroy(thread);
 330 }
 331 
 332 void ShenandoahBarrierSet::on_thread_attach(Thread *thread) {
 333   assert(!thread->is_Java_thread() || !SafepointSynchronize::is_at_safepoint(),
 334          "We should not be at a safepoint");



 335   SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
 336   assert(!queue.is_active(), "SATB queue should not be active");
 337   assert( queue.is_empty(),  "SATB queue should be empty");
 338   queue.set_active(_satb_mark_queue_set.is_active());
 339   if (thread->is_Java_thread()) {
 340     ShenandoahThreadLocalData::set_gc_state(thread, _heap->gc_state());
 341     ShenandoahThreadLocalData::initialize_gclab(thread);
 342   }
 343 }
 344 
 345 void ShenandoahBarrierSet::on_thread_detach(Thread *thread) {



 346   SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
 347   queue.flush();
 348   if (thread->is_Java_thread()) {
 349     PLAB* gclab = ShenandoahThreadLocalData::gclab(thread);
 350     if (gclab != NULL) {
 351       gclab->retire();
 352     }
 353   }
 354 }


 315   // be used by SATBMQ::filter to eliminate already marked objects downstream, but
 316   // filtering here helps to avoid wasteful SATB queueing work to begin with.
 317   if (!_heap->requires_marking<false>(obj)) return;
 318 
 319   ShenandoahThreadLocalData::satb_mark_queue(Thread::current()).enqueue(obj);
 320 }
 321 
 322 void ShenandoahBarrierSet::on_thread_create(Thread* thread) {
 323   // Create thread local data
 324   ShenandoahThreadLocalData::create(thread);
 325 }
 326 
 327 void ShenandoahBarrierSet::on_thread_destroy(Thread* thread) {
 328   // Destroy thread local data
 329   ShenandoahThreadLocalData::destroy(thread);
 330 }
 331 
 332 void ShenandoahBarrierSet::on_thread_attach(Thread *thread) {
 333   assert(!thread->is_Java_thread() || !SafepointSynchronize::is_at_safepoint(),
 334          "We should not be at a safepoint");
 335   SuspendibleThreadSetJoiner sts(!thread->is_Java_thread() && // Already syncs with safepoints
 336                                  !thread->is_VM_thread() &&   // Drives the safepoint itself
 337                                  !thread->is_Worker_thread());// Might block if used at SP, syncs otherwise
 338   SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
 339   assert(!queue.is_active(), "SATB queue should not be active");
 340   assert( queue.is_empty(),  "SATB queue should be empty");
 341   queue.set_active(_satb_mark_queue_set.is_active());
 342   if (thread->is_Java_thread()) {
 343     ShenandoahThreadLocalData::set_gc_state(thread, _heap->gc_state());
 344     ShenandoahThreadLocalData::initialize_gclab(thread);
 345   }
 346 }
 347 
 348 void ShenandoahBarrierSet::on_thread_detach(Thread *thread) {
 349   SuspendibleThreadSetJoiner sts(!thread->is_Java_thread() && // Already syncs with safepoints
 350                                  !thread->is_VM_thread() &&   // Drives the safepoint itself
 351                                  !thread->is_Worker_thread());// Might block if used at SP, syncs otherwise
 352   SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
 353   queue.flush();
 354   if (thread->is_Java_thread()) {
 355     PLAB* gclab = ShenandoahThreadLocalData::gclab(thread);
 356     if (gclab != NULL) {
 357       gclab->retire();
 358     }
 359   }
 360 }
< prev index next >