diff --git a/static_core/libllvmbackend/lowering/gc_barriers.cpp b/static_core/libllvmbackend/lowering/gc_barriers.cpp index bab5986e7fe9bb3b08a30ee4562011179e029b6b..b942b4186f03ae3b997e1ae109dbac16e952b500 100644 --- a/static_core/libllvmbackend/lowering/gc_barriers.cpp +++ b/static_core/libllvmbackend/lowering/gc_barriers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -95,6 +95,7 @@ void EmitPostWRB(llvm::IRBuilder<> *builder, llvm::Value *mem, llvm::Value *offs ASSERT(mem->getType()->isPointerTy()); ASSERT(value->getType()->isPointerTy() && value->getType()->getPointerAddressSpace() == LLVMArkInterface::GC_ADDR_SPACE); + ASSERT(offset->getType() == int32Ty); if (!arkInterface->IsIrtocMode()) { // LLVM AOT, only 3 parameters diff --git a/static_core/libllvmbackend/lowering/llvm_ir_constructor.cpp b/static_core/libllvmbackend/lowering/llvm_ir_constructor.cpp index 182b5f3b765e6629ed20fc33d11d738ce4f686ad..c79279c72b5a0454360b5644a63d6652c45bde3b 100644 --- a/static_core/libllvmbackend/lowering/llvm_ir_constructor.cpp +++ b/static_core/libllvmbackend/lowering/llvm_ir_constructor.cpp @@ -2478,6 +2478,9 @@ void LLVMIrConstructor::CreatePostWRB(Inst *inst, llvm::Value *mem, llvm::Value return; } + ASSERT(offset->getType()->isIntegerTy()); + offset = builder_.CreateSExtOrTrunc(offset, builder_.getInt32Ty()); + bool irtoc = arkInterface_->IsIrtocMode(); if (!irtoc && llvmbackend::g_options.IsLlvmBuiltinWrb()) { auto builtin = llvmbackend::builtins::PostWRB(func_->getParent(), mem->getType()->getPointerAddressSpace()); diff --git a/static_core/plugins/ets/irtoc_scripts/map_set_common.irt b/static_core/plugins/ets/irtoc_scripts/map_set_common.irt index c4a46e435cb727df2e441b2c159aa7828d604ec0..7b4cbee56137f35b6946a81a4bce0af55e591d32 100644 --- a/static_core/plugins/ets/irtoc_scripts/map_set_common.irt +++ b/static_core/plugins/ets/irtoc_scripts/map_set_common.irt @@ -491,8 +491,8 @@ scoped_macro(:processMapDelete) do |map, key, idx, mode| entry := Load(buck_data, offset).ref entry_next := LoadI(entry).Imm(MapConstants::ENTRY_NEXT_OFFSET).ref entry_prev := LoadI(entry).Imm(MapConstants::ENTRY_PREV_OFFSET).ref - Store(entry_prev, MapConstants::ENTRY_NEXT_OFFSET, entry_next).ref - Store(entry_next, MapConstants::ENTRY_PREV_OFFSET, entry_prev).ref + Store(entry_prev, MapConstants::ENTRY_NEXT_OFFSET, entry_next).SetNeedBarrier(true).ref + Store(entry_next, MapConstants::ENTRY_PREV_OFFSET, entry_prev).SetNeedBarrier(true).ref new_len := SubI(buck_len).Imm(1).u32 StoreI(buck_hdr, new_len).Imm(EtsConstants::ESCOMPAT_ARRAY_ACTUAL_LENGTH_OFFSET).u32 @@ -500,7 +500,7 @@ scoped_macro(:processMapDelete) do |map, key, idx, mode| last_item_ofs := Mul(new_len, EtsConstants::OBJ_PTR_SIZE).i32 If(offset, last_item_ofs).NE.b { popped_entry := Load(buck_data, last_item_ofs).ref - Store(buck_data, offset, popped_entry).ref + Store(buck_data, offset, popped_entry).SetNeedBarrier(true).ref } size := LoadI(map).Imm(MapConstants::SIZE_OFFSET).u32