318 }
319 if (ShenandoahStoreValReadBarrier) {
320 obj = resolve_forwarded(obj);
321 }
322 return obj;
323 }
324
325 void ShenandoahBarrierSet::keep_alive_barrier(oop obj) {
326 if (ShenandoahKeepAliveBarrier && _heap->is_concurrent_mark_in_progress()) {
327 enqueue(obj);
328 }
329 }
330
331 void ShenandoahBarrierSet::enqueue(oop obj) {
332 shenandoah_assert_not_forwarded_if(NULL, obj, _heap->is_concurrent_traversal_in_progress());
333 if (!_satb_mark_queue_set.is_active()) return;
334
335 // Filter marked objects before hitting the SATB queues. The same predicate would
336 // be used by SATBMQ::filter to eliminate already marked objects downstream, but
337 // filtering here helps to avoid wasteful SATB queueing work to begin with.
338 if (!_heap->requires_marking(obj)) return;
339
340 Thread* thr = Thread::current();
341 if (thr->is_Java_thread()) {
342 ShenandoahThreadLocalData::satb_mark_queue(thr).enqueue(obj);
343 } else {
344 MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag);
345 _satb_mark_queue_set.shared_satb_queue()->enqueue(obj);
346 }
347 }
348
349 void ShenandoahBarrierSet::on_thread_create(Thread* thread) {
350 // Create thread local data
351 ShenandoahThreadLocalData::create(thread);
352 }
353
354 void ShenandoahBarrierSet::on_thread_destroy(Thread* thread) {
355 // Destroy thread local data
356 ShenandoahThreadLocalData::destroy(thread);
357 }
358
|
318 }
319 if (ShenandoahStoreValReadBarrier) {
320 obj = resolve_forwarded(obj);
321 }
322 return obj;
323 }
324
325 void ShenandoahBarrierSet::keep_alive_barrier(oop obj) {
326 if (ShenandoahKeepAliveBarrier && _heap->is_concurrent_mark_in_progress()) {
327 enqueue(obj);
328 }
329 }
330
331 void ShenandoahBarrierSet::enqueue(oop obj) {
332 shenandoah_assert_not_forwarded_if(NULL, obj, _heap->is_concurrent_traversal_in_progress());
333 if (!_satb_mark_queue_set.is_active()) return;
334
335 // Filter marked objects before hitting the SATB queues. The same predicate would
336 // be used by SATBMQ::filter to eliminate already marked objects downstream, but
337 // filtering here helps to avoid wasteful SATB queueing work to begin with.
338 if (!_heap->requires_marking<false>(obj)) return;
339
340 Thread* thr = Thread::current();
341 if (thr->is_Java_thread()) {
342 ShenandoahThreadLocalData::satb_mark_queue(thr).enqueue(obj);
343 } else {
344 MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag);
345 _satb_mark_queue_set.shared_satb_queue()->enqueue(obj);
346 }
347 }
348
349 void ShenandoahBarrierSet::on_thread_create(Thread* thread) {
350 // Create thread local data
351 ShenandoahThreadLocalData::create(thread);
352 }
353
354 void ShenandoahBarrierSet::on_thread_destroy(Thread* thread) {
355 // Destroy thread local data
356 ShenandoahThreadLocalData::destroy(thread);
357 }
358
|