[llvm-commits] CVS: llvm-poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Mar 1 21:47:14 PST 2005
Changes in directory llvm-poolalloc/runtime/FL2Allocator:
FreeListAllocator.cpp updated: 1.32 -> 1.33
---
Log message:
Add some debug output, do not write the end of memory marker off the end of
the allocated space!
---
Diffs of the changes: (+9 -1)
FreeListAllocator.cpp | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletion(-)
Index: llvm-poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp
diff -u llvm-poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.32 llvm-poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.33
--- llvm-poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.32 Tue Mar 1 22:56:18 2005
+++ llvm-poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp Tue Mar 1 23:46:59 2005
@@ -251,6 +251,7 @@
Pool->DeclaredSize = SizeHint;
}
+ Size -= sizeof(PoolSlab) + sizeof(NodeHeader) + sizeof(FreedNodeHeader);
PoolSlab *PS = (PoolSlab*)SMem;
char *PoolBody = (char*)(PS+1);
@@ -260,7 +261,7 @@
unsigned Alignment = Pool->Alignment;
if (Alignment > sizeof(FreedNodeHeader)) {
PoolBody += Alignment-sizeof(FreedNodeHeader);
- Size -= Alignment-sizeof(FreedNodeHeader)-sizeof(PoolSlab);
+ Size -= Alignment-sizeof(FreedNodeHeader);
}
// Add the body of the slab to the free list.
@@ -273,6 +274,7 @@
FreedNodeHeader *End =
(FreedNodeHeader*)(PoolBody + sizeof(NodeHeader) + Size);
End->Header.Size = ~0; // Looks like an allocated chunk
+ PS->Next = 0;
}
@@ -709,9 +711,13 @@
}
void pooldestroy_pc(PoolTy *Pool) {
+ assert(Pool && "Null pool pointer passed in to pooldestroy!\n");
if (Pool->Slabs == 0)
return; // no memory allocated from this pool.
+ DO_IF_TRACE(fprintf(stderr, "[%d] pooldestroy", removePoolNumber(Pool)));
+ DO_IF_POOLDESTROY_STATS(PrintPoolStats(Pool));
+
// If there is space to remember this pool, do so.
for (unsigned i = 0; i != 4; ++i)
if (Pools[i] == 0) {
@@ -720,6 +726,8 @@
}
// Otherwise, just munmap it.
+ DO_IF_TRACE(fprintf(stderr, "UNMAPPING ADDR SPACE: %p -> %p\n",
+ Pool->Slabs, (char*)Pool->Slabs+POOLSIZE));
munmap(Pool->Slabs, POOLSIZE);
}
More information about the llvm-commits
mailing list