[llvm-commits] CVS: poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp PoolAllocator.h
Chris Lattner
lattner at cs.uiuc.edu
Mon Nov 1 14:17:18 PST 2004
Changes in directory poolalloc/runtime/FL2Allocator:
FreeListAllocator.cpp updated: 1.11 -> 1.12
PoolAllocator.h updated: 1.5 -> 1.6
---
Log message:
Improve 64-bit alignment cleanliness
---
Diffs of the changes: (+6 -5)
Index: poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp
diff -u poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.11 poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.12
--- poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp:1.11 Fri Mar 5 13:40:38 2004
+++ poolalloc/runtime/FL2Allocator/FreeListAllocator.cpp Mon Nov 1 16:17:08 2004
@@ -165,11 +165,13 @@
// 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...
+ unsigned PtrSize = sizeof(int*);
+ NumBytes = (NumBytes+(PtrSize-1)) & ~(PtrSize-1); // Round up to 4/8 bytes...
// Objects must be at least 8 bytes to hold the FreedNodeHeader object when
// they are freed.
- if (NumBytes < 8) NumBytes = 8;
+ if (NumBytes < (sizeof(FreedNodeHeader)-sizeof(NodeHeader)))
+ NumBytes = sizeof(FreedNodeHeader)-sizeof(NodeHeader);
#ifdef PRINT_NUM_POOLS
if (Pool->NumObjects == 0) ++PoolCounter; // Track # pools.
Index: poolalloc/runtime/FL2Allocator/PoolAllocator.h
diff -u poolalloc/runtime/FL2Allocator/PoolAllocator.h:1.5 poolalloc/runtime/FL2Allocator/PoolAllocator.h:1.6
--- poolalloc/runtime/FL2Allocator/PoolAllocator.h:1.5 Fri Mar 5 04:52:47 2004
+++ poolalloc/runtime/FL2Allocator/PoolAllocator.h Mon Nov 1 16:17:08 2004
@@ -19,10 +19,9 @@
struct FreedNodeHeader;
// NodeHeader - Each block of memory is preceeded in the the pool by one of
-// these headers. If the node is allocated, the ObjectSize value is used, if
-// the object is free, the 'Next' value is used.
+// these headers.
struct NodeHeader {
- unsigned Size;
+ unsigned long Size;
};
More information about the llvm-commits
mailing list