diff options
Diffstat (limited to 'contrib/llvm/lib/Support/Allocator.cpp')
| -rw-r--r-- | contrib/llvm/lib/Support/Allocator.cpp | 10 | 
1 files changed, 8 insertions, 2 deletions
diff --git a/contrib/llvm/lib/Support/Allocator.cpp b/contrib/llvm/lib/Support/Allocator.cpp index 90df262336c5..5e27df6628eb 100644 --- a/contrib/llvm/lib/Support/Allocator.cpp +++ b/contrib/llvm/lib/Support/Allocator.cpp @@ -12,10 +12,10 @@  //===----------------------------------------------------------------------===//  #include "llvm/Support/Allocator.h" -#include "llvm/System/DataTypes.h" +#include "llvm/Support/DataTypes.h"  #include "llvm/Support/Recycler.h"  #include "llvm/Support/raw_ostream.h" -#include "llvm/System/Memory.h" +#include "llvm/Support/Memory.h"  #include <cstring>  namespace llvm { @@ -44,6 +44,12 @@ char *BumpPtrAllocator::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 BumpPtrAllocator::StartNewSlab() { +  // If we allocated a big number of slabs already it's likely that we're going +  // to allocate more. Increase slab size to reduce mallocs and possibly memory +  // overhead. The factors are chosen conservatively to avoid overallocation. +  if (BytesAllocated >= SlabSize * 128) +    SlabSize *= 2; +    MemSlab *NewSlab = Allocator.Allocate(SlabSize);    NewSlab->NextPtr = CurSlab;    CurSlab = NewSlab;  | 
