From 4e6435574579110b2b1e53f2e4094c41d96d3123 Mon Sep 17 00:00:00 2001 From: xwcai98 Date: Tue, 5 Aug 2025 20:13:56 +0800 Subject: [PATCH] Fix Array Copy Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/ICRCOE Signed-off-by: xwcai98 Change-Id: I83fe2b920d9b32042c17468747636a325f18913e --- ecmascript/compiler/stub_builder.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ecmascript/compiler/stub_builder.cpp b/ecmascript/compiler/stub_builder.cpp index fc3618c299..3c613b26f4 100644 --- a/ecmascript/compiler/stub_builder.cpp +++ b/ecmascript/compiler/stub_builder.cpp @@ -13253,12 +13253,17 @@ void StubBuilder::ArrayCopy(GateRef glue, GateRef srcObj, GateRef srcAddr, GateR { CallNGCRuntime(glue, RTSTUB_ID(CopyObjectPrimitive), {glue, TaggedCastToIntPtr(dstObj), TaggedCastToIntPtr(dstAddr), TaggedCastToIntPtr(srcAddr), taggedValueCount}); - if (copyKind == SameArray) { - CMCArrayCopyWriteBarrierSameArray(glue, dstObj, srcAddr, dstAddr, taggedValueCount); - } else { - CMCArrayCopyWriteBarrier(glue, dstObj, srcAddr, dstAddr, taggedValueCount); + Label handleBarrier(env); + BRANCH_NO_WEIGHT(needBarrier, &handleBarrier, &exit); + Bind(&handleBarrier); + { + if (copyKind == SameArray) { + CMCArrayCopyWriteBarrierSameArray(glue, dstObj, srcAddr, dstAddr, taggedValueCount); + } else { + CMCArrayCopyWriteBarrier(glue, dstObj, srcAddr, dstAddr, taggedValueCount); + } + Jump(&exit); } - Jump(&exit); } Bind(¬CMCGC); { -- Gitee