Benjamin Kramer
a4c5712b41
BumpPtrAllocator::Reset() doesn't need to allocate anything. (Thanks, Jakob)
...
llvm-svn: 101138
2010-04-13 16:38:06 +00:00
Benjamin Kramer
4ca6d372d5
Let BumpPtrAllocator lazily allocate the first slab.
...
We have some code in llvm and clang where a BumpPtrAllocator is declared in a
class but never used in the common case. Stop wasting memory there.
llvm-svn: 101130
2010-04-13 14:41:51 +00:00
Benjamin Kramer
4b94ce229d
Introduce SpecificBumpPtrAllocator, a wrapper for BumpPtrAllocator which allows
...
only a single type of object to be allocated. Use it to make VNInfo destruction
typesafe.
llvm-svn: 99919
2010-03-30 20:16:45 +00:00
Torok Edwin
df7c52143e
Reapply r99881 with some fixes: only call destructor in releaseMemory!
...
llvm-svn: 99883
2010-03-30 11:17:48 +00:00
Torok Edwin
0994bb75ce
Revert 99881, it brooke smooshlab's llvm-gcc-i386-darwin9.
...
llvm-svn: 99882
2010-03-30 10:25:08 +00:00
Torok Edwin
24db267b1e
Introduce another Reset() method in BumpPtrAllocator that calls a destructor
...
on all objects it has allocated, if they are all of the same size and alignment.
Use this to destruct all VNInfos allocated in LiveIntervalAnalysis (PR6653).
valnos is not reliable for this purpose, as seen in r99400
(which still leaked, and sometimes caused double frees).
llvm-svn: 99881
2010-03-30 10:08:26 +00:00
Bill Wendling
921cd93e85
Temporarily revert r93581. It was causing failures in the ExecutionEngine tests
...
on the build bots.
llvm-svn: 93606
2010-01-16 01:06:58 +00:00
Ted Kremenek
bb1779e022
BumpPtrAllocator: Have the DefaultSlabAllocator created at runtime, not initialization time. This removes one of the 'init_constructors' reported in <rdar://problem/7545356>.
...
llvm-svn: 93581
2010-01-15 23:29:34 +00:00
Chandler Carruth
766362c707
Move DataTypes.h to include/llvm/System, update all users. This breaks the last
...
direct inclusion edge from System to Support.
llvm-svn: 85086
2009-10-26 01:35:46 +00:00
Evan Cheng
3044911225
Make sure the memory range is writable before memset'ing it.
...
llvm-svn: 81308
2009-09-09 01:45:24 +00:00
Reid Kleckner
b159a2bad6
Added a test and fixed a bug in BumpPtrAllocator relating to large alignment
...
values. Hopefully this fixes PR4622.
llvm-svn: 77088
2009-07-25 21:26:02 +00:00
Daniel Dunbar
5895c5adf3
Switch to raw_ostream.
...
llvm-svn: 76943
2009-07-24 04:01:01 +00:00
Reid Kleckner
5a7816053e
Re-committing changes from r76825 to BumpPtrAllocator with a fix and tests for
...
an off-by-one error.
llvm-svn: 76891
2009-07-23 18:34:13 +00:00
Reid Kleckner
6f9bf7f028
Reverting r76825 and r76828, since they caused clang runtime errors and some build failure involving memset.
...
llvm-svn: 76838
2009-07-23 01:40:54 +00:00
Zhongxing Xu
cd7c9007d1
add header for 'memset'.
...
llvm-svn: 76837
2009-07-23 01:38:47 +00:00
Reid Kleckner
4c892c05ec
Parameterize the BumpPtrAllocator over a slab allocator. It defaults to using
...
malloc, so there should be no functional changes to other code.
These changes are necessary since I have plans to use this allocator in the JIT
memory manager, and it needs a special allocator.
I also added some tests which helped me pinpoint some bugs.
llvm-svn: 76825
2009-07-23 00:30:41 +00:00
Dan Gohman
9653b21dc2
Fold the useful features of alist and alist_node into ilist, and
...
a new ilist_node class, and remove them. Unlike alist_node,
ilist_node doesn't attempt to manage storage itself, so it avoids
the associated problems, including being opaque in gdb.
Adjust the Recycler class so that it doesn't depend on alist_node.
Also, change it to use explicit Size and Align parameters, allowing
it to work when the largest-sized node doesn't have the greatest
alignment requirement.
Change MachineInstr's MachineMemOperand list from a pool-backed
alist to a std::list for now.
llvm-svn: 54146
2008-07-28 21:51:04 +00:00
Dan Gohman
60e964b34c
Add some basic Pool-allocation infrastructure. This adds a Recycler class,
...
for handling bookkeeping for deleted objects, as well as the alist class
template, for keeping lists of objects allocated from Recyclers, and some
related utilities.
llvm-svn: 53210
2008-07-07 22:58:06 +00:00
Evan Cheng
d9353009b7
Fix more -Wshorten-64-to-32 warnings.
...
llvm-svn: 50659
2008-05-05 18:30:58 +00:00
Dan Gohman
e921f90c15
Fix a pointer-arithmetic bug that caused 64-bit host pointer values to
...
be truncated to 32 bits. This fixes the recent Benchmarks/McCat/09-vor
regression on x86-64, among other things.
llvm-svn: 50372
2008-04-28 20:25:15 +00:00
Ted Kremenek
f1304a3762
Bug fix in BumpPtrAllocator: don't assume that all objects have the same alignment. "Bump" of the pointer for the next allocated object to be of the specified alignment.
...
llvm-svn: 50362
2008-04-28 17:58:07 +00:00
Chris Lattner
ad9a6ccb83
Remove attribution from file headers, per discussion on llvmdev.
...
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Evan Cheng
e6c68e7668
Smarter Reset(). Instead of deallocating all memory regions and reallocate the
...
first region, just deallocate all but the last region in the list.
llvm-svn: 41782
2007-09-08 00:02:17 +00:00
Evan Cheng
5977c55f5d
Added Reset() to free all allocated memory regions and reset state to be the same as right after ctor.
...
llvm-svn: 41728
2007-09-05 21:41:34 +00:00
Chris Lattner
042d3195c9
Avoid TBAA issue.
...
llvm-svn: 34539
2007-02-23 22:31:24 +00:00
Bill Wendling
fe0af72bc4
Don't use <sstream> in Streams.h but <iosfwd> instead.
...
llvm-svn: 32340
2006-12-07 23:41:45 +00:00
Bill Wendling
a3246c4272
Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
...
now cerr, cout, and NullStream resp.
llvm-svn: 32298
2006-12-07 01:30:32 +00:00
Bill Wendling
d933b6630c
Removed #include <iostream> and replace with llvm_* streams.
...
llvm-svn: 31927
2006-11-26 10:52:51 +00:00
John Criswell
335eb0232a
Include llvm/Support/DataTypes.h to define intptr_t.
...
This fixes the build on OpenBSD and potentially other systems.
llvm-svn: 31550
2006-11-08 15:04:35 +00:00
Chris Lattner
6a498a7658
Add a new llvm::Allocator abstraction, which will be used by a container
...
I'm about to add. This is similar to, but necessarily different than, the
STL allocator class.
llvm-svn: 31285
2006-10-29 22:08:03 +00:00