[llvm-commits] [llvm] r77520 - /llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Wed Jul 29 15:55:02 PDT 2009


Author: geoffray
Date: Wed Jul 29 17:55:02 2009
New Revision: 77520

URL: http://llvm.org/viewvc/llvm-project?rev=77520&view=rev
Log:
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.


Modified:
    llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp?rev=77520&r1=77519&r2=77520&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp Wed Jul 29 17:55:02 2009
@@ -351,9 +351,12 @@
         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);
       }





More information about the llvm-commits mailing list