Fix ETS Array copy

Description:
Fix incorrect copy range and GC barrier call

Issue: #IAXXR2

Signed-off-by: Panferov Ivan <panferov.ivan@huawei-partners.com>
This commit is contained in:
Panferov Ivan 2024-10-17 21:49:22 +08:00
parent 5a999f1600
commit a42e25dfb1

View File

@ -178,7 +178,7 @@ public:
// PreBarrier isn't needed as links inside the source object arn't changed.
auto *barrierSet = ManagedThread::GetCurrent()->GetBarrierSet();
if (!mem::IsEmptyBarrier(barrierSet->GetPostType())) {
barrierSet->PostBarrier(dst, 0, dst->ObjectSize());
barrierSet->PostBarrier(dst, GetDataOffset(), count);
}
}
}
@ -211,7 +211,7 @@ private:
reinterpret_cast<AtomicWord *>(&dst[i])->store(reinterpret_cast<AtomicWord *>(&src[i])->load(ORDER), ORDER);
}
// 2. copy by references if any
stop = ((src.Size() - i) / OBJECT_POINTER_SIZE) * OBJECT_POINTER_SIZE;
stop = src.Size();
for (; i < stop; i += OBJECT_POINTER_SIZE) {
// Atomic with parameterized order reason: memory order defined as constexpr
reinterpret_cast<AtomicRef *>(&dst[i])->store(reinterpret_cast<AtomicRef *>(&src[i])->load(ORDER), ORDER);