[llvm-commits] CVS: poolalloc/runtime/PoolAllocator/PoolAllocatorBitMask.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Nov 14 12:32:01 PST 2003


Changes in directory poolalloc/runtime/PoolAllocator:

PoolAllocatorBitMask.cpp updated: 1.30 -> 1.31

---
Log message:

Uncomment out my assertions, fix buggy assertion


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

Index: poolalloc/runtime/PoolAllocator/PoolAllocatorBitMask.cpp
diff -u poolalloc/runtime/PoolAllocator/PoolAllocatorBitMask.cpp:1.30 poolalloc/runtime/PoolAllocator/PoolAllocatorBitMask.cpp:1.31
--- poolalloc/runtime/PoolAllocator/PoolAllocatorBitMask.cpp:1.30	Sat Nov  8 21:09:43 2003
+++ poolalloc/runtime/PoolAllocator/PoolAllocatorBitMask.cpp	Fri Nov 14 12:31:08 2003
@@ -23,9 +23,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#undef assert
-#define assert(X)
-
 //===----------------------------------------------------------------------===//
 //
 //  PoolSlab implementation
@@ -332,10 +329,10 @@
 int PoolSlab::containsElement(void *Ptr, unsigned ElementSize) const {
   const void *FirstElement = getElementAddress(0, 0);
   if (FirstElement <= Ptr) {
-    unsigned Index = (char*)Ptr-(char*)FirstElement;
-    Index /= ElementSize;
+    unsigned Delta = (char*)Ptr-(char*)FirstElement;
+    unsigned Index = Delta/ElementSize;
     if (Index < getSlabSize()) {
-      assert(Index % ElementSize == 0 &&
+      assert(Delta % ElementSize == 0 &&
              "Freeing pointer into the middle of an element!");
       return Index;
     }
@@ -665,7 +662,6 @@
 
 void poolfree(PoolTy *Pool, void *Node) {
   assert(Pool && "Null pool pointer passed in to poolfree!\n");
-
   PoolSlab *PS;
   unsigned Idx;
   if (0) {                  // THIS SHOULD BE SET FOR SAFECODE!





More information about the llvm-commits mailing list