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 }
|
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 if (thread->is_Java_thread()) {
359 ShenandoahThreadLocalData::set_gc_state(thread, _heap->gc_state());
360 ShenandoahThreadLocalData::initialize_gclab(thread);
361 }
362 SuspendibleThreadSetJoiner sts_join(thread->is_StringDedup_thread());
363 queue.set_active(_satb_mark_queue_set.is_active());
364 }
365
366 void ShenandoahBarrierSet::on_thread_detach(Thread *thread) {
367 SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
368 queue.flush();
369 if (thread->is_Java_thread()) {
370 PLAB* gclab = ShenandoahThreadLocalData::gclab(thread);
371 if (gclab != NULL) {
372 gclab->retire();
373 }
374 }
375 }
|