325 shenandoah_assert_not_forwarded_if(NULL, obj, ShenandoahHeap::heap()->is_concurrent_traversal_in_progress()); 326 // Nulls should have been already filtered. 327 assert(oopDesc::is_oop(obj, true), "Error"); 328 329 if (!_satb_mark_queue_set.is_active()) return; 330 331 // Filter marked objects before hitting the SATB queues. The same predicate would 332 // be used by SATBMQ::filter to eliminate already marked objects downstream, but 333 // filtering here helps to avoid wasteful SATB queueing work to begin with. 334 if (!_heap->requires_marking(obj)) return; 335 336 Thread* thr = Thread::current(); 337 if (thr->is_Java_thread()) { 338 ShenandoahThreadLocalData::satb_mark_queue(thr).enqueue(obj); 339 } else { 340 MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag); 341 _satb_mark_queue_set.shared_satb_queue()->enqueue(obj); 342 } 343 } 344 345 #ifdef ASSERT 346 void ShenandoahBarrierSet::verify_safe_oop(oop p) { 347 shenandoah_assert_not_in_cset_except(NULL, p, (p == NULL) || ShenandoahHeap::heap()->cancelled_gc()); 348 } 349 #endif 350 351 void ShenandoahBarrierSet::on_thread_create(Thread* thread) { 352 // Create thread local data 353 ShenandoahThreadLocalData::create(thread); 354 } 355 356 void ShenandoahBarrierSet::on_thread_destroy(Thread* thread) { 357 // Destroy thread local data 358 ShenandoahThreadLocalData::destroy(thread); 359 } 360 361 362 void ShenandoahBarrierSet::on_thread_attach(JavaThread* thread) { 363 assert(!SafepointSynchronize::is_at_safepoint(), "We should not be at a safepoint"); 364 assert(!ShenandoahThreadLocalData::satb_mark_queue(thread).is_active(), "SATB queue should not be active"); 365 assert(ShenandoahThreadLocalData::satb_mark_queue(thread).is_empty(), "SATB queue should be empty"); 366 if (ShenandoahBarrierSet::satb_mark_queue_set().is_active()) { 367 ShenandoahThreadLocalData::satb_mark_queue(thread).set_active(true); 368 } 369 ShenandoahThreadLocalData::set_gc_state(thread, ShenandoahHeap::heap()->gc_state()); 370 ShenandoahThreadLocalData::initialize_gclab(thread); | 325 shenandoah_assert_not_forwarded_if(NULL, obj, ShenandoahHeap::heap()->is_concurrent_traversal_in_progress()); 326 // Nulls should have been already filtered. 327 assert(oopDesc::is_oop(obj, true), "Error"); 328 329 if (!_satb_mark_queue_set.is_active()) return; 330 331 // Filter marked objects before hitting the SATB queues. The same predicate would 332 // be used by SATBMQ::filter to eliminate already marked objects downstream, but 333 // filtering here helps to avoid wasteful SATB queueing work to begin with. 334 if (!_heap->requires_marking(obj)) return; 335 336 Thread* thr = Thread::current(); 337 if (thr->is_Java_thread()) { 338 ShenandoahThreadLocalData::satb_mark_queue(thr).enqueue(obj); 339 } else { 340 MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag); 341 _satb_mark_queue_set.shared_satb_queue()->enqueue(obj); 342 } 343 } 344 345 void ShenandoahBarrierSet::on_thread_create(Thread* thread) { 346 // Create thread local data 347 ShenandoahThreadLocalData::create(thread); 348 } 349 350 void ShenandoahBarrierSet::on_thread_destroy(Thread* thread) { 351 // Destroy thread local data 352 ShenandoahThreadLocalData::destroy(thread); 353 } 354 355 356 void ShenandoahBarrierSet::on_thread_attach(JavaThread* thread) { 357 assert(!SafepointSynchronize::is_at_safepoint(), "We should not be at a safepoint"); 358 assert(!ShenandoahThreadLocalData::satb_mark_queue(thread).is_active(), "SATB queue should not be active"); 359 assert(ShenandoahThreadLocalData::satb_mark_queue(thread).is_empty(), "SATB queue should be empty"); 360 if (ShenandoahBarrierSet::satb_mark_queue_set().is_active()) { 361 ShenandoahThreadLocalData::satb_mark_queue(thread).set_active(true); 362 } 363 ShenandoahThreadLocalData::set_gc_state(thread, ShenandoahHeap::heap()->gc_state()); 364 ShenandoahThreadLocalData::initialize_gclab(thread); |