diff --git a/common_components/heap/allocator/region_desc.h b/common_components/heap/allocator/region_desc.h index 03dc5d1c015ce9b9d03e69c659bbdb0ed0245940..b99932a61b7157ae91396f1380f9ff8c21d2f920 100755 --- a/common_components/heap/allocator/region_desc.h +++ b/common_components/heap/allocator/region_desc.h @@ -440,13 +440,13 @@ public: FREE_REGION, THREAD_LOCAL_REGION, - THREAD_LOCAL_OLD_REGION, RECENT_FULL_REGION, FROM_REGION, - LONE_FROM_REGION, EXEMPTED_FROM_REGION, + LONE_FROM_REGION, TO_REGION, OLD_REGION, + THREAD_LOCAL_OLD_REGION, // pinned object will not be forwarded by concurrent copying gc. FULL_PINNED_REGION, @@ -779,6 +779,14 @@ public: return type == RegionType::THREAD_LOCAL_REGION || type == RegionType::RECENT_FULL_REGION; } + bool IsInYoungSpaceForWB() const + { + RegionType type = GetRegionType(); + return type == RegionType::THREAD_LOCAL_REGION || + type == RegionType::RECENT_FULL_REGION || + type == RegionType::FROM_REGION; + } + bool IsInYoungSpace() const { RegionType type = GetRegionType(); diff --git a/common_components/heap/collector/region_rset.h b/common_components/heap/collector/region_rset.h index 2d31593573e6b3ae80c4924d3b5c325ed1fca4ba..4ce2fcaab2ad4b7c78e7e1df2c79864944f4e315 100644 --- a/common_components/heap/collector/region_rset.h +++ b/common_components/heap/collector/region_rset.h @@ -63,7 +63,7 @@ public: size_t cardIdx = (offset / kMarkedBytesPerBit) / kBitsPerWord; size_t headMaskBitStart = (offset / kMarkedBytesPerBit) % kBitsPerWord; uint64_t headMaskBits = static_cast(1) << headMaskBitStart; - uint64_t card = cardTable[cardIdx].load(); + uint64_t card = cardTable[cardIdx].load(std::memory_order_relaxed); bool isMarked = ((card & headMaskBits) != 0); if (!isMarked) { card = cardTable[cardIdx].fetch_or(headMaskBits); diff --git a/common_components/heap/w_collector/idle_barrier.cpp b/common_components/heap/w_collector/idle_barrier.cpp index 4f23d406e8c354e1469c2481e297f02325192222..ba0c569a4fa9e98734fc98f94e2854658f202589 100755 --- a/common_components/heap/w_collector/idle_barrier.cpp +++ b/common_components/heap/w_collector/idle_barrier.cpp @@ -93,8 +93,7 @@ void IdleBarrier::UpdateRememberSet(BaseObject* object, BaseObject* ref) const ASSERT(object != nullptr); RegionDesc* objRegion = RegionDesc::GetRegionDescAt(reinterpret_cast((void*)object)); RegionDesc* refRegion = RegionDesc::GetRegionDescAt(reinterpret_cast((void*)ref)); - if ((!objRegion->IsInYoungSpace() && refRegion->IsInYoungSpace()) || - (objRegion->IsInFromSpace() && refRegion->IsInRecentSpace())) { + if (!objRegion->IsInYoungSpaceForWB() && refRegion->IsInYoungSpaceForWB()) { if (objRegion->MarkRSetCardTable(object)) { DLOG(BARRIER, "update point-out remember set of region %p, obj %p, ref: %p<%p>", objRegion, object, ref, ref->GetTypeInfo());