From 4a7cd268f8edb6c41b106ca8a53b9a83bf3cf234 Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Wed, 20 Oct 2021 11:12:09 +0100 Subject: [PATCH] Rename slab_allocator to chunk_allocator --- src/backend/fixedglobalconfig.h | 8 ++++---- src/backend/globalconfig.h | 8 ++++---- src/mem/{slaballocator.h => chunkallocator.h} | 4 ++-- src/mem/corealloc.h | 2 +- src/mem/pool.h | 2 +- src/override/malloc-extensions.cc | 4 ++-- src/test/func/domestication/domestication.cc | 6 +++--- 7 files changed, 17 insertions(+), 17 deletions(-) rename src/mem/{slaballocator.h => chunkallocator.h} (97%) diff --git a/src/backend/fixedglobalconfig.h b/src/backend/fixedglobalconfig.h index f03bc99..30f9265 100644 --- a/src/backend/fixedglobalconfig.h +++ b/src/backend/fixedglobalconfig.h @@ -1,9 +1,9 @@ #pragma once #include "../backend/backend.h" +#include "../mem/chunkallocator.h" #include "../mem/corealloc.h" #include "../mem/pool.h" -#include "../mem/slaballocator.h" #include "commonconfig.h" namespace snmalloc @@ -19,15 +19,15 @@ namespace snmalloc private: using Backend = BackendAllocator; - inline static ChunkAllocatorState slab_allocator_state; + inline static ChunkAllocatorState chunk_allocator_state; inline static GlobalPoolState alloc_pool; public: static ChunkAllocatorState& - get_slab_allocator_state(typename Backend::LocalState*) + get_chunk_allocator_state(typename Backend::LocalState*) { - return slab_allocator_state; + return chunk_allocator_state; } static GlobalPoolState& pool() diff --git a/src/backend/globalconfig.h b/src/backend/globalconfig.h index 15c24bf..04646e3 100644 --- a/src/backend/globalconfig.h +++ b/src/backend/globalconfig.h @@ -1,9 +1,9 @@ #pragma once #include "../backend/backend.h" +#include "../mem/chunkallocator.h" #include "../mem/corealloc.h" #include "../mem/pool.h" -#include "../mem/slaballocator.h" #include "commonconfig.h" #ifdef SNMALLOC_TRACING @@ -37,7 +37,7 @@ namespace snmalloc private: using Backend = BackendAllocator; SNMALLOC_REQUIRE_CONSTINIT - inline static ChunkAllocatorState slab_allocator_state; + inline static ChunkAllocatorState chunk_allocator_state; SNMALLOC_REQUIRE_CONSTINIT inline static GlobalPoolState alloc_pool; @@ -50,9 +50,9 @@ namespace snmalloc public: static ChunkAllocatorState& - get_slab_allocator_state(Backend::LocalState* = nullptr) + get_chunk_allocator_state(Backend::LocalState* = nullptr) { - return slab_allocator_state; + return chunk_allocator_state; } static GlobalPoolState& pool() diff --git a/src/mem/slaballocator.h b/src/mem/chunkallocator.h similarity index 97% rename from src/mem/slaballocator.h rename to src/mem/chunkallocator.h index 01b0a70..03b95b2 100644 --- a/src/mem/slaballocator.h +++ b/src/mem/chunkallocator.h @@ -88,7 +88,7 @@ namespace snmalloc RemoteAllocator* remote) { ChunkAllocatorState& state = - SharedStateHandle::get_slab_allocator_state(&local_state); + SharedStateHandle::get_chunk_allocator_state(&local_state); if (slab_sizeclass >= NUM_SLAB_SIZES) { @@ -140,7 +140,7 @@ namespace snmalloc ChunkRecord* p, size_t slab_sizeclass) { - auto& state = SharedStateHandle::get_slab_allocator_state(&local_state); + auto& state = SharedStateHandle::get_chunk_allocator_state(&local_state); #ifdef SNMALLOC_TRACING std::cout << "Return slab:" << p->meta_common.chunk.unsafe_ptr() << " slab_sizeclass " << slab_sizeclass << " size " diff --git a/src/mem/corealloc.h b/src/mem/corealloc.h index b0fc28e..aace7f3 100644 --- a/src/mem/corealloc.h +++ b/src/mem/corealloc.h @@ -2,12 +2,12 @@ #include "../ds/defines.h" #include "allocconfig.h" +#include "chunkallocator.h" #include "localcache.h" #include "metaslab.h" #include "pool.h" #include "remotecache.h" #include "sizeclasstable.h" -#include "slaballocator.h" namespace snmalloc { diff --git a/src/mem/pool.h b/src/mem/pool.h index 057c9ba..0c470c7 100644 --- a/src/mem/pool.h +++ b/src/mem/pool.h @@ -3,8 +3,8 @@ #include "../ds/flaglock.h" #include "../ds/mpmcstack.h" #include "../pal/pal_concept.h" +#include "chunkallocator.h" #include "pooled.h" -#include "slaballocator.h" namespace snmalloc { diff --git a/src/override/malloc-extensions.cc b/src/override/malloc-extensions.cc index d672e05..a760401 100644 --- a/src/override/malloc-extensions.cc +++ b/src/override/malloc-extensions.cc @@ -6,8 +6,8 @@ using namespace snmalloc; void get_malloc_info_v1(malloc_info_v1* stats) { - auto unused_chunks = Globals::get_slab_allocator_state().unused_memory(); - auto peak = Globals::get_slab_allocator_state().peak_memory_usage(); + auto unused_chunks = Globals::get_chunk_allocator_state().unused_memory(); + auto peak = Globals::get_chunk_allocator_state().peak_memory_usage(); stats->current_memory_usage = peak - unused_chunks; stats->peak_memory_usage = peak; } diff --git a/src/test/func/domestication/domestication.cc b/src/test/func/domestication/domestication.cc index a1607de..e12c31d 100644 --- a/src/test/func/domestication/domestication.cc +++ b/src/test/func/domestication/domestication.cc @@ -25,7 +25,7 @@ namespace snmalloc private: using Backend = BackendAllocator; SNMALLOC_REQUIRE_CONSTINIT - inline static ChunkAllocatorState slab_allocator_state; + inline static ChunkAllocatorState chunk_allocator_state; SNMALLOC_REQUIRE_CONSTINIT inline static GlobalPoolState alloc_pool; @@ -47,9 +47,9 @@ namespace snmalloc (); static ChunkAllocatorState& - get_slab_allocator_state(Backend::LocalState* = nullptr) + get_chunk_allocator_state(Backend::LocalState* = nullptr) { - return slab_allocator_state; + return chunk_allocator_state; } static GlobalPoolState& pool()