[llvm] 818772a - [Orc] Fix remaining memory size of slab allocator
Stefan Gränitz via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 2 06:08:26 PST 2021
Author: Stefan Gränitz
Date: 2021-03-02T15:07:37+01:00
New Revision: 818772a594031a2c41cd69d946fa353c2670636d
URL: https://github.com/llvm/llvm-project/commit/818772a594031a2c41cd69d946fa353c2670636d
DIFF: https://github.com/llvm/llvm-project/commit/818772a594031a2c41cd69d946fa353c2670636d.diff
LOG: [Orc] Fix remaining memory size of slab allocator
Added:
Modified:
llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp b/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp
index fbbb29e9164a..7a5d36a841af 100644
--- a/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp
@@ -116,7 +116,7 @@ InProcessMemoryManager::allocate(const JITLinkDylib *JD,
sys::MemoryBlock SegMem(SlabRemaining.base(), SegmentSize);
SlabRemaining = sys::MemoryBlock((char *)SlabRemaining.base() + SegmentSize,
- SegmentSize);
+ SlabRemaining.allocatedSize() - SegmentSize);
// Zero out the zero-fill memory.
memset(static_cast<char *>(SegMem.base()) + Seg.getContentSize(), 0,
@@ -125,6 +125,8 @@ InProcessMemoryManager::allocate(const JITLinkDylib *JD,
// Record the block for this segment.
Blocks[KV.first] = std::move(SegMem);
}
+
+ assert(SlabRemaining.allocatedSize() >= 0 && "Mapping exceeds allocation");
return std::unique_ptr<InProcessMemoryManager::Allocation>(
new IPMMAlloc(std::move(Blocks)));
}
More information about the llvm-commits
mailing list