-void *BumpPtrAllocator::Allocate(unsigned Size, unsigned Align) {
- return ((MemRegion*)TheMemory)->Allocate(Size, Align,(MemRegion**)&TheMemory);
+void BumpPtrAllocator::Reset() {
+ MemRegion *MRP = (MemRegion*)TheMemory;
+ MRP = MRP->DeallocateAllButLast();
+ MRP->Init(4096, 1, 0);
+ TheMemory = MRP;
+}
+
+void *BumpPtrAllocator::Allocate(size_t Size, size_t Align) {
+ MemRegion *MRP = (MemRegion*)TheMemory;
+ void *Ptr = MRP->Allocate(Size, Align, &MRP);
+ TheMemory = MRP;
+ return Ptr;