[llvm-commits] CVS: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Feb 22 12:16:15 PST 2005
Changes in directory llvm-poolalloc/runtime/PtrCompAllocator:
PtrCompAllocator.cpp updated: 1.3 -> 1.4
---
Log message:
Remember that we give the program byte offsets into the pool, not node numbers.
This allows tree add to run correctly with pointer compression!
---
Diffs of the changes: (+6 -3)
PtrCompAllocator.cpp | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
Index: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp
diff -u llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.3 llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.4
--- llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.3 Tue Feb 22 14:12:49 2005
+++ llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp Tue Feb 22 14:16:02 2005
@@ -228,8 +228,9 @@
if (Pool->NumUsed < Pool->NumNodesInBitVector) {
unsigned long Result = Pool->NumUsed++;
MarkNodeAllocated(Pool, Result);
- DO_IF_TRACE(fprintf(stderr, "0x%X\n", (unsigned)Result));
- return Result;
+ DO_IF_TRACE(fprintf(stderr, "Node %ld: 0x%lX byte from poolbase\n", Result,
+ Result*Pool->NewSize));
+ return Result*Pool->NewSize;
}
// Otherwise, we need to grow the bitvector. Double its size.
@@ -241,7 +242,9 @@
void poolfree_pc(PoolTy *Pool, unsigned long Node) {
if (Node == 0) return;
- assert(Pool && Node < Pool->NumUsed && "Node or pool incorrect!");
+ assert(Pool && (Node % Pool->NewSize == 0) &&
+ (Node/Pool->NewSize < Pool->NumUsed) && "Node or pool incorrect!");
+ Node /= Pool->NewSize;
DO_IF_TRACE(fprintf(stderr, "[%d] poolfree_pc(0x%X) ",
getPoolNumber(Pool), (unsigned)Node));
More information about the llvm-commits
mailing list