[llvm-commits] CVS: poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Feb 19 23:06:02 PST 2004
Changes in directory poolalloc/runtime/FL2Allocator:
FreeListAllocator.cpp updated: 1.1 -> 1.2
---
Log message:
Implement freeing of large array blocks. This makes the pool allocator work
with 181.mcf and 256.bzip2
---
Diffs of the changes: (+11 -5)
Index: poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp
diff -u poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.1 poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.2
--- poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.1 Thu Dec 25 13:46:20 2003
+++ poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp Thu Feb 19 23:05:14 2004
@@ -182,11 +182,7 @@
// Check to see how many elements were allocated to this node...
FreedNodeHeader *FNH = (FreedNodeHeader*)((char*)Node-sizeof(NodeHeader));
unsigned Size = FNH->NormalHeader.ObjectSize;
- if (Size == ~0U) {
- // Must unlink from list.
- fprintf(stderr, "CANNOT FREE LARGE ARRAY YET!\n");
- return;
- }
+ if (Size == ~0U) goto LargeArrayCase;
// If there are already nodes on the freelist, see if this blocks should be
// coallesced into one of the early blocks on the front of the list. This is
@@ -215,4 +211,14 @@
FNH->Size = Size;
FNH->NormalHeader.Next = Pool->FreeNodeList;
Pool->FreeNodeList = FNH;
+ return;
+
+LargeArrayCase:
+ LargeArrayHeader *LAH = ((LargeArrayHeader*)Node)-1;
+
+ // Unlink it from the list of large arrays...
+ *LAH->Prev = LAH->Next;
+ if (LAH->Next)
+ LAH->Next->Prev = LAH->Prev;
+ free(LAH);
}
More information about the llvm-commits
mailing list