< prev index next >

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

Print this page

303 
304 template <DecoratorSet decorators, typename BarrierSetT>
305 inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_xchg_in_heap_at(oop base, ptrdiff_t offset, oop new_value) {
306   assert((decorators & AS_NO_KEEPALIVE) == 0, "must be absent");
307   ShenandoahBarrierSet* bs = ShenandoahBarrierSet::barrier_set();
308   DecoratorSet resolved_decorators = AccessBarrierSupport::resolve_possibly_unknown_oop_ref_strength<decorators>(base, offset);
309   return bs->oop_xchg(resolved_decorators, AccessInternal::oop_field_addr<decorators>(base, offset), new_value);
310 }
311 
312 // Clone barrier support
313 template <DecoratorSet decorators, typename BarrierSetT>
314 void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::clone_in_heap(oop src, oop dst, size_t size) {
315   if (ShenandoahCloneBarrier) {
316     ShenandoahBarrierSet::barrier_set()->clone_barrier_runtime(src);
317   }
318   Raw::clone(src, dst, size);
319 }
320 
321 template <DecoratorSet decorators, typename BarrierSetT>
322 template <typename T>
323 bool ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
324                                                                                          arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
325                                                                                          size_t length) {
326   ShenandoahBarrierSet* bs = ShenandoahBarrierSet::barrier_set();
327   bs->arraycopy_barrier(arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw),
328                         arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw),
329                         length);
330   return Raw::oop_arraycopy_in_heap(src_obj, src_offset_in_bytes, src_raw, dst_obj, dst_offset_in_bytes, dst_raw, length);
331 }
332 
333 template <class T, bool HAS_FWD, bool EVAC, bool ENQUEUE>
334 void ShenandoahBarrierSet::arraycopy_work(T* src, size_t count) {
335   assert(HAS_FWD == _heap->has_forwarded_objects(), "Forwarded object status is sane");
336 
337   Thread* thread = Thread::current();
338   SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
339   ShenandoahMarkingContext* ctx = _heap->marking_context();
340   const ShenandoahCollectionSet* const cset = _heap->collection_set();
341   T* end = src + count;
342   for (T* elem_ptr = src; elem_ptr < end; elem_ptr++) {
343     T o = RawAccess<>::oop_load(elem_ptr);
344     if (!CompressedOops::is_null(o)) {
345       oop obj = CompressedOops::decode_not_null(o);
346       if (HAS_FWD && cset->is_in(obj)) {
347         oop fwd = resolve_forwarded_not_null(obj);
348         if (EVAC && obj == fwd) {
349           fwd = _heap->evacuate_object(obj, thread);
350         }

303 
304 template <DecoratorSet decorators, typename BarrierSetT>
305 inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_xchg_in_heap_at(oop base, ptrdiff_t offset, oop new_value) {
306   assert((decorators & AS_NO_KEEPALIVE) == 0, "must be absent");
307   ShenandoahBarrierSet* bs = ShenandoahBarrierSet::barrier_set();
308   DecoratorSet resolved_decorators = AccessBarrierSupport::resolve_possibly_unknown_oop_ref_strength<decorators>(base, offset);
309   return bs->oop_xchg(resolved_decorators, AccessInternal::oop_field_addr<decorators>(base, offset), new_value);
310 }
311 
312 // Clone barrier support
313 template <DecoratorSet decorators, typename BarrierSetT>
314 void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::clone_in_heap(oop src, oop dst, size_t size) {
315   if (ShenandoahCloneBarrier) {
316     ShenandoahBarrierSet::barrier_set()->clone_barrier_runtime(src);
317   }
318   Raw::clone(src, dst, size);
319 }
320 
321 template <DecoratorSet decorators, typename BarrierSetT>
322 template <typename T>
323 void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
324                                                                                          arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
325                                                                                          size_t length) {
326   ShenandoahBarrierSet* bs = ShenandoahBarrierSet::barrier_set();
327   bs->arraycopy_barrier(arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw),
328                         arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw),
329                         length);
330   Raw::oop_arraycopy_in_heap(src_obj, src_offset_in_bytes, src_raw, dst_obj, dst_offset_in_bytes, dst_raw, length);
331 }
332 
333 template <class T, bool HAS_FWD, bool EVAC, bool ENQUEUE>
334 void ShenandoahBarrierSet::arraycopy_work(T* src, size_t count) {
335   assert(HAS_FWD == _heap->has_forwarded_objects(), "Forwarded object status is sane");
336 
337   Thread* thread = Thread::current();
338   SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
339   ShenandoahMarkingContext* ctx = _heap->marking_context();
340   const ShenandoahCollectionSet* const cset = _heap->collection_set();
341   T* end = src + count;
342   for (T* elem_ptr = src; elem_ptr < end; elem_ptr++) {
343     T o = RawAccess<>::oop_load(elem_ptr);
344     if (!CompressedOops::is_null(o)) {
345       oop obj = CompressedOops::decode_not_null(o);
346       if (HAS_FWD && cset->is_in(obj)) {
347         oop fwd = resolve_forwarded_not_null(obj);
348         if (EVAC && obj == fwd) {
349           fwd = _heap->evacuate_object(obj, thread);
350         }
< prev index next >