[176] | 1 | // -*- C++ -*- |
---|
| 2 | |
---|
| 3 | /* |
---|
| 4 | |
---|
| 5 | Heap Layers: An Extensible Memory Allocation Infrastructure |
---|
| 6 | |
---|
| 7 | Copyright (C) 2000-2004 by Emery Berger |
---|
| 8 | http://www.cs.umass.edu/~emery |
---|
| 9 | emery@cs.umass.edu |
---|
| 10 | |
---|
| 11 | This program is free software; you can redistribute it and/or modify |
---|
| 12 | it under the terms of the GNU General Public License as published by |
---|
| 13 | the Free Software Foundation; either version 2 of the License, or |
---|
| 14 | (at your option) any later version. |
---|
| 15 | |
---|
| 16 | This program is distributed in the hope that it will be useful, |
---|
| 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 19 | GNU General Public License for more details. |
---|
| 20 | |
---|
| 21 | You should have received a copy of the GNU General Public License |
---|
| 22 | along with this program; if not, write to the Free Software |
---|
| 23 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 24 | |
---|
| 25 | */ |
---|
| 26 | |
---|
| 27 | /** |
---|
| 28 | * @file heaplayers.h |
---|
| 29 | * @brief The master Heap Layers include file. |
---|
| 30 | * |
---|
| 31 | * Heap Layers is an extensible memory allocator infrastructure. For |
---|
| 32 | * more information, read the PLDI 2001 paper "Composing |
---|
| 33 | * High-Performance Memory Allocators", by Emery D. Berger, Benjamin |
---|
| 34 | * G. Zorn, and Kathryn S. McKinley. |
---|
| 35 | * (http://citeseer.ist.psu.edu/berger01composing.html) |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #ifndef _HEAPLAYERS_H_ |
---|
| 39 | #define _HEAPLAYERS_H_ |
---|
| 40 | |
---|
| 41 | namespace HL {}; |
---|
| 42 | |
---|
| 43 | #include "hldefines.h" |
---|
| 44 | |
---|
| 45 | /** |
---|
| 46 | * @def ALLOCATION_STATS |
---|
| 47 | * |
---|
| 48 | * Defining ALLOCATION_STATS below as 1 enables tracking of allocation |
---|
| 49 | * statistics in a variety of layers. You then must link in |
---|
| 50 | * definitions of the extern variables used therein; stats.cpp |
---|
| 51 | * contains these definitions. |
---|
| 52 | * |
---|
| 53 | * This should be undefined for all but experimental use. |
---|
| 54 | * |
---|
| 55 | */ |
---|
| 56 | |
---|
| 57 | #ifndef ALLOCATION_STATS |
---|
| 58 | #define ALLOCATION_STATS 0 |
---|
| 59 | #endif |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | #ifdef _MSC_VER |
---|
| 64 | // 4786: Disable warnings about long (> 255 chars) identifiers. |
---|
| 65 | // 4512: Disable warnings about assignment operators. |
---|
| 66 | #pragma warning( push ) |
---|
| 67 | #pragma warning( disable:4786 4512 ) |
---|
| 68 | // Set inlining to the maximum possible depth. |
---|
| 69 | #pragma inline_depth(255) |
---|
| 70 | #define inline __forceinline |
---|
| 71 | #endif |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | #include "util/sassert.h" |
---|
| 75 | // #include "utility.h" // convenient wrappers to replace C++ new & delete operators |
---|
| 76 | #include "util/dynarray.h" // an array that grows by doubling |
---|
| 77 | #include "util/myhashmap.h" |
---|
| 78 | |
---|
| 79 | // Hiding machine dependencies. |
---|
| 80 | |
---|
| 81 | #include "util/cpuinfo.h" |
---|
| 82 | #include "util/timer.h" // allows high-resolution timing across a wide range of platforms |
---|
| 83 | #include "util/guard.h" |
---|
| 84 | #include "util/fred.h" |
---|
| 85 | |
---|
| 86 | // Lock implementations. |
---|
| 87 | |
---|
| 88 | #include "spinlock.h" // spin-then-yield |
---|
| 89 | |
---|
| 90 | #if defined(_WIN32) |
---|
| 91 | #include "util/winlock.h" // critical-sections (i.e., for Windows only) |
---|
| 92 | #include "util/recursivelock.h" // a wrapper for recursive locking |
---|
| 93 | #endif |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | // Useful utilities. |
---|
| 97 | |
---|
| 98 | #include "unique.h" |
---|
| 99 | #include "tryheap.h" |
---|
| 100 | |
---|
| 101 | // Base heaps |
---|
| 102 | |
---|
| 103 | #include "zoneheap.h" // a zone allocator (frees all memory when the heap goes out of scope) |
---|
| 104 | |
---|
| 105 | // Adapters |
---|
| 106 | |
---|
| 107 | #include "perclassheap.h" // make a per-class heap |
---|
| 108 | |
---|
| 109 | |
---|
| 110 | // Freelist-like heaps ("allocation caches") |
---|
| 111 | // NB: All of these should be used for exactly one size class. |
---|
| 112 | |
---|
| 113 | #include "freelistheap.h" // a free list. Never frees memory. |
---|
| 114 | #include "fifofreelist.h" // a FIFO free list. |
---|
| 115 | #include "fifodlfreelist.h" // a doubly-linked FIFO free list. |
---|
| 116 | #include "boundedfreelistheap.h" // a free list with a bounded length. |
---|
| 117 | |
---|
| 118 | |
---|
| 119 | #include "nullheap.h" |
---|
| 120 | #include "coalesceheap.h" // A chunk heap with coalescing. |
---|
| 121 | #include "coalesceableheap.h" |
---|
| 122 | |
---|
| 123 | // Utility heap layers |
---|
| 124 | |
---|
| 125 | #include "sizethreadheap.h" // Adds size(ptr) & thread(ptr) methods |
---|
| 126 | #include "lockedheap.h" // Code-locks a heap |
---|
| 127 | #include "checkheap.h" // Raises assertions if malloc'ed objects aren't right. |
---|
| 128 | // #include "exceptionheap.h" // Raise an exception if a malloc fails. |
---|
| 129 | |
---|
| 130 | #include "sanitycheckheap.h" // Check for multiple frees and mallocs of same locations. |
---|
| 131 | #include "ansiwrapper.h" // Provide ANSI C like behavior for malloc (alignment, etc.) |
---|
| 132 | |
---|
| 133 | // Multi-threaded heaps |
---|
| 134 | // hashes the thread id across a number of heaps |
---|
| 135 | |
---|
| 136 | #include "phothreadheap.h" // Private-heaps with ownership |
---|
| 137 | #include "threadheap.h" // Pure-private heaps (sort of) |
---|
| 138 | |
---|
| 139 | // Generic heaps |
---|
| 140 | |
---|
| 141 | #include "segheap.h" // A *very general* segregated fits allocator. |
---|
| 142 | |
---|
| 143 | // "Standard" heap layers |
---|
| 144 | |
---|
| 145 | #include "kingsleyheap.h" // A power-of-two size class allocator, |
---|
| 146 | // a la Chris Kingsley's BSD allocator. |
---|
| 147 | |
---|
| 148 | // "Top" heaps. |
---|
| 149 | #include "mallocheap.h" // a thin wrapper around the system's malloc/free |
---|
| 150 | #include "mmapheap.h" // a wrapper around the system's virtual memory system |
---|
| 151 | |
---|
| 152 | // the rest... |
---|
| 153 | |
---|
| 154 | #include "oneheap.h" |
---|
| 155 | #include "debugheap.h" |
---|
| 156 | #include "sizeheap.h" |
---|
| 157 | #include "addheap.h" |
---|
| 158 | #include "profileheap.h" |
---|
| 159 | #include "sizeownerheap.h" |
---|
| 160 | #include "hybridheap.h" |
---|
| 161 | #include "traceheap.h" |
---|
| 162 | #include "stlallocator.h" |
---|
| 163 | #include "adapt.h" |
---|
| 164 | #include "util/dllist.h" |
---|
| 165 | #include "dlheap.h" |
---|
| 166 | // #include "logheap.h" |
---|
| 167 | #include "obstackheap.h" |
---|
| 168 | #include "sbrkheap.h" |
---|
| 169 | |
---|
| 170 | #include "xallocHeap.h" // 197.parser's heap |
---|
| 171 | |
---|
| 172 | #include "staticheap.h" |
---|
| 173 | |
---|
| 174 | #ifdef _MSC_VER |
---|
| 175 | #pragma warning( pop ) |
---|
| 176 | #endif |
---|
| 177 | |
---|
| 178 | #endif // _HEAPLAYERS_H_ |
---|