[llvm-commits] [llvm] r77520 - /llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
Reid Kleckner
rnk at mit.edu
Wed Jul 29 16:12:40 PDT 2009
Ah, that's tricky. Looks good to me.
Reid
On Wed, Jul 29, 2009 at 4:00 PM, Nicolas
Geoffray<nicolas.geoffray at lip6.fr> wrote:
> Reid,
>
> Could you review my patch? It solves a segfault due to a too small block in
> the free list.
>
> Thanks,
> Nicolas
>
> Nicolas Geoffray wrote:
>>
>> 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);
>> }
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
More information about the llvm-commits
mailing list