[llvm-commits] CVS: poolalloc/runtime/FreeListAllocator/PageManager.cpp PageManager.h PoolAllocator.cpp PoolAllocator.h
John Criswell
criswell at cs.uiuc.edu
Thu Nov 13 18:17:01 PST 2003
Changes in directory poolalloc/runtime/FreeListAllocator:
PageManager.cpp updated: 1.5 -> 1.6
PageManager.h updated: 1.3 -> 1.4
PoolAllocator.cpp updated: 1.16 -> 1.17
PoolAllocator.h updated: 1.6 -> 1.7
---
Log message:
Reduced the size of the PoolTy structure so that it is the same as the
BitMap PoolAllocator. This is necessary because the size is hard-coded,
and the too-large PoolTy structure is what was causing all of the bizarre
behavior.
---
Diffs of the changes: (+16 -8)
Index: poolalloc/runtime/FreeListAllocator/PageManager.cpp
diff -u poolalloc/runtime/FreeListAllocator/PageManager.cpp:1.5 poolalloc/runtime/FreeListAllocator/PageManager.cpp:1.6
--- poolalloc/runtime/FreeListAllocator/PageManager.cpp:1.5 Thu Nov 13 11:33:30 2003
+++ poolalloc/runtime/FreeListAllocator/PageManager.cpp Thu Nov 13 18:16:30 2003
@@ -25,7 +25,7 @@
// Empirically, this slows down the pool allocator a LOT.
#define USE_MEMALIGN 0
-static unsigned PageSize = 0;
+unsigned PageSize = 4096;
// Explicitly use the malloc allocator here, to avoid depending on the C++
// runtime library.
Index: poolalloc/runtime/FreeListAllocator/PageManager.h
diff -u poolalloc/runtime/FreeListAllocator/PageManager.h:1.3 poolalloc/runtime/FreeListAllocator/PageManager.h:1.4
--- poolalloc/runtime/FreeListAllocator/PageManager.h:1.3 Thu Nov 13 11:33:30 2003
+++ poolalloc/runtime/FreeListAllocator/PageManager.h Thu Nov 13 18:16:30 2003
@@ -24,7 +24,7 @@
/// AllocatePage. This is a value that is typically several kilobytes in size,
/// and is guaranteed to be a power of two.
///
-///extern unsigned PageSize;
+extern unsigned PageSize;
/// AllocatePage - This function returns a chunk of memory with size and
/// alignment specified by getPageSize().
Index: poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp
diff -u poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp:1.16 poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp:1.17
--- poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp:1.16 Thu Nov 13 12:03:10 2003
+++ poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp Thu Nov 13 18:16:30 2003
@@ -19,8 +19,9 @@
#include <stdlib.h>
#include <stdio.h>
-#undef assert
-#define assert(X)
+//#undef assert
+//#define assert(X)
+
//===----------------------------------------------------------------------===//
//
@@ -45,7 +46,6 @@
// Save locally the node size
unsigned int NodeSize = Pool->NodeSize;
- unsigned int PageSize = Pool->PageSize;
//
// Determine how many nodes can exist within a regular slab.
@@ -189,12 +189,14 @@
Pool->NodeSize = NodeSize ? NodeSize : 1;
Pool->Slabs = Pool->ArraySlabs = NULL;
Pool->FreeList.Next = NULL;
+#if 0
Pool->FreeablePool = 1;
+#endif /* 0 */
//
// Initialize the page manager.
//
- Pool->PageSize = InitializePageManager ();
+ InitializePageManager ();
return;
}
@@ -203,7 +205,9 @@
poolmakeunfreeable(PoolTy *Pool)
{
assert(Pool && "Null pool pointer passed in to poolmakeunfreeable!\n");
+#if 0
Pool->FreeablePool = 0;
+#endif
}
// pooldestroy - Release all memory allocated for a pool
@@ -319,7 +323,7 @@
//
// Determine which slab owns this block.
//
- struct SlabHeader * slabp = BlockOwner (Pool->PageSize, Pool->FreeList);
+ struct SlabHeader * slabp = BlockOwner (PageSize, Pool->FreeList);
//
// Find the data block that corresponds with this pointer.
@@ -401,7 +405,7 @@
//
// Find the header of the memory block.
//
- struct SlabHeader * slabp = DataOwner (Pool->PageSize, Block);
+ struct SlabHeader * slabp = DataOwner (PageSize, Block);
//
// If the owning slab is an array, add it back to the free array list.
Index: poolalloc/runtime/FreeListAllocator/PoolAllocator.h
diff -u poolalloc/runtime/FreeListAllocator/PoolAllocator.h:1.6 poolalloc/runtime/FreeListAllocator/PoolAllocator.h:1.7
--- poolalloc/runtime/FreeListAllocator/PoolAllocator.h:1.6 Thu Nov 13 11:33:30 2003
+++ poolalloc/runtime/FreeListAllocator/PoolAllocator.h Thu Nov 13 18:16:30 2003
@@ -18,8 +18,10 @@
#include "PoolSlab.h"
typedef struct PoolTy {
+#if 0
// The size of a page on this system
unsigned int PageSize;
+#endif
// NodeSize - Keep track of the object size tracked by this pool
unsigned NodeSize;
@@ -33,10 +35,12 @@
// Pointer to the free list of nodes
struct NodePointer FreeList;
+#if 0
// FreeablePool - Set to false if the memory from this pool cannot be freed
// before destroy.
//
unsigned FreeablePool;
+#endif /* 0 */
} PoolTy;
extern "C" {
More information about the llvm-commits
mailing list