From f07d58f7b57859938fb0a870f625e639e3edb385 Mon Sep 17 00:00:00 2001 From: Yong Zhou Date: Mon, 7 Jul 2025 18:20:02 +0800 Subject: [PATCH 1/2] Update Verify Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/ICKKX2 Change-Id: I5764d102588e07fc200253c7eef7a58baef2c82c Signed-off-by: Yong Zhou --- common_components/heap/verification.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/common_components/heap/verification.cpp b/common_components/heap/verification.cpp index 440ec9715e..6fbf6a0097 100755 --- a/common_components/heap/verification.cpp +++ b/common_components/heap/verification.cpp @@ -364,15 +364,6 @@ public: } else { refObj = field.GetTargetObject(); } - // If it is forwarded, its toVersion must have been traversed during - // EnumRoot, so it must have been marked. There is no need for me to - // check it, nor to push it into the mark stack. - if (refObj->IsForwarded()) { - auto toObj = refObj->GetForwardingPointer(); - bool find = markSet.find(toObj) != markSet.end(); - CHECKF(find) << "not found to version obj in markSet"; - return; - } visitor.VerifyRef(obj, field); -- Gitee From 158473401a131da6a55b4918e8a3e2dbb0aa1b6a Mon Sep 17 00:00:00 2001 From: Yong Zhou Date: Tue, 8 Jul 2025 11:42:56 +0800 Subject: [PATCH 2/2] test Change-Id: Iae851aeae6da3c774fd95d7d304e0839988050f9 --- .../heap/allocator/region_manager.cpp | 20 +++++++++---------- .../heap/allocator/region_manager.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/common_components/heap/allocator/region_manager.cpp b/common_components/heap/allocator/region_manager.cpp index feee6f3bf1..f0cd52bb54 100755 --- a/common_components/heap/allocator/region_manager.cpp +++ b/common_components/heap/allocator/region_manager.cpp @@ -622,7 +622,8 @@ static void FixRecentRegion(TraceCollector& collector, RegionDesc* region) // use fixline to skip new region after fix // visit object before fix line to avoid race condition with mutator bool isLargeOrFixRegion = region->IsLargeRegion() || region->IsFixedRegion(); - region->VisitAllObjectsBeforeFix([&collector, region, isLargeOrFixRegion](BaseObject* object) { + bool isPinnedRegion = region->IsPinnedRegion(); + region->VisitAllObjectsBeforeFix([&collector, region, isLargeOrFixRegion, isPinnedRegion](BaseObject* object) { if (region->IsNewObjectSinceForward(object)) { // handle dead objects in tl-regions for concurrent gc. if (collector.IsToVersion(object)) { @@ -638,6 +639,9 @@ static void FixRecentRegion(TraceCollector& collector, RegionDesc* region) // large/fix region is no need to fillfreeobject. return; } + if( isPinnedRegion) { + return; + } FillFreeObject(object, RegionSpace::GetAllocSize(*object)); DLOG(FIX, "skip dead obj %p<%p>(%zu)", object, object->GetTypeInfo(), object->GetSize()); } @@ -699,7 +703,8 @@ void RegionManager::FixFixedRegionList(TraceCollector& collector, RegionList& li static void FixRegion(TraceCollector& collector, RegionDesc* region) { bool isLargeRegion = region->IsLargeRegion(); - region->VisitAllObjects([&collector, isLargeRegion](BaseObject* object) { + bool isPinedRegion = region->IsPinnedRegion(); + region->VisitAllObjects([&collector, isLargeRegion, isPinedRegion](BaseObject* object) { if (collector.IsSurvivedObject(object)) { collector.FixObjectRefFields(object); } else { @@ -707,6 +712,9 @@ static void FixRegion(TraceCollector& collector, RegionDesc* region) // large region is no need to fillfreeobject. return; } + if (isPinedRegion) { + return; + } FillFreeObject(object, RegionSpace::GetAllocSize(*object)); DLOG(FIX, "fix: skip dead obj %p<%p>(%zu)", object, object->GetTypeInfo(), object->GetSize()); } @@ -760,14 +768,6 @@ void RegionManager::FixPinnedRegionList(TraceCollector& collector, RegionList& l size_t garbageSize = 0; RegionDesc* region = list.GetHeadRegion(); while (region != nullptr) { - if (region->GetLiveByteCount() == 0) { - RegionDesc* del = region; - region = region->GetNextRegion(); - list.DeleteRegion(del); - - garbageSize += CollectRegion(del); - continue; - } DLOG(REGION, "fix region %p@%#zx+%zu", region, region->GetRegionStart(), region->GetLiveByteCount()); FixRegion(collector, region); region = region->GetNextRegion(); diff --git a/common_components/heap/allocator/region_manager.h b/common_components/heap/allocator/region_manager.h index 422f941dc8..41cfaf29b7 100755 --- a/common_components/heap/allocator/region_manager.h +++ b/common_components/heap/allocator/region_manager.h @@ -152,7 +152,7 @@ public: uintptr_t AllocPinned(size_t size, bool allowGC = true) { uintptr_t addr = 0; - if (!allowGC || size > FIXED_PINNED_THRESHOLD) { + if (true) { DLOG(ALLOC, "alloc pinned obj 0x%zx(%zu)", addr, size); return AllocNextFitPinned(size); } -- Gitee