| 254 | } |
| 255 | |
| 256 | void HashStringAllocator::newSlab() { |
| 257 | constexpr int32_t kSimdPadding = simd::kPadding - sizeof(Header); |
| 258 | const int64_t needed = pool_.allocatedBytes() >= pool_.hugePageThreshold() |
| 259 | ? memory::AllocationTraits::kHugePageSize |
| 260 | : kUnitSize; |
| 261 | auto run = pool_.allocateFixed(needed); |
| 262 | // We check we got exactly the requested amount. checkConsistency() |
| 263 | // depends on slabs made here coinciding with ranges from |
| 264 | // AllocationPool::rangeAt(). Sometimes the last range can be |
| 265 | // several huge pages for several huge page sized arenas but |
| 266 | // checkConsistency() can interpret that. |
| 267 | BOLT_CHECK_EQ(0, pool_.freeBytes()); |
| 268 | auto available = needed - sizeof(Header) - kSimdPadding; |
| 269 | |
| 270 | BOLT_CHECK_NOT_NULL(run); |
| 271 | BOLT_CHECK_GT(available, 0); |
| 272 | // Write end marker. |
| 273 | *reinterpret_cast<uint32_t*>(run + available) = Header::kArenaEnd; |
| 274 | cumulativeBytes_ += available - sizeof(Header); |
| 275 | |
| 276 | // Add the new memory to the free list: Placement construct a header |
| 277 | // that covers the space from start to the end marker and add this |
| 278 | // to free list. |
| 279 | free(new (run) Header(available - sizeof(Header))); |
| 280 | } |
| 281 | |
| 282 | void HashStringAllocator::newRange( |
| 283 | int32_t bytes, |
nothing calls this directly
no test coverage detected