+ BumpPtrAllocator(const BumpPtrAllocator &); // do not implement
+ void operator=(const BumpPtrAllocator &); // do not implement
+
+ /// SlabSize - Allocate data into slabs of this size unless we get an
+ /// allocation above SizeThreshold.
+ size_t SlabSize;
+
+ /// SizeThreshold - For any allocation larger than this threshold, we should
+ /// allocate a separate slab.
+ size_t SizeThreshold;
+
+ /// Allocator - The underlying allocator we use to get slabs of memory. This
+ /// defaults to MallocSlabAllocator, which wraps malloc, but it could be
+ /// changed to use a custom allocator.
+ SlabAllocator &Allocator;
+
+ /// CurSlab - The slab that we are currently allocating into.
+ ///
+ MemSlab *CurSlab;
+
+ /// CurPtr - The current pointer into the current slab. This points to the
+ /// next free byte in the slab.
+ char *CurPtr;
+
+ /// End - The end of the current slab.
+ ///
+ char *End;
+
+ /// BytesAllocated - This field tracks how many bytes we've allocated, so
+ /// that we can compute how much space was wasted.
+ size_t BytesAllocated;
+
+ /// AlignPtr - Align Ptr to Alignment bytes, rounding up. Alignment should
+ /// be a power of two. This method rounds up, so AlignPtr(7, 4) == 8 and
+ /// AlignPtr(8, 4) == 8.
+ static char *AlignPtr(char *Ptr, size_t Alignment);
+
+ /// StartNewSlab - Allocate a new slab and move the bump pointers over into
+ /// the new slab. Modifies CurPtr and End.
+ void StartNewSlab();
+
+ /// DeallocateSlabs - Deallocate all memory slabs after and including this
+ /// one.
+ void DeallocateSlabs(MemSlab *Slab);
+
+ static MallocSlabAllocator DefaultSlabAllocator;
+