< prev index next >

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

Print this page
rev 54185 : 8220671: Initialization race for non-JavaThread PtrQueues


 335   // be used by SATBMQ::filter to eliminate already marked objects downstream, but
 336   // filtering here helps to avoid wasteful SATB queueing work to begin with.
 337   if (!_heap->requires_marking<false>(obj)) return;
 338 
 339   ShenandoahThreadLocalData::satb_mark_queue(Thread::current()).enqueue(obj);
 340 }
 341 
 342 void ShenandoahBarrierSet::on_thread_create(Thread* thread) {
 343   // Create thread local data
 344   ShenandoahThreadLocalData::create(thread);
 345 }
 346 
 347 void ShenandoahBarrierSet::on_thread_destroy(Thread* thread) {
 348   // Destroy thread local data
 349   ShenandoahThreadLocalData::destroy(thread);
 350 }
 351 
 352 void ShenandoahBarrierSet::on_thread_attach(Thread *thread) {
 353   assert(!thread->is_Java_thread() || !SafepointSynchronize::is_at_safepoint(),
 354          "We should not be at a safepoint");



 355   SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
 356   assert(!queue.is_active(), "SATB queue should not be active");
 357   assert( queue.is_empty(),  "SATB queue should be empty");
 358   queue.set_active(_satb_mark_queue_set.is_active());
 359   if (thread->is_Java_thread()) {
 360     ShenandoahThreadLocalData::set_gc_state(thread, _heap->gc_state());
 361     ShenandoahThreadLocalData::initialize_gclab(thread);
 362   }
 363 }
 364 
 365 void ShenandoahBarrierSet::on_thread_detach(Thread *thread) {



 366   SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
 367   queue.flush();
 368   if (thread->is_Java_thread()) {
 369     PLAB* gclab = ShenandoahThreadLocalData::gclab(thread);
 370     if (gclab != NULL) {
 371       gclab->retire();
 372     }
 373   }
 374 }


 335   // be used by SATBMQ::filter to eliminate already marked objects downstream, but
 336   // filtering here helps to avoid wasteful SATB queueing work to begin with.
 337   if (!_heap->requires_marking<false>(obj)) return;
 338 
 339   ShenandoahThreadLocalData::satb_mark_queue(Thread::current()).enqueue(obj);
 340 }
 341 
 342 void ShenandoahBarrierSet::on_thread_create(Thread* thread) {
 343   // Create thread local data
 344   ShenandoahThreadLocalData::create(thread);
 345 }
 346 
 347 void ShenandoahBarrierSet::on_thread_destroy(Thread* thread) {
 348   // Destroy thread local data
 349   ShenandoahThreadLocalData::destroy(thread);
 350 }
 351 
 352 void ShenandoahBarrierSet::on_thread_attach(Thread *thread) {
 353   assert(!thread->is_Java_thread() || !SafepointSynchronize::is_at_safepoint(),
 354          "We should not be at a safepoint");
 355   SuspendibleThreadSetJoiner sts(!thread->is_Java_thread() && // Already syncs with safepoints
 356                                  !thread->is_VM_thread() &&   // Drives the safepoint itself
 357                                  !thread->is_Worker_thread());// Might block if used at SP, syncs otherwise
 358   SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
 359   assert(!queue.is_active(), "SATB queue should not be active");
 360   assert( queue.is_empty(),  "SATB queue should be empty");
 361   queue.set_active(_satb_mark_queue_set.is_active());
 362   if (thread->is_Java_thread()) {
 363     ShenandoahThreadLocalData::set_gc_state(thread, _heap->gc_state());
 364     ShenandoahThreadLocalData::initialize_gclab(thread);
 365   }
 366 }
 367 
 368 void ShenandoahBarrierSet::on_thread_detach(Thread *thread) {
 369   SuspendibleThreadSetJoiner sts(!thread->is_Java_thread() && // Already syncs with safepoints
 370                                  !thread->is_VM_thread() &&   // Drives the safepoint itself
 371                                  !thread->is_Worker_thread());// Might block if used at SP, syncs otherwise
 372   SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
 373   queue.flush();
 374   if (thread->is_Java_thread()) {
 375     PLAB* gclab = ShenandoahThreadLocalData::gclab(thread);
 376     if (gclab != NULL) {
 377       gclab->retire();
 378     }
 379   }
 380 }
< prev index next >