From c252779422fc07705eecc1c2f5f089225c487e09 Mon Sep 17 00:00:00 2001 From: yanzhiqi1 Date: Fri, 5 Sep 2025 15:38:57 +0800 Subject: [PATCH] IsAlive adapts to CMCGC Issue: #ICWL7G Signed-off-by: yanzhiqi1 Change-Id: I311edd912f1d979acb0783bde60cb26e8a7f714a --- ecmascript/mem/heap.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ecmascript/mem/heap.cpp b/ecmascript/mem/heap.cpp index 6ba62cfdd6..4aa241ae18 100644 --- a/ecmascript/mem/heap.cpp +++ b/ecmascript/mem/heap.cpp @@ -2756,9 +2756,16 @@ size_t Heap::GetHeapLimitSize() const bool BaseHeap::IsAlive(TaggedObject *object) const { - if (!ContainObject(object)) { - LOG_GC(ERROR) << "The region is already free"; - return false; + if (g_isEnableCMCGC) { + if (!common::Heap::IsHeapAddress(object)) { + LOG_GC(ERROR) << "The region is already free"; + return false; + } + } else { + if (!ContainObject(object)) { + LOG_GC(ERROR) << "The region is already free"; + return false; + } } bool isFree = object->GetClass() != nullptr && FreeObject::Cast(ToUintPtr(object))->IsFreeObject(); -- Gitee