summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Allocator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Recover some overzealously removed includes.Michael Zolotukhin2017-12-131-0/+1
| | | | llvm-svn: 320648
* Remove redundant includes from lib/Support.Michael Zolotukhin2017-12-131-1/+0
| | | | llvm-svn: 320627
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-231-1/+1
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-191-1/+1
| | | | | | | | | | | | | The patch is generated using this command: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ llvm/lib/ Thanks to Eugene Kosov for the original patch! llvm-svn: 240137
* Purge unused includes throughout libSupport.Benjamin Kramer2015-03-231-5/+0
| | | | | | NFC. llvm-svn: 232976
* [Allocator] Hoist the external helper function into a namespace scopeChandler Carruth2014-04-141-0/+4
| | | | | | | declaration. GCC 4.7 appears to get hopelessly confused by declaring this function within a member function of a class template. Go figure. llvm-svn: 206152
* [Allocator] Make the underlying allocator a template instead of anChandler Carruth2014-04-141-12/+0
| | | | | | | | | | | | abstract interface. The only user of this functionality is the JIT memory manager and it is quite happy to have a custom type here. This removes a virtual function call and a lot of unnecessary abstraction from the common case where this is just a *very* thin vaneer around a call to malloc. Hopefully still no functionality changed here. =] llvm-svn: 206149
* [Allocator] Switch the BumpPtrAllocator to use a vector of pointers toChandler Carruth2014-04-141-22/+5
| | | | | | | | | | | | | | | | | | | | | | | slabs rather than embedding a singly linked list in the slabs themselves. This has a few advantages: - Better utilization of the slab's memory by not wasting 16-bytes at the front. - Simpler allocation strategy by not having a struct packed at the front. - Avoids paging every allocated slab in just to traverse them for deallocating or dumping stats. The latter is the really nice part. Folks have complained from time to time bitterly that tearing down a BumpPtrAllocator, even if it doesn't run any destructors, pages in all of the memory allocated. Now it won't. =] Also resolves a FIXME with the scaling of the slab sizes. The scaling now disregards specially sized slabs for allocations larger than the threshold. llvm-svn: 206147
* [C++11] Replace some comparisons with 'nullptr' with simple boolean checks ↵Craig Topper2014-04-091-2/+2
| | | | | | to reduce verbosity. llvm-svn: 205829
* [C++11] Make use of 'nullptr' in the Support library.Craig Topper2014-04-071-3/+3
| | | | llvm-svn: 205697
* [Allocator] Lift the slab size and size threshold into templateChandler Carruth2014-03-301-131/+16
| | | | | | | | | | parameters rather than runtime parameters. There is only one user of these parameters and they are compile time for that user. Making these compile time seems to better reflect their intended usage as well. llvm-svn: 205143
* [Allocator Cleanup] Move generic pointer alignment helper out of anChandler Carruth2014-03-281-15/+3
| | | | | | | out-of-line private static method and into the collection of inline alignment helpers in MathExtras.h. llvm-svn: 204995
* [Allocator Cleanup] Make the growth of the "slab" size of theChandler Carruth2014-03-281-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | BumpPtrAllocator significantly less strange by making it a simple function of the number of slabs allocated rather than by making it a recurrance. I *think* the previous behavior was essentially that the size of the slabs would be doubled after the first 128 were allocated, and then doubled again each time 64 more were allocated, but only if every allocation packed perfectly into the slab size. If not, the wasted space wouldn't be counted toward increasing the size, but allocations over the size threshold *would*. And since the allocations over the size threshold might be much larger than the slab size, this could have somewhat surprising consequences where we rapidly grow the slab size. This currently requires adding state to the allocator to track the number of slabs currently allocated, but that isn't too bad. I'm planning further changes to the allocator that will make this state fall out even more naturally. It still doesn't fully decouple the growth rate from the allocations which are over the size threshold. That fix is coming later. This specific fix will allow making the entire thing into a more stateless device and lifting the parameters into template parameters rather than runtime parameters. llvm-svn: 204993
* [BumpPtrAllocator] Move DefaultSlabAllocator to a member of ↵Argyrios Kyrtzidis2013-08-281-3/+4
| | | | | | | | | | BumpPtrAllocator, instead of a static variable. The problem with having DefaultSlabAllocator being a global static is that it is undefined if BumpPtrAllocator will be usable during global initialization because it is not guaranteed that DefaultSlabAllocator will be initialized before BumpPtrAllocator is created and used. llvm-svn: 189433
* as the allocator is reset zero out the number of bytes allocated, this was justPedro Artigas2013-02-201-0/+1
| | | | | | missed before but probably what was intended. llvm-svn: 175687
* More MSan/ASan annotations.Evgeniy Stepanov2013-02-041-2/+2
| | | | | | | | | | | | | | This change lets us bootstrap LLVM/Clang under ASan and MSan. It contains fixes for 2 issues: - X86JIT reads return address from stack, which MSan does not know is initialized. - bugpoint tests run binaries with RLIMIT_AS. This does not work with certain Sanitizers. We are no longer including config.h in Compiler.h with this change. llvm-svn: 174306
* Annotate BumpPtrAllocator for MemorySanitizer.Evgeniy Stepanov2013-01-311-0/+7
| | | | | | | This change adds MemorySanitizer annotations to BumpPtrAllocator to improve report quality. llvm-svn: 174051
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-1/+1
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* BumpPtrAllocator: Make sure threshold cannot be initialized with a value ↵Benjamin Kramer2012-03-011-11/+6
| | | | | | | | smaller than the slab size. This replaces r151834 with a simpler fix. llvm-svn: 151842
* If BumpPtrAllocator is requested to allocate a size that exceeds the slab size,Argyrios Kyrtzidis2012-03-011-4/+9
| | | | | | increase the slab size. llvm-svn: 151834
* Add BumpPtrAllocator::getTotalMemory() to allow clients to query how much ↵Ted Kremenek2011-04-181-0/+8
| | | | | | memory a BumpPtrAllocator allocated. llvm-svn: 129727
* Merge System into Support.Michael J. Spencer2010-11-291-2/+2
| | | | llvm-svn: 120298
* Grow BumpPtrAllocator's slab size dynamically if we allocated many slabs. ThisBenjamin Kramer2010-09-301-0/+6
| | | | | | | | | | | | | | | | | | | | | reduces the amount of malloc calls and may reduce memory overhead. Some numbers: ASTContext stats, clang -cc1 -disable-free -fsyntax-only Cocoa_h.m without dynamic growth | with dynamic growth Number of memory regions: 3158 | Number of memory regions: 432 Bytes used: 12333185 | Bytes used: 12333185 Bytes allocated: 12935168 | Bytes allocated: 12800000 Bytes wasted: 601983 (includes alignment, etc) | Bytes wasted: 466815 (includes alignment, etc) ASTContext stats, clang -cc1 -disable-free -fsyntax-only on clang's ASTReader.cpp without dynamic growth | with dynamic growth Number of memory regions: 10987 | Number of memory regions: 551 Bytes used: 42910356 | Bytes used: 42910356 Bytes allocated: 45002752 | Bytes allocated: 44711936 Bytes wasted: 2092396 (includes alignment, etc) | Bytes wasted: 1801580 (includes alignment, etc) llvm-svn: 115151
* BumpPtrAllocator::Reset() doesn't need to allocate anything. (Thanks, Jakob)Benjamin Kramer2010-04-131-2/+2
| | | | llvm-svn: 101138
* Let BumpPtrAllocator lazily allocate the first slab.Benjamin Kramer2010-04-131-3/+6
| | | | | | | 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
* Introduce SpecificBumpPtrAllocator, a wrapper for BumpPtrAllocator which allowsBenjamin Kramer2010-03-301-15/+0
| | | | | | | only a single type of object to be allocated. Use it to make VNInfo destruction typesafe. llvm-svn: 99919
* Reapply r99881 with some fixes: only call destructor in releaseMemory!Torok Edwin2010-03-301-0/+15
| | | | llvm-svn: 99883
* Revert 99881, it brooke smooshlab's llvm-gcc-i386-darwin9.Torok Edwin2010-03-301-15/+0
| | | | llvm-svn: 99882
* Introduce another Reset() method in BumpPtrAllocator that calls a destructorTorok Edwin2010-03-301-0/+15
| | | | | | | | | | 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
* Temporarily revert r93581. It was causing failures in the ExecutionEngine testsBill Wendling2010-01-161-4/+2
| | | | | | on the build bots. llvm-svn: 93606
* BumpPtrAllocator: Have the DefaultSlabAllocator created at runtime, not ↵Ted Kremenek2010-01-151-2/+4
| | | | | | initialization time. This removes one of the 'init_constructors' reported in <rdar://problem/7545356>. llvm-svn: 93581
* Move DataTypes.h to include/llvm/System, update all users. This breaks the lastChandler Carruth2009-10-261-1/+1
| | | | | | direct inclusion edge from System to Support. llvm-svn: 85086
* Make sure the memory range is writable before memset'ing it.Evan Cheng2009-09-091-0/+2
| | | | llvm-svn: 81308
* Added a test and fixed a bug in BumpPtrAllocator relating to large alignmentReid Kleckner2009-07-251-2/+2
| | | | | | values. Hopefully this fixes PR4622. llvm-svn: 77088
* Switch to raw_ostream.Daniel Dunbar2009-07-241-9/+9
| | | | llvm-svn: 76943
* Re-committing changes from r76825 to BumpPtrAllocator with a fix and tests forReid Kleckner2009-07-231-105/+133
| | | | | | an off-by-one error. llvm-svn: 76891
* Reverting r76825 and r76828, since they caused clang runtime errors and some ↵Reid Kleckner2009-07-231-132/+104
| | | | | | build failure involving memset. llvm-svn: 76838
* add header for 'memset'.Zhongxing Xu2009-07-231-0/+1
| | | | llvm-svn: 76837
* Parameterize the BumpPtrAllocator over a slab allocator. It defaults to usingReid Kleckner2009-07-231-104/+131
| | | | | | | | | | | 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
* Fold the useful features of alist and alist_node into ilist, andDan Gohman2008-07-281-2/+4
| | | | | | | | | | | | | | | | 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
* Add some basic Pool-allocation infrastructure. This adds a Recycler class,Dan Gohman2008-07-071-0/+7
| | | | | | | | 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
* Fix more -Wshorten-64-to-32 warnings.Evan Cheng2008-05-051-2/+2
| | | | llvm-svn: 50659
* Fix a pointer-arithmetic bug that caused 64-bit host pointer values toDan Gohman2008-04-281-1/+1
| | | | | | | be truncated to 32 bits. This fixes the recent Benchmarks/McCat/09-vor regression on x86-64, among other things. llvm-svn: 50372
* Bug fix in BumpPtrAllocator: don't assume that all objects have the same ↵Ted Kremenek2008-04-281-6/+9
| | | | | | alignment. "Bump" of the pointer for the next allocated object to be of the specified alignment. llvm-svn: 50362
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* Smarter Reset(). Instead of deallocating all memory regions and reallocate theEvan Cheng2007-09-081-5/+17
| | | | | | first region, just deallocate all but the last region in the list. llvm-svn: 41782
* Added Reset() to free all allocated memory regions and reset state to be the ↵Evan Cheng2007-09-051-0/+6
| | | | | | same as right after ctor. llvm-svn: 41728
* Avoid TBAA issue.Chris Lattner2007-02-231-1/+4
| | | | llvm-svn: 34539
* Don't use <sstream> in Streams.h but <iosfwd> instead.Bill Wendling2006-12-071-0/+1
| | | | llvm-svn: 32340
OpenPOWER on IntegriCloud