aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Geoffray <nicolas.geoffray@lip6.fr>2009-07-29 22:55:02 +0000
committerNicolas Geoffray <nicolas.geoffray@lip6.fr>2009-07-29 22:55:02 +0000
commitffcaafb19d672f872cd0d7108e8911404136928c (patch)
treeee17a7e75c39f49938290374cb6bba036e83bf53
parent61c577cd24a013595f5f46825db8397f5148e673 (diff)
downloadexternal_llvm-ffcaafb19d672f872cd0d7108e8911404136928c.zip
external_llvm-ffcaafb19d672f872cd0d7108e8911404136928c.tar.gz
external_llvm-ffcaafb19d672f872cd0d7108e8911404136928c.tar.bz2
In TrimAllocationToSize, if a block is below the minimum allocation size,
there is no new block added to the free list. Therefore on the next startFunctionBody call, a new slab must be allocated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77520 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/ExecutionEngine/JIT/JITMemoryManager.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ExecutionEngine/JIT/JITMemoryManager.cpp b/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
index 2d64fcf..3f38f9c 100644
--- a/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
+++ b/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
@@ -351,9 +351,12 @@ namespace {
iter = iter->Next;
}
+ largest = largest - sizeof(MemoryRangeHeader);
+
// If this block isn't big enough for the allocation desired, allocate
// another block of memory and add it to the free list.
- if (largest - sizeof(MemoryRangeHeader) < ActualSize) {
+ if (largest < ActualSize ||
+ largest <= FreeRangeHeader::getMinBlockSize()) {
DOUT << "JIT: Allocating another slab of memory for function.";
candidateBlock = allocateNewCodeSlab((size_t)ActualSize);
}