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