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

Chris Lattner lattner at cs.uiuc.edu
Tue Nov 9 12:17:15 PST 2004



Changes in directory poolalloc/runtime/FL2Allocator:

FreeListAllocator.cpp updated: 1.24 -> 1.25
PoolAllocator.h updated: 1.12 -> 1.13

---
Log message:

Allow an extra argument to be passed to poolinit to control the alignment of
objects allocated from the pool (giving alignment control to the pool 
allocator).


---
Diffs of the changes:  (+4 -3)

Index: poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp
diff -u poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.24 poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.25
--- poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.24	Tue Nov  9 00:41:22 2004
+++ poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp	Tue Nov  9 14:17:05 2004
@@ -215,12 +215,13 @@
 
 // poolinit - Initialize a pool descriptor to empty
 //
-void poolinit(PoolTy *Pool, unsigned DeclaredSize) {
+void poolinit(PoolTy *Pool, unsigned DeclaredSize, unsigned ObjAlignment) {
   assert(Pool && "Null pool pointer passed into poolinit!\n");
   memset(Pool, 0, sizeof(PoolTy));
   Pool->AllocSize = INITIAL_SLAB_SIZE;
   Pool->DeclaredSize = DeclaredSize;
-  Pool->Alignment = __alignof(double);
+  if (ObjAlignment < 4) ObjAlignment = __alignof(double);
+  Pool->Alignment = ObjAlignment;
 
   DO_IF_TRACE(fprintf(stderr, "[%d] poolinit(0x%X, %d)\n", addPoolNumber(Pool),
                       Pool, DeclaredSize));


Index: poolalloc/runtime/FL2Allocator/PoolAllocator.h
diff -u poolalloc/runtime/FL2Allocator/PoolAllocator.h:1.12 poolalloc/runtime/FL2Allocator/PoolAllocator.h:1.13
--- poolalloc/runtime/FL2Allocator/PoolAllocator.h:1.12	Tue Nov  9 00:41:22 2004
+++ poolalloc/runtime/FL2Allocator/PoolAllocator.h	Tue Nov  9 14:17:05 2004
@@ -108,7 +108,7 @@
 };
 
 extern "C" {
-  void poolinit(PoolTy *Pool, unsigned DeclaredSize);
+  void poolinit(PoolTy *Pool, unsigned DeclaredSize, unsigned ObjAlignment);
   void poolmakeunfreeable(PoolTy *Pool);
   void pooldestroy(PoolTy *Pool);
   void *poolalloc(PoolTy *Pool, unsigned NumBytes);





More information about the llvm-commits mailing list