< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp

Print this page




  70   if (HasDecorator<decorators, IS_DEST_UNINITIALIZED>::value ||
  71       HasDecorator<decorators, AS_NO_KEEPALIVE>::value) {
  72     return;
  73   }
  74   if (ShenandoahSATBBarrier && _heap->is_concurrent_mark_in_progress()) {
  75     T heap_oop = RawAccess<>::oop_load(field);
  76     if (!CompressedOops::is_null(heap_oop)) {
  77       enqueue(CompressedOops::decode(heap_oop));
  78     }
  79   }
  80 }
  81 
  82 inline void ShenandoahBarrierSet::satb_enqueue(oop value) {
  83   assert(value != NULL, "checked before");
  84   if (ShenandoahSATBBarrier && _heap->is_concurrent_mark_in_progress()) {
  85     enqueue(value);
  86   }
  87 }
  88 
  89 inline void ShenandoahBarrierSet::storeval_barrier(oop obj) {
  90   if (obj != NULL && ShenandoahStoreValEnqueueBarrier && _heap->is_concurrent_traversal_in_progress()) {

  91     enqueue(obj);
  92   }
  93 }
  94 
  95 inline void ShenandoahBarrierSet::keep_alive_if_weak(DecoratorSet decorators, oop value) {
  96   assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known");
  97   const bool on_strong_oop_ref = (decorators & ON_STRONG_OOP_REF) != 0;
  98   const bool peek              = (decorators & AS_NO_KEEPALIVE) != 0;
  99   if (!peek && !on_strong_oop_ref) {
 100     satb_enqueue(value);
 101   }
 102 }
 103 
 104 template <DecoratorSet decorators>
 105 inline void ShenandoahBarrierSet::keep_alive_if_weak(oop value) {
 106   assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known");
 107   if (!HasDecorator<decorators, ON_STRONG_OOP_REF>::value &&
 108       !HasDecorator<decorators, AS_NO_KEEPALIVE>::value) {
 109     satb_enqueue(value);
 110   }


 270     if (!CompressedOops::is_null(o)) {
 271       oop obj = CompressedOops::decode_not_null(o);
 272       if (HAS_FWD && cset->is_in(obj)) {
 273         oop fwd = resolve_forwarded_not_null(obj);
 274         if (EVAC && obj == fwd) {
 275           fwd = _heap->evacuate_object(obj, thread);
 276         }
 277         assert(obj != fwd || _heap->cancelled_gc(), "must be forwarded");
 278         oop witness = ShenandoahHeap::cas_oop(fwd, elem_ptr, o);
 279         obj = fwd;
 280       }
 281       if (ENQUEUE && !ctx->is_marked(obj)) {
 282         queue.enqueue_known_active(obj);
 283       }
 284     }
 285   }
 286 }
 287 
 288 template <class T>
 289 void ShenandoahBarrierSet::arraycopy_pre_work(T* src, T* dst, size_t count) {
 290   if (_heap->is_concurrent_mark_in_progress() &&
 291       !_heap->marking_context()->allocated_after_mark_start(reinterpret_cast<HeapWord*>(dst))) {
 292     arraycopy_work<T, false, false, true>(dst, count);


 293   }
 294 
 295   if (_heap->has_forwarded_objects()) {
 296     arraycopy_update_impl(src, count);
 297   }
 298 }
 299 
 300 void ShenandoahBarrierSet::arraycopy_pre(oop* src, oop* dst, size_t count) {
 301   arraycopy_pre_work(src, dst, count);
 302 }
 303 
 304 void ShenandoahBarrierSet::arraycopy_pre(narrowOop* src, narrowOop* dst, size_t count) {
 305   arraycopy_pre_work(src, dst, count);
 306 }
 307 
 308 inline bool ShenandoahBarrierSet::skip_bulk_update(HeapWord* dst) {
 309   return dst >= _heap->heap_region_containing(dst)->get_update_watermark();
 310 }
 311 
 312 template <class T>




  70   if (HasDecorator<decorators, IS_DEST_UNINITIALIZED>::value ||
  71       HasDecorator<decorators, AS_NO_KEEPALIVE>::value) {
  72     return;
  73   }
  74   if (ShenandoahSATBBarrier && _heap->is_concurrent_mark_in_progress()) {
  75     T heap_oop = RawAccess<>::oop_load(field);
  76     if (!CompressedOops::is_null(heap_oop)) {
  77       enqueue(CompressedOops::decode(heap_oop));
  78     }
  79   }
  80 }
  81 
  82 inline void ShenandoahBarrierSet::satb_enqueue(oop value) {
  83   assert(value != NULL, "checked before");
  84   if (ShenandoahSATBBarrier && _heap->is_concurrent_mark_in_progress()) {
  85     enqueue(value);
  86   }
  87 }
  88 
  89 inline void ShenandoahBarrierSet::storeval_barrier(oop obj) {
  90   if (obj != NULL && ShenandoahStoreValEnqueueBarrier &&
  91       _heap->is_gc_in_progress_mask(ShenandoahHeap::MARKING | ShenandoahHeap::TRAVERSAL)) {
  92     enqueue(obj);
  93   }
  94 }
  95 
  96 inline void ShenandoahBarrierSet::keep_alive_if_weak(DecoratorSet decorators, oop value) {
  97   assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known");
  98   const bool on_strong_oop_ref = (decorators & ON_STRONG_OOP_REF) != 0;
  99   const bool peek              = (decorators & AS_NO_KEEPALIVE) != 0;
 100   if (!peek && !on_strong_oop_ref) {
 101     satb_enqueue(value);
 102   }
 103 }
 104 
 105 template <DecoratorSet decorators>
 106 inline void ShenandoahBarrierSet::keep_alive_if_weak(oop value) {
 107   assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known");
 108   if (!HasDecorator<decorators, ON_STRONG_OOP_REF>::value &&
 109       !HasDecorator<decorators, AS_NO_KEEPALIVE>::value) {
 110     satb_enqueue(value);
 111   }


 271     if (!CompressedOops::is_null(o)) {
 272       oop obj = CompressedOops::decode_not_null(o);
 273       if (HAS_FWD && cset->is_in(obj)) {
 274         oop fwd = resolve_forwarded_not_null(obj);
 275         if (EVAC && obj == fwd) {
 276           fwd = _heap->evacuate_object(obj, thread);
 277         }
 278         assert(obj != fwd || _heap->cancelled_gc(), "must be forwarded");
 279         oop witness = ShenandoahHeap::cas_oop(fwd, elem_ptr, o);
 280         obj = fwd;
 281       }
 282       if (ENQUEUE && !ctx->is_marked(obj)) {
 283         queue.enqueue_known_active(obj);
 284       }
 285     }
 286   }
 287 }
 288 
 289 template <class T>
 290 void ShenandoahBarrierSet::arraycopy_pre_work(T* src, T* dst, size_t count) {
 291   if (_heap->is_concurrent_mark_in_progress()) {
 292     T* ary = ShenandoahSATBBarrier ? dst : src;
 293     if (ShenandoahStoreValEnqueueBarrier || !_heap->marking_context()->allocated_after_mark_start(reinterpret_cast<HeapWord*>(ary))) {
 294       arraycopy_work<T, false, false, true>(ary, count);
 295     }
 296   }
 297 
 298   if (_heap->has_forwarded_objects()) {
 299     arraycopy_update_impl(src, count);
 300   }
 301 }
 302 
 303 void ShenandoahBarrierSet::arraycopy_pre(oop* src, oop* dst, size_t count) {
 304   arraycopy_pre_work(src, dst, count);
 305 }
 306 
 307 void ShenandoahBarrierSet::arraycopy_pre(narrowOop* src, narrowOop* dst, size_t count) {
 308   arraycopy_pre_work(src, dst, count);
 309 }
 310 
 311 inline bool ShenandoahBarrierSet::skip_bulk_update(HeapWord* dst) {
 312   return dst >= _heap->heap_region_containing(dst)->get_update_watermark();
 313 }
 314 
 315 template <class T>


< prev index next >