@@ -403,14 +403,13 @@ inline bool ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_arraycopy_i
403
403
return oop_arraycopy_in_heap_no_check_cast (dst, src, length);
404
404
}
405
405
406
- class ZStoreBarrierOopClosure : public BasicOopIterateClosure {
406
+ class ZColorStoreGoodOopClosure : public BasicOopIterateClosure {
407
407
public:
408
408
virtual void do_oop (oop* p_) {
409
409
volatile zpointer* const p = (volatile zpointer*)p_;
410
410
const zpointer ptr = ZBarrier::load_atomic (p);
411
411
const zaddress addr = ZPointer::uncolor (ptr);
412
- ZBarrier::store_barrier_on_heap_oop_field (p, false /* heal */ );
413
- *p = ZAddress::store_good (addr);
412
+ Atomic::store (p, ZAddress::store_good (addr));
414
413
}
415
414
416
415
virtual void do_oop (narrowOop* p) {
@@ -433,17 +432,28 @@ template <DecoratorSet decorators, typename BarrierSetT>
433
432
inline void ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::clone_in_heap(oop src, oop dst, size_t size) {
434
433
assert_is_valid (to_zaddress (src));
435
434
435
+ if (dst->is_objArray ()) {
436
+ // Cloning an object array is similar to performing array copy.
437
+ // If an array is large enough to have its allocation segmented,
438
+ // this operation might require GC barriers. However, the intrinsics
439
+ // for cloning arrays transform the clone to an optimized allocation
440
+ // and arraycopy sequence, so the performance of this runtime call
441
+ // does not matter for object arrays.
442
+ clone_obj_array (objArrayOop (src), objArrayOop (dst), size);
443
+ return ;
444
+ }
445
+
436
446
// Fix the oops
437
447
ZLoadBarrierOopClosure cl;
438
448
ZIterator::oop_iterate (src, &cl);
439
449
440
450
// Clone the object
441
451
Raw::clone_in_heap (src, dst, size);
442
452
443
- assert (ZHeap::heap ()->is_young (to_zaddress (dst)), " ZColorStoreGoodOopClosure is only valid for young objects" );
453
+ assert (dst-> is_typeArray () || ZHeap::heap ()->is_young (to_zaddress (dst)), " ZColorStoreGoodOopClosure is only valid for young objects" );
444
454
445
455
// Color store good before handing out
446
- ZStoreBarrierOopClosure cl_sg;
456
+ ZColorStoreGoodOopClosure cl_sg;
447
457
ZIterator::oop_iterate (dst, &cl_sg);
448
458
}
449
459
0 commit comments