Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 1 | // Copyright 2016 The SwiftShader Authors. All Rights Reserved. |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 2 | // |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 6 | // |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 14 | |
Nicolas Capens | cc863da | 2015-01-21 15:50:55 -0500 | [diff] [blame] | 15 | #include "PoolAlloc.h" |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 16 | |
| 17 | #ifndef _MSC_VER |
| 18 | #include <stdint.h> |
| 19 | #endif |
| 20 | #include <stdio.h> |
| 21 | |
Nicolas Capens | cc863da | 2015-01-21 15:50:55 -0500 | [diff] [blame] | 22 | #include "InitializeGlobals.h" |
| 23 | #include "osinclude.h" |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 24 | |
| 25 | OS_TLSIndex PoolIndex = OS_INVALID_TLS_INDEX; |
| 26 | |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 27 | bool InitializePoolIndex() |
| 28 | { |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 29 | assert(PoolIndex == OS_INVALID_TLS_INDEX); |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 30 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 31 | PoolIndex = OS_AllocTLSIndex(); |
| 32 | return PoolIndex != OS_INVALID_TLS_INDEX; |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | void FreePoolIndex() |
| 36 | { |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 37 | assert(PoolIndex != OS_INVALID_TLS_INDEX); |
Nicolas Capens | 978ddc5 | 2014-11-11 12:42:08 -0500 | [diff] [blame] | 38 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 39 | OS_FreeTLSIndex(PoolIndex); |
| 40 | PoolIndex = OS_INVALID_TLS_INDEX; |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 41 | } |
| 42 | |
Nicolas Capens | 978ddc5 | 2014-11-11 12:42:08 -0500 | [diff] [blame] | 43 | TPoolAllocator* GetGlobalPoolAllocator() |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 44 | { |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 45 | assert(PoolIndex != OS_INVALID_TLS_INDEX); |
| 46 | return static_cast<TPoolAllocator*>(OS_GetTLSValue(PoolIndex)); |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | void SetGlobalPoolAllocator(TPoolAllocator* poolAllocator) |
| 50 | { |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 51 | assert(PoolIndex != OS_INVALID_TLS_INDEX); |
| 52 | OS_SetTLSValue(PoolIndex, poolAllocator); |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | // |
| 56 | // Implement the functionality of the TPoolAllocator class, which |
| 57 | // is documented in PoolAlloc.h. |
| 58 | // |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 59 | TPoolAllocator::TPoolAllocator(int growthIncrement, int allocationAlignment) : |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 60 | alignment(allocationAlignment) |
| 61 | #if !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC) |
| 62 | , pageSize(growthIncrement), |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 63 | freeList(0), |
| 64 | inUseList(0), |
| 65 | numCalls(0), |
| 66 | totalBytes(0) |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 67 | #endif |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 68 | { |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 69 | // |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 70 | // Adjust alignment to be at least pointer aligned and |
| 71 | // power of 2. |
| 72 | // |
| 73 | size_t minAlign = sizeof(void*); |
| 74 | alignment &= ~(minAlign - 1); |
| 75 | if (alignment < minAlign) |
| 76 | alignment = minAlign; |
| 77 | size_t a = 1; |
| 78 | while (a < alignment) |
| 79 | a <<= 1; |
| 80 | alignment = a; |
| 81 | alignmentMask = a - 1; |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 82 | |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 83 | #if !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC) |
| 84 | // |
| 85 | // Don't allow page sizes we know are smaller than all common |
| 86 | // OS page sizes. |
| 87 | // |
| 88 | if (pageSize < 4*1024) |
| 89 | pageSize = 4*1024; |
| 90 | |
| 91 | // |
| 92 | // A large currentPageOffset indicates a new page needs to |
| 93 | // be obtained to allocate memory. |
| 94 | // |
| 95 | currentPageOffset = pageSize; |
| 96 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 97 | // |
| 98 | // Align header skip |
| 99 | // |
| 100 | headerSkip = minAlign; |
| 101 | if (headerSkip < sizeof(tHeader)) { |
| 102 | headerSkip = (sizeof(tHeader) + alignmentMask) & ~alignmentMask; |
| 103 | } |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 104 | #else // !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC) |
| 105 | mStack.push_back({}); |
| 106 | #endif |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | TPoolAllocator::~TPoolAllocator() |
| 110 | { |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 111 | #if !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC) |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 112 | while (inUseList) { |
| 113 | tHeader* next = inUseList->nextPage; |
| 114 | inUseList->~tHeader(); |
| 115 | delete [] reinterpret_cast<char*>(inUseList); |
| 116 | inUseList = next; |
| 117 | } |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 118 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 119 | // We should not check the guard blocks |
| 120 | // here, because we did it already when the block was |
| 121 | // placed into the free list. |
| 122 | // |
| 123 | while (freeList) { |
| 124 | tHeader* next = freeList->nextPage; |
| 125 | delete [] reinterpret_cast<char*>(freeList); |
| 126 | freeList = next; |
| 127 | } |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 128 | #else // !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC) |
| 129 | for (auto& allocs : mStack) { |
| 130 | for (auto alloc : allocs) { |
| 131 | free(alloc); |
| 132 | } |
| 133 | } |
| 134 | mStack.clear(); |
| 135 | #endif |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | // Support MSVC++ 6.0 |
| 139 | const unsigned char TAllocation::guardBlockBeginVal = 0xfb; |
| 140 | const unsigned char TAllocation::guardBlockEndVal = 0xfe; |
| 141 | const unsigned char TAllocation::userDataFill = 0xcd; |
| 142 | |
| 143 | #ifdef GUARD_BLOCKS |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 144 | const size_t TAllocation::guardBlockSize = 16; |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 145 | #else |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 146 | const size_t TAllocation::guardBlockSize = 0; |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 147 | #endif |
| 148 | |
| 149 | // |
| 150 | // Check a single guard block for damage |
| 151 | // |
| 152 | void TAllocation::checkGuardBlock(unsigned char* blockMem, unsigned char val, const char* locText) const |
| 153 | { |
| 154 | #ifdef GUARD_BLOCKS |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 155 | for (size_t x = 0; x < guardBlockSize; x++) { |
| 156 | if (blockMem[x] != val) { |
| 157 | char assertMsg[80]; |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 158 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 159 | // We don't print the assert message. It's here just to be helpful. |
| 160 | #if defined(_MSC_VER) |
| 161 | _snprintf(assertMsg, sizeof(assertMsg), "PoolAlloc: Damage %s %Iu byte allocation at 0x%p\n", |
| 162 | locText, size, data()); |
| 163 | #else |
| 164 | snprintf(assertMsg, sizeof(assertMsg), "PoolAlloc: Damage %s %zu byte allocation at 0x%p\n", |
| 165 | locText, size, data()); |
| 166 | #endif |
| 167 | assert(0 && "PoolAlloc: Damage in guard block"); |
| 168 | } |
| 169 | } |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 170 | #endif |
| 171 | } |
| 172 | |
| 173 | |
| 174 | void TPoolAllocator::push() |
| 175 | { |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 176 | #if !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC) |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 177 | tAllocState state = { currentPageOffset, inUseList }; |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 178 | |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 179 | mStack.push_back(state); |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 180 | |
| 181 | // |
| 182 | // Indicate there is no current page to allocate from. |
| 183 | // |
| 184 | currentPageOffset = pageSize; |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 185 | #else // !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC) |
| 186 | mStack.push_back({}); |
| 187 | #endif |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | // |
| 191 | // Do a mass-deallocation of all the individual allocations |
| 192 | // that have occurred since the last push(), or since the |
| 193 | // last pop(), or since the object's creation. |
| 194 | // |
| 195 | // The deallocated pages are saved for future allocations. |
| 196 | // |
| 197 | void TPoolAllocator::pop() |
| 198 | { |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 199 | if (mStack.size() < 1) |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 200 | return; |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 201 | |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 202 | #if !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC) |
| 203 | tHeader* page = mStack.back().page; |
| 204 | currentPageOffset = mStack.back().offset; |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 205 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 206 | while (inUseList != page) { |
| 207 | // invoke destructor to free allocation list |
| 208 | inUseList->~tHeader(); |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 209 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 210 | tHeader* nextInUse = inUseList->nextPage; |
| 211 | if (inUseList->pageCount > 1) |
| 212 | delete [] reinterpret_cast<char*>(inUseList); |
| 213 | else { |
| 214 | inUseList->nextPage = freeList; |
| 215 | freeList = inUseList; |
| 216 | } |
| 217 | inUseList = nextInUse; |
| 218 | } |
| 219 | |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 220 | mStack.pop_back(); |
| 221 | #else // !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC) |
| 222 | for (auto alloc : mStack.back()) { |
| 223 | free(alloc); |
| 224 | } |
| 225 | mStack.pop_back(); |
| 226 | #endif |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | // |
| 230 | // Do a mass-deallocation of all the individual allocations |
| 231 | // that have occurred. |
| 232 | // |
| 233 | void TPoolAllocator::popAll() |
| 234 | { |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 235 | while (mStack.size() > 0) |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 236 | pop(); |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | void* TPoolAllocator::allocate(size_t numBytes) |
| 240 | { |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 241 | #if !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC) |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 242 | // |
| 243 | // Just keep some interesting statistics. |
| 244 | // |
| 245 | ++numCalls; |
| 246 | totalBytes += numBytes; |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 247 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 248 | // If we are using guard blocks, all allocations are bracketed by |
| 249 | // them: [guardblock][allocation][guardblock]. numBytes is how |
| 250 | // much memory the caller asked for. allocationSize is the total |
| 251 | // size including guard blocks. In release build, |
| 252 | // guardBlockSize=0 and this all gets optimized away. |
| 253 | size_t allocationSize = TAllocation::allocationSize(numBytes); |
| 254 | // Detect integer overflow. |
| 255 | if (allocationSize < numBytes) |
| 256 | return 0; |
Nicolas Capens | ff7f100 | 2014-11-11 11:31:47 -0500 | [diff] [blame] | 257 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 258 | // |
| 259 | // Do the allocation, most likely case first, for efficiency. |
| 260 | // This step could be moved to be inline sometime. |
| 261 | // |
| 262 | if (allocationSize <= pageSize - currentPageOffset) { |
| 263 | // |
| 264 | // Safe to allocate from currentPageOffset. |
| 265 | // |
| 266 | unsigned char* memory = reinterpret_cast<unsigned char *>(inUseList) + currentPageOffset; |
| 267 | currentPageOffset += allocationSize; |
| 268 | currentPageOffset = (currentPageOffset + alignmentMask) & ~alignmentMask; |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 269 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 270 | return initializeAllocation(inUseList, memory, numBytes); |
| 271 | } |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 272 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 273 | if (allocationSize > pageSize - headerSkip) { |
| 274 | // |
| 275 | // Do a multi-page allocation. Don't mix these with the others. |
| 276 | // The OS is efficient and allocating and free-ing multiple pages. |
| 277 | // |
| 278 | size_t numBytesToAlloc = allocationSize + headerSkip; |
| 279 | // Detect integer overflow. |
| 280 | if (numBytesToAlloc < allocationSize) |
| 281 | return 0; |
Nicolas Capens | ff7f100 | 2014-11-11 11:31:47 -0500 | [diff] [blame] | 282 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 283 | tHeader* memory = reinterpret_cast<tHeader*>(::new char[numBytesToAlloc]); |
| 284 | if (memory == 0) |
| 285 | return 0; |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 286 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 287 | // Use placement-new to initialize header |
| 288 | new(memory) tHeader(inUseList, (numBytesToAlloc + pageSize - 1) / pageSize); |
| 289 | inUseList = memory; |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 290 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 291 | currentPageOffset = pageSize; // make next allocation come from a new page |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 292 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 293 | // No guard blocks for multi-page allocations (yet) |
| 294 | return reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(memory) + headerSkip); |
| 295 | } |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 296 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 297 | // |
| 298 | // Need a simple page to allocate from. |
| 299 | // |
| 300 | tHeader* memory; |
| 301 | if (freeList) { |
| 302 | memory = freeList; |
| 303 | freeList = freeList->nextPage; |
| 304 | } else { |
| 305 | memory = reinterpret_cast<tHeader*>(::new char[pageSize]); |
| 306 | if (memory == 0) |
| 307 | return 0; |
| 308 | } |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 309 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 310 | // Use placement-new to initialize header |
| 311 | new(memory) tHeader(inUseList, 1); |
| 312 | inUseList = memory; |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 313 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 314 | unsigned char* ret = reinterpret_cast<unsigned char *>(inUseList) + headerSkip; |
| 315 | currentPageOffset = (headerSkip + allocationSize + alignmentMask) & ~alignmentMask; |
| 316 | |
| 317 | return initializeAllocation(inUseList, ret, numBytes); |
Corentin Wallez | 3d7c786 | 2017-10-31 18:05:38 -0400 | [diff] [blame^] | 318 | #else // !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC) |
| 319 | void *alloc = malloc(numBytes + alignmentMask); |
| 320 | mStack.back().push_back(alloc); |
| 321 | |
| 322 | intptr_t intAlloc = reinterpret_cast<intptr_t>(alloc); |
| 323 | intAlloc = (intAlloc + alignmentMask) & ~alignmentMask; |
| 324 | return reinterpret_cast<void *>(intAlloc); |
| 325 | #endif |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 326 | } |
| 327 | |
| 328 | |
| 329 | // |
| 330 | // Check all allocations in a list for damage by calling check on each. |
| 331 | // |
| 332 | void TAllocation::checkAllocList() const |
| 333 | { |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 334 | for (const TAllocation* alloc = this; alloc != 0; alloc = alloc->prevAlloc) |
| 335 | alloc->check(); |
John Bauman | 66b8ab2 | 2014-05-06 15:57:45 -0400 | [diff] [blame] | 336 | } |