aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt
diff options
context:
space:
mode:
authorFabio D'Urso <fdurso@google.com>2023-06-30 16:35:09 +0200
committerFabio D'Urso <fdurso@google.com>2023-06-30 17:13:41 +0200
commit0e93c4a5fd5825a16fd3c00f9f7942ec88412771 (patch)
tree37b917a6ba7f37d150a325d702b11f985fe66ff0 /compiler-rt
parent6f9e743b91ad6ac1f333ce6e3efae44e137b54bb (diff)
downloadllvm-0e93c4a5fd5825a16fd3c00f9f7942ec88412771.zip
llvm-0e93c4a5fd5825a16fd3c00f9f7942ec88412771.tar.gz
llvm-0e93c4a5fd5825a16fd3c00f9f7942ec88412771.tar.bz2
[scudo] SizeClassAllocator64: dispatch all the classes in init()
This will make it easier to verify in a future patch that the ReservedMemory object has been fully dispatched. Reviewed By: Chia-hungDuan Differential Revision: https://reviews.llvm.org/D153019
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/scudo/standalone/primary64.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h
index ab75f19..e6cd120 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -132,6 +132,10 @@ public:
else
Region->TryReleaseThreshold = PageSize;
Region->ReleaseInfo.LastReleaseAtNs = Time;
+
+ Region->MemMapInfo.MemMap = ReservedMemory.dispatch(
+ PrimaryBase + (I << Config::Primary::RegionSizeLog), RegionSize);
+ CHECK(Region->MemMapInfo.MemMap.isAllocated());
}
shuffle(RegionInfoArray, NumClasses, &Seed);
@@ -822,12 +826,6 @@ private:
Region->Exhausted = true;
return nullptr;
}
- // TODO: Consider allocating MemMap in init().
- if (!Region->MemMapInfo.MemMap.isAllocated()) {
- Region->MemMapInfo.MemMap = ReservedMemory.dispatch(
- getRegionBaseByClassId(ClassId), RegionSize);
- }
- DCHECK(Region->MemMapInfo.MemMap.isAllocated());
if (UNLIKELY(!Region->MemMapInfo.MemMap.remap(
RegionBeg + MappedUser, MapSize, "scudo:primary",