[llvm-commits] [llvm] r93581 - in /llvm/trunk: include/llvm/Support/Allocator.h lib/Support/Allocator.cpp
Ted Kremenek
kremenek at apple.com
Fri Jan 15 15:29:34 PST 2010
Author: kremenek
Date: Fri Jan 15 17:29:34 2010
New Revision: 93581
URL: http://llvm.org/viewvc/llvm-project?rev=93581&view=rev
Log:
BumpPtrAllocator: Have the DefaultSlabAllocator created at runtime, not initialization time. This removes one of the 'init_constructors' reported in <rdar://problem/7545356>.
Modified:
llvm/trunk/include/llvm/Support/Allocator.h
llvm/trunk/lib/Support/Allocator.cpp
Modified: llvm/trunk/include/llvm/Support/Allocator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=93581&r1=93580&r2=93581&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Allocator.h (original)
+++ llvm/trunk/include/llvm/Support/Allocator.h Fri Jan 15 17:29:34 2010
@@ -128,11 +128,11 @@
/// one.
void DeallocateSlabs(MemSlab *Slab);
- static MallocSlabAllocator DefaultSlabAllocator;
+ static MallocSlabAllocator &GetDefaultSlabAllocator();
public:
BumpPtrAllocator(size_t size = 4096, size_t threshold = 4096,
- SlabAllocator &allocator = DefaultSlabAllocator);
+ SlabAllocator &allocator = GetDefaultSlabAllocator());
~BumpPtrAllocator();
/// Reset - Deallocate all but the current slab and reset the current pointer
Modified: llvm/trunk/lib/Support/Allocator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Allocator.cpp?rev=93581&r1=93580&r2=93581&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Allocator.cpp (original)
+++ llvm/trunk/lib/Support/Allocator.cpp Fri Jan 15 17:29:34 2010
@@ -142,8 +142,10 @@
<< " (includes alignment, etc)\n";
}
-MallocSlabAllocator BumpPtrAllocator::DefaultSlabAllocator =
- MallocSlabAllocator();
+MallocSlabAllocator &BumpPtrAllocator::GetDefaultSlabAllocator() {
+ static MallocSlabAllocator DefaultSlabAllocator;
+ return DefaultSlabAllocator;
+}
SlabAllocator::~SlabAllocator() { }
More information about the llvm-commits
mailing list