[compiler-rt] 9d9a773 - [scudo] Temporariy dispatch region from `RegionBeg`
Chia-hung Duan via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 11 15:54:30 PDT 2023
Author: Chia-hung Duan
Date: 2023-04-11T22:42:03Z
New Revision: 9d9a7732e14d7d4c0db7b46d6ebe588e8f43b951
URL: https://github.com/llvm/llvm-project/commit/9d9a7732e14d7d4c0db7b46d6ebe588e8f43b951
DIFF: https://github.com/llvm/llvm-project/commit/9d9a7732e14d7d4c0db7b46d6ebe588e8f43b951.diff
LOG: [scudo] Temporariy dispatch region from `RegionBeg`
In general, a region is located from region base and has size
`RegionSize`. However, some platforms may not support mapping from
region base. Before we have each platform implements their specific
MemMap to handle the offset. Temporarily dispatch the region from
`RegionBeg` instead.
Reviewed By: cferris, fabio-d
Differential Revision: https://reviews.llvm.org/D147792
Added:
Modified:
compiler-rt/lib/scudo/standalone/primary64.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h
index dad6d263a083d..4ea1ba367764f 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -747,8 +747,14 @@ template <typename Config> class SizeClassAllocator64 {
}
// TODO: Consider allocating MemMap in init().
if (!Region->MemMap.isAllocated()) {
- Region->MemMap = ReservedMemory.dispatch(
- getRegionBaseByClassId(ClassId), RegionSize);
+ // TODO: Ideally, a region should reserve RegionSize because the memory
+ // between `RegionBeg` and region base is still belong to a region and
+ // it's just not used. In order to make it work on every platform (some
+ // of them don't support `remap()` across the unused range), dispatch
+ // from `RegionBeg` for now.
+ const uptr ReserveSize =
+ RegionSize - (RegionBeg - getRegionBaseByClassId(ClassId));
+ Region->MemMap = ReservedMemory.dispatch(RegionBeg, ReserveSize);
}
DCHECK(Region->MemMap.isAllocated());
More information about the llvm-commits
mailing list