[llvm] Implement reserveAllocationSpace for SectionMemoryManager (PR #71968)
Michael Smith via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 17 09:05:20 PST 2023
================
@@ -18,6 +18,89 @@
namespace llvm {
+bool SectionMemoryManager::hasSpace(const MemoryGroup &MemGroup,
+ uintptr_t Size) const {
+ for (const FreeMemBlock &FreeMB : MemGroup.FreeMem) {
+ if (FreeMB.Free.allocatedSize() >= Size)
+ return true;
+ }
+ return false;
+}
+
+void SectionMemoryManager::reserveAllocationSpace(
+ uintptr_t CodeSize, Align CodeAlign, uintptr_t RODataSize,
+ Align RODataAlign, uintptr_t RWDataSize, Align RWDataAlign) {
+ if (CodeSize == 0 && RODataSize == 0 && RWDataSize == 0)
----------------
MikaelSmith wrote:
Erroneous requests would negate any benefits from using reserveAllocationSpace. And yes, if I removed this early return it would still return early when checking for sufficient existing free space to satisfy the whole request.
https://github.com/llvm/llvm-project/pull/71968
More information about the llvm-commits
mailing list