[llvm-commits] CVS: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp PtrCompAllocator.h

Chris Lattner lattner at cs.uiuc.edu
Tue Mar 1 15:43:13 PST 2005



Changes in directory llvm-poolalloc/runtime/PtrCompAllocator:

PtrCompAllocator.cpp updated: 1.5 -> 1.6
PtrCompAllocator.h updated: 1.3 -> 1.4
---
Log message:

Adjust to match changes in the transformation.


---
Diffs of the changes:  (+18 -24)

 PtrCompAllocator.cpp |   30 ++++++++++++++----------------
 PtrCompAllocator.h   |   12 ++++--------
 2 files changed, 18 insertions(+), 24 deletions(-)


Index: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp
diff -u llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.5 llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.6
--- llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.5	Tue Feb 22 14:20:06 2005
+++ llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp	Tue Mar  1 17:43:00 2005
@@ -100,10 +100,10 @@
 static void PrintPoolStats(PoolTy *Pool) {
   fprintf(stderr,
           "(0x%X) BytesAlloc=%d  NumObjs=%d"
-          " bitvectorsize=%d  numused=%d  OrigSize=%d NewSize=%d\n",
+          " bitvectorsize=%d  numused=%d  NodeSize=%d\n",
           Pool, Pool->BytesAllocated, Pool->NumObjects,
-          Pool->NumNodesInBitVector, Pool->NumUsed, Pool->OrigSize,
-          Pool->NewSize);
+          Pool->NumNodesInBitVector, Pool->NumUsed, 
+          Pool->NodeSize);
 }
 
 #else
@@ -141,16 +141,14 @@
 
 // poolinit_pc - Initialize a pool descriptor to empty
 //
-void poolinit_pc(PoolTy *Pool, unsigned NewSize, unsigned OldSize,
-                 unsigned ObjAlignment) {
-  assert(Pool && OldSize && NewSize && ObjAlignment);
+void poolinit_pc(PoolTy *Pool, unsigned NodeSize, unsigned ObjAlignment) {
+  assert(Pool && NodeSize && ObjAlignment);
   assert((ObjAlignment & (ObjAlignment-1)) == 0 && "Alignment not 2^k!");
 
   DO_IF_PNP(memset(Pool, 0, sizeof(PoolTy)));
-  Pool->OrigSize = OldSize;
 
   // Round up to the next alignment boundary.
-  Pool->NewSize = (NewSize+ObjAlignment-1) & ~(ObjAlignment-1);
+  Pool->NodeSize = (NodeSize+ObjAlignment-1) & ~(ObjAlignment-1);
 
   Pool->PoolBase = 0;
   Pool->BitVector = 0;
@@ -202,12 +200,12 @@
 
   DO_IF_PNP(if (Pool->NumObjects == 0) ++PoolCounter);  // Track # pools.
 
-  unsigned OrigSize = Pool->OrigSize;
+  unsigned NodeSize = Pool->NodeSize;
   unsigned NodesToAllocate;
-  if (NumBytes == OrigSize)
+  if (NumBytes == NodeSize)
     NodesToAllocate = 1;     // Common case.
   else
-    NodesToAllocate = (NumBytes+OrigSize-1)/OrigSize;
+    NodesToAllocate = (NumBytes+NodeSize-1)/NodeSize;
 
   DO_IF_TRACE(fprintf(stderr, "[%d] poolalloc_pc(%d [%d node%s]) -> ",
                       getPoolNumber(Pool), NumBytes, NodesToAllocate,
@@ -229,8 +227,8 @@
     unsigned long Result = Pool->NumUsed++;
     MarkNodeAllocated(Pool, Result);
     DO_IF_TRACE(fprintf(stderr, "Node %ld: 0x%lX byte from poolbase\n", Result,
-                        Result*Pool->NewSize));
-    return Result*Pool->NewSize;
+                        Result*Pool->NodeSize));
+    return Result*Pool->NodeSize;
   }
 
   // Otherwise, we need to grow the bitvector.  Double its size.
@@ -242,9 +240,9 @@
 
 void poolfree_pc(PoolTy *Pool, unsigned long Node) {
   if (Node == 0) return;
-  assert(Pool && (Node % Pool->NewSize == 0) && 
-         (Node/Pool->NewSize < Pool->NumUsed) && "Node or pool incorrect!");
-  Node /= Pool->NewSize;
+  assert(Pool && (Node % Pool->NodeSize == 0) && 
+         (Node/Pool->NodeSize < Pool->NumUsed) && "Node or pool incorrect!");
+  Node /= Pool->NodeSize;
   DO_IF_TRACE(fprintf(stderr, "[%d] poolfree_pc(0x%X) ",
                       getPoolNumber(Pool), (unsigned)Node));
 


Index: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.h
diff -u llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.h:1.3 llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.h:1.4
--- llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.h:1.3	Tue Mar  1 16:42:05 2005
+++ llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.h	Tue Mar  1 17:43:00 2005
@@ -23,12 +23,9 @@
   // BitVector - Bitvector of bits.  This stores two bits per node.
   unsigned long *BitVector;
 
-  // OrigSize - The size of the nodes in a non-compressed pool.
-  unsigned OrigSize;
-
-  // NewSize - The size of the nodes to actually allocate out of the pool.  This
-  // size already considers object padding due to alignment.
-  unsigned NewSize;
+  // NodeSize - The size of the nodes to actually allocate out of the pool.
+  // This size already considers object padding due to alignment.
+  unsigned NodeSize;
 
   // NumNodesInBitVector - This indicates the amount of space we have for nodes
   // in the bitvector.  We actually have space for 2* this number of bits.
@@ -44,8 +41,7 @@
 };
 
 extern "C" {
-  void poolinit_pc(PoolTy *Pool, unsigned NewSize, unsigned OldSize,
-                   unsigned ObjAlignment);
+  void poolinit_pc(PoolTy *Pool, unsigned NodeSize, unsigned ObjAlignment);
   void pooldestroy_pc(PoolTy *Pool);
   unsigned long poolalloc_pc(PoolTy *Pool, unsigned NumBytes);
   void poolfree_pc(PoolTy *Pool, unsigned long Node);






More information about the llvm-commits mailing list