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.

llvm-svn: 77520
This commit is contained in:
Nicolas Geoffray 2009-07-29 22:55:02 +00:00
parent 47d02732e0
commit 956a86445c
1 changed files with 4 additions and 1 deletions

View File

@ -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);
}