Re-enabled generic Pool which uses ChunkAllocator. Allocator pool renamed to AllocPool.

This commit is contained in:
Istvan Haller
2021-08-19 19:22:16 +01:00
parent c07f5ea7be
commit 99f57646da
5 changed files with 107 additions and 22 deletions

View File

@@ -58,9 +58,12 @@ namespace snmalloc
template<class SharedStateHandle>
class LocalAllocator
{
using CoreAlloc = CoreAllocator<SharedStateHandle>;
public:
using StateHandle = SharedStateHandle;
private:
using CoreAlloc = CoreAllocator<SharedStateHandle>;
// Free list per small size class. These are used for
// allocation on the fast path. This part of the code is inspired by
// mimalloc.
@@ -375,7 +378,7 @@ namespace snmalloc
// Initialise the global allocator structures
ensure_init();
// Grab an allocator for this thread.
init(Pool<CoreAlloc>::template acquire<SharedStateHandle>(
init(AllocPool<CoreAlloc>::template acquire<SharedStateHandle>(
&(this->local_cache)));
}
@@ -398,7 +401,7 @@ namespace snmalloc
// Return underlying allocator to the system.
if constexpr (SharedStateHandle::Options.CoreAllocOwnsLocalState)
{
Pool<CoreAlloc>::template release<SharedStateHandle>(core_alloc);
AllocPool<CoreAlloc>::template release<SharedStateHandle>(core_alloc);
}
// Set up thread local allocator to look like