[llvm-commits] CVS: poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Feb 29 13:45:01 PST 2004


Changes in directory poolalloc/runtime/FL2Allocator:

FreeListAllocator.cpp updated: 1.4 -> 1.5

---
Log message:

Prepare to support 'partial pool allocation'.  If a node is allocated from
a non-pool-allocated region, pass it off to the system allocator.


---
Diffs of the changes:  (+6 -2)

Index: poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp
diff -u poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.4 poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.5
--- poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.4	Tue Feb 24 15:02:56 2004
+++ poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp	Sun Feb 29 13:44:47 2004
@@ -104,7 +104,9 @@
 
 
 void *poolalloc(PoolTy *Pool, unsigned NumBytes) {
-  assert(Pool && "Null pool pointer passed in to poolalloc!\n");
+  // If a null pool descriptor is passed in, this is not a pool allocated data
+  // structure.  Hand off to the system malloc.
+  if (Pool == 0) return malloc(NumBytes);
   if (NumBytes == 0) return 0;
   NumBytes = (NumBytes+3) & ~3;  // Round up to 4 bytes...
 
@@ -186,7 +188,9 @@
 
 
 void poolfree(PoolTy *Pool, void *Node) {
-  assert(Pool && "Null pool pointer passed in to poolfree!\n");
+  // If a null pool descriptor is passed in, this is not a pool allocated data
+  // structure.  Hand off to the system free.
+  if (Pool == 0) { free(Node); return; }
   if (Node == 0) return;
 
   //printf("free 0x%X <- 0x%X\n", Pool, Node);





More information about the llvm-commits mailing list