Skip to content

Commit b20e014

Browse files
authored
Upgrade snmalloc from 0.7.1 to 0.7.2 (#7163)
1 parent a59d7ab commit b20e014

File tree

91 files changed

+3856
-1940
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+3856
-1940
lines changed

3rdparty/exported/snmalloc/CMakeLists.txt

Lines changed: 97 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.14)
1+
cmake_minimum_required(VERSION 3.21)
22
project(snmalloc CXX)
33

44
if (NOT CMAKE_BUILD_TYPE)
@@ -32,22 +32,29 @@ option(SNMALLOC_ENABLE_FUZZING "Enable fuzzing instrumentation tests" OFF)
3232
option(SNMALLOC_USE_SELF_VENDORED_STL "Avoid using system STL" OFF)
3333
# Options that apply only if we're not building the header-only library
3434
cmake_dependent_option(SNMALLOC_RUST_SUPPORT "Build static library for rust" OFF "NOT SNMALLOC_HEADER_ONLY_LIBRARY" OFF)
35+
cmake_dependent_option(SNMALLOC_RUST_LIBC_API "Include libc API in the rust library" OFF "SNMALLOC_RUST_SUPPORT" OFF)
3536
cmake_dependent_option(SNMALLOC_STATIC_LIBRARY "Build static libraries" ON "NOT SNMALLOC_HEADER_ONLY_LIBRARY" OFF)
3637
cmake_dependent_option(SNMALLOC_CHECK_LOADS "Perform bounds checks on the source argument to memcpy with heap objects" OFF "NOT SNMALLOC_HEADER_ONLY_LIBRARY" OFF)
3738
cmake_dependent_option(SNMALLOC_OPTIMISE_FOR_CURRENT_MACHINE "Compile for current machine architecture" Off "NOT SNMALLOC_HEADER_ONLY_LIBRARY" OFF)
3839
cmake_dependent_option(SNMALLOC_PAGEID "Set an id to memory regions" OFF "NOT SNMALLOC_PAGEID" OFF)
40+
41+
# GwpAsan secondary allocator
42+
option(SNMALLOC_ENABLE_GWP_ASAN_INTEGRATION "Enable GwpAsan as a secondary allocator" OFF)
43+
set(SNMALLOC_GWP_ASAN_INCLUDE_PATH "" CACHE PATH "GwpAsan header directory")
44+
set(SNMALLOC_GWP_ASAN_LIBRARY_PATH "" CACHE PATH "GwpAsan library directory")
45+
3946
if (NOT SNMALLOC_HEADER_ONLY_LIBRARY)
4047
# Pick a sensible default for the thread cleanup mechanism
4148
if (${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD)
4249
set(SNMALLOC_CLEANUP_DEFAULT THREAD_CLEANUP)
4350
elseif (UNIX AND NOT APPLE)
44-
set(SNMALLOC_CLEANUP_DEFAULT PTHREAD_DESTRUCTORS)
51+
set(SNMALLOC_CLEANUP_DEFAULT CXX11_THREAD_ATEXIT_DIRECT)
4552
else ()
4653
set(SNMALLOC_CLEANUP_DEFAULT CXX11_DESTRUCTORS)
4754
endif()
4855
# Specify the thread cleanup mechanism to use.
49-
set(SNMALLOC_CLEANUP ${SNMALLOC_CLEANUP_DEFAULT} CACHE STRING "The mechanism that snmalloc will use for thread destructors. Valid options are: CXX11_DESTRUCTORS (use C++11 destructors, may depend on the C++ runtime library), PTHREAD_DESTRUCTORS (use pthreads, may interact badly with C++ on some platforms, such as macOS) THREAD_CLEANUP (depend on an explicit call to _malloc_thread_cleanup on thread exit, supported by FreeBSD's threading implementation and possibly elsewhere)")
50-
set_property(CACHE SNMALLOC_CLEANUP PROPERTY STRINGS THREAD_CLEANUP PTHREAD_DESTRUCTORS CXX11_DESTRUCTORS)
56+
set(SNMALLOC_CLEANUP ${SNMALLOC_CLEANUP_DEFAULT} CACHE STRING "The mechanism that snmalloc will use for thread destructors. Valid options are: CXX11_DESTRUCTORS (use C++11 destructors, may depend on the C++ runtime library), CXX11_THREAD_ATEXIT_DIRECT (use the glibc call for libstdc++ directly), PTHREAD_DESTRUCTORS (use pthreads, may interact badly with C++ on some platforms, such as macOS) THREAD_CLEANUP (depend on an explicit call to _malloc_thread_cleanup on thread exit, supported by FreeBSD's threading implementation and possibly elsewhere)")
57+
set_property(CACHE SNMALLOC_CLEANUP PROPERTY STRINGS THREAD_CLEANUP PTHREAD_DESTRUCTORS CXX11_THREAD_ATEXIT_DIRECT CXX11_DESTRUCTORS)
5158

5259
set(SNMALLOC_STATIC_LIBRARY_PREFIX "sn_" CACHE STRING "Static library function prefix")
5360
set(SNMALLOC_COMPILER_SUPPORT_IPO FALSE)
@@ -114,6 +121,19 @@ int main()
114121
SNMALLOC_LINKER_SUPPORT_NOSTDLIBXX)
115122
set(CMAKE_REQUIRED_LINK_OPTIONS "")
116123

124+
# Detect if pthread_atfork works
125+
CHECK_CXX_SOURCE_COMPILES("
126+
#include <pthread.h>
127+
void prepare() {}
128+
void parent() {}
129+
void child() {}
130+
int main() {
131+
pthread_atfork(prepare, parent, child);
132+
return 0;
133+
}
134+
" SNMALLOC_PTHREAD_ATFORK_WORKS)
135+
136+
117137
if (NOT MSVC AND NOT (SNMALLOC_CLEANUP STREQUAL CXX11_DESTRUCTORS))
118138
# If the target compiler doesn't support -nostdlib++ then we must enable C at
119139
# the global scope for the fallbacks to work.
@@ -241,6 +261,20 @@ if(SNMALLOC_USE_SELF_VENDORED_STL)
241261
target_compile_definitions(snmalloc INTERFACE SNMALLOC_USE_SELF_VENDORED_STL)
242262
endif()
243263

264+
if (SNMALLOC_ENABLE_GWP_ASAN_INTEGRATION)
265+
if (NOT EXISTS ${SNMALLOC_GWP_ASAN_INCLUDE_PATH})
266+
message(FATAL_ERROR "GwpAsan cannot be enabled without setting SNMALLOC_GWP_ASAN_INCLUDE_PATH")
267+
endif()
268+
if (NOT EXISTS ${SNMALLOC_GWP_ASAN_LIBRARY_PATH})
269+
message(FATAL_ERROR "GwpAsan cannot be enabled without setting SNMALLOC_GWP_ASAN_LIBRARY_PATH")
270+
endif()
271+
message(STATUS "GwpAsan is enabled: ${SNMALLOC_GWP_ASAN_LIBRARY_PATH}/libclang_rt.gwp_asan-${CMAKE_SYSTEM_PROCESSOR}.a")
272+
target_include_directories(snmalloc INTERFACE ${SNMALLOC_GWP_ASAN_INCLUDE_PATH})
273+
target_link_directories(snmalloc INTERFACE ${SNMALLOC_GWP_ASAN_LIBRARY_PATH})
274+
target_compile_definitions(snmalloc INTERFACE -DSNMALLOC_ENABLE_GWP_ASAN_INTEGRATION)
275+
target_link_libraries(snmalloc INTERFACE clang_rt.gwp_asan-${CMAKE_SYSTEM_PROCESSOR})
276+
endif()
277+
244278
# https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus
245279
if(MSVC)
246280
target_compile_options(snmalloc INTERFACE "/Zc:__cplusplus")
@@ -300,6 +334,7 @@ add_as_define(SNMALLOC_QEMU_WORKAROUND)
300334
add_as_define(SNMALLOC_TRACING)
301335
add_as_define(SNMALLOC_CI_BUILD)
302336
add_as_define(SNMALLOC_PLATFORM_HAS_GETENTROPY)
337+
add_as_define(SNMALLOC_PTHREAD_ATFORK_WORKS)
303338
add_as_define(SNMALLOC_HAS_LINUX_RANDOM_H)
304339
add_as_define(SNMALLOC_HAS_LINUX_FUTEX_H)
305340
if (SNMALLOC_NO_REALLOCARRAY)
@@ -344,7 +379,7 @@ endif()
344379
function(add_warning_flags name)
345380
target_compile_options(${name} PRIVATE
346381
$<$<CXX_COMPILER_ID:MSVC>:/Zi /W4 /WX /wd4127 /wd4324 /wd4201>
347-
$<$<NOT:$<OR:$<CXX_COMPILER_ID:MSVC>,$<STREQUAL:${CMAKE_CXX_SIMULATE_ID},MSVC>>>:-fno-exceptions -fno-rtti -Wall -Wextra -Werror -Wundef>
382+
$<$<NOT:$<OR:$<CXX_COMPILER_ID:MSVC>,$<STREQUAL:${CMAKE_CXX_SIMULATE_ID},MSVC>>>:-fno-rtti -Wall -Wextra -Werror -Wundef>
348383
$<$<CXX_COMPILER_ID:Clang>:-Wsign-conversion -Wconversion>)
349384
target_link_options(${name} PRIVATE
350385
$<$<BOOL:${SNMALLOC_LINKER_SUPPORT_NO_ALLOW_SHLIB_UNDEF}>:-Wl,--no-undefined>
@@ -465,32 +500,32 @@ if(NOT SNMALLOC_HEADER_ONLY_LIBRARY)
465500
if(SNMALLOC_OPTIMISE_FOR_CURRENT_MACHINE)
466501
check_cxx_compiler_flag(-march=native SUPPORT_MARCH_NATIVE)
467502
if (NOT SUPPORT_MARCH_NATIVE)
468-
message_once(WARNING "Compiler does not support `-march=native` required by SNMALLOC_OPTIMISE_FOR_CURRENT_MACHINE")
503+
message(WARNING "Compiler does not support `-march=native` required by SNMALLOC_OPTIMISE_FOR_CURRENT_MACHINE")
469504
set(SNMALLOC_OPTIMISE_FOR_CURRENT_MACHINE FALSE)
470505
endif()
471-
endif()
506+
endif()
472507

473508

474-
function(add_shim name type)
475-
add_library(${name} ${type} ${ARGN})
509+
function(compile name TYPE ${ARGN})
510+
add_library(${name} ${TYPE} ${ARGN})
476511
target_link_libraries(${name} snmalloc)
477-
set_target_properties(${name} PROPERTIES CXX_VISIBILITY_PRESET hidden INTERPROCEDURAL_OPTIMIZATION ${SNMALLOC_COMPILER_SUPPORT_IPO})
478512
target_compile_definitions(${name} PRIVATE "SNMALLOC_USE_${SNMALLOC_CLEANUP}")
479513

480-
if(MSVC)
481-
target_compile_definitions(${name} INTERFACE -D_HAS_EXCEPTIONS=0)
482-
endif()
483-
484514
add_warning_flags(${name})
485515
if(NOT MSVC)
486516
target_compile_definitions(${name} PRIVATE "SNMALLOC_EXPORT=__attribute__((visibility(\"default\")))")
487-
target_compile_options(${name} PRIVATE
488-
-fomit-frame-pointer -ffunction-sections)
517+
set_target_properties(${name} PROPERTIES CXX_VISIBILITY_PRESET hidden INTERPROCEDURAL_OPTIMIZATION ${SNMALLOC_COMPILER_SUPPORT_IPO})
518+
# Make debugging harder, and code faster.
519+
target_compile_options(${name} PRIVATE -fomit-frame-pointer)
520+
521+
set_property(TARGET ${name} PROPERTY POSITION_INDEPENDENT_CODE ON)
489522

523+
# Check for prefetch write support.
490524
check_cxx_compiler_flag("-Werror -Wextra -Wall -mprfchw" SUPPORT_PREFETCH_WRITE)
491525
if (SUPPORT_PREFETCH_WRITE)
492526
target_compile_options(${name} PRIVATE -mprfchw)
493527
endif()
528+
494529
# Static TLS model is unsupported on Haiku.
495530
if (SNMALLOC_STATIC_MODE_TLS)
496531
target_compile_options(${name} PRIVATE -ftls-model=initial-exec)
@@ -501,18 +536,8 @@ endif()
501536
target_compile_options(${name} PRIVATE -march=native)
502537
endif()
503538

504-
# Ensure that we do not link against C++ stdlib when compiling shims.
505-
# If the compiler supports excluding the C++ stdlib implementation, use
506-
# it. Otherwise, fall back to linking the library as if it were C, which
507-
# has roughly the same effect.
508-
if (NOT ${SNMALLOC_CLEANUP} STREQUAL CXX11_DESTRUCTORS)
509-
if (SNMALLOC_LINKER_SUPPORT_NOSTDLIBXX)
510-
target_link_options(${name} PRIVATE -nostdlib++)
511-
else()
512-
set_target_properties(${name} PROPERTIES LINKER_LANGUAGE C)
513-
endif()
514-
endif()
515539
# Remove all the duplicate new/malloc and free/delete definitions
540+
target_compile_options(${name} PRIVATE -ffunction-sections)
516541
target_link_options(${name} PRIVATE $<$<BOOL:${LLD_WORKS}>:$<$<BOOL:${SNMALLOC_LINK_ICF}>:-Wl,--icf=all> -fuse-ld=lld>)
517542
endif()
518543

@@ -521,55 +546,65 @@ endif()
521546
target_compile_definitions(${name} PRIVATE
522547
SNMALLOC_PAGEID=$<IF:$<BOOL:${SNMALLOC_PAGEID}>,true,false>)
523548

524-
install(TARGETS ${name} EXPORT snmallocConfig)
549+
if(MSVC)
550+
else()
551+
# We can't do --nostdlib++ as we are using exceptions, but we
552+
# can make it a static dependency, which we aren't really using
553+
# as the interesting stuff for exceptions is in libgcc_s
554+
target_link_options(${name} PRIVATE -static-libstdc++)
555+
endif()
525556

557+
if (SNMALLOC_RUST_LIBC_API)
558+
target_compile_definitions(${name} PRIVATE SNMALLOC_RUST_LIBC_API)
559+
endif()
560+
install(TARGETS ${name} EXPORT snmallocConfig)
526561
endfunction()
527562

528-
set(SHIM_FILES src/snmalloc/override/malloc.cc src/snmalloc/override/new.cc)
529-
set(SHIM_FILES_MEMCPY src/snmalloc/override/memcpy.cc)
563+
# Various files for overriding libc/rust behaviours.
564+
set(MALLOC src/snmalloc/override/malloc.cc)
565+
set(NEW src/snmalloc/override/new.cc)
566+
set(MEMCPY src/snmalloc/override/memcpy.cc)
567+
set(RUST src/snmalloc/override/rust.cc)
530568

531-
add_shim(snmalloc-new-override STATIC src/snmalloc/override/new.cc)
569+
set(ALLOC ${MALLOC} ${NEW})
570+
set(ALL ${ALLOC} ${MEMCPY})
532571

533572
if (SNMALLOC_STATIC_LIBRARY)
534-
add_shim(snmallocshim-static STATIC ${SHIM_FILES})
573+
compile(snmallocshim-static STATIC ${ALLOC})
535574
target_compile_definitions(snmallocshim-static PRIVATE
536575
SNMALLOC_STATIC_LIBRARY_PREFIX=${SNMALLOC_STATIC_LIBRARY_PREFIX})
537576
endif ()
538577

578+
compile(snmalloc-new-override STATIC ${NEW})
579+
539580
if(NOT WIN32)
540-
add_shim(snmallocshim SHARED ${SHIM_FILES})
581+
compile(snmallocshim SHARED ${ALLOC})
582+
541583
if (SNMALLOC_MEMCPY_OVERRIDE)
542-
add_shim(snmallocshim-checks-memcpy-only SHARED ${SHIM_FILES} ${SHIM_FILES_MEMCPY})
543-
add_shim(snmallocshim-checks SHARED ${SHIM_FILES} ${SHIM_FILES_MEMCPY})
584+
compile(snmallocshim-checks-memcpy-only SHARED ${ALL})
585+
compile(snmallocshim-checks SHARED ${ALL})
544586
else()
545-
add_shim(snmallocshim-checks SHARED ${SHIM_FILES})
587+
compile(snmallocshim-checks SHARED ${ALLOC})
546588
endif()
547589
target_compile_definitions(snmallocshim-checks PRIVATE SNMALLOC_CHECK_CLIENT)
590+
591+
compile(snmalloc-minimal SHARED ${MALLOC})
592+
target_compile_options(snmalloc-minimal PRIVATE -fno-exceptions)
593+
if (SNMALLOC_LINKER_SUPPORT_NOSTDLIBXX AND NOT ${SNMALLOC_CLEANUP} STREQUAL CXX11_DESTRUCTORS)
594+
target_compile_options(snmalloc-minimal PRIVATE -fno-exceptions -nostdlib++)
595+
endif ()
548596
endif()
549597

550598
if(SNMALLOC_RUST_SUPPORT)
551-
add_shim(snmallocshim-rust STATIC src/snmalloc/override/rust.cc)
552-
add_shim(snmallocshim-checks-rust STATIC src/snmalloc/override/rust.cc)
599+
compile(snmallocshim-rust STATIC ${RUST})
600+
compile(snmallocshim-checks-rust STATIC ${RUST})
553601
target_compile_definitions(snmallocshim-checks-rust PRIVATE SNMALLOC_CHECK_CLIENT)
554602
endif()
555603

556604
if (SNMALLOC_BUILD_TESTING)
557-
if (WIN32
558-
OR (CMAKE_SYSTEM_NAME STREQUAL NetBSD)
559-
OR (CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
560-
OR (CMAKE_SYSTEM_NAME STREQUAL SunOS))
561-
# Windows does not support aligned allocation well enough
562-
# for pass through.
563-
# NetBSD, OpenBSD and DragonFlyBSD do not support malloc*size calls.
564-
set(FLAVOURS fast;check)
565-
else()
566-
set(FLAVOURS fast;check;malloc)
567-
endif()
605+
set(FLAVOURS fast;check)
568606

569607
foreach(FLAVOUR ${FLAVOURS})
570-
if (${FLAVOUR} STREQUAL "malloc")
571-
set(DEFINES SNMALLOC_PASS_THROUGH)
572-
endif()
573608
if (${FLAVOUR} STREQUAL "check")
574609
set(DEFINES SNMALLOC_CHECK_CLIENT)
575610
endif()
@@ -599,7 +634,7 @@ endif()
599634

600635
foreach (MITIGATION ${MITIGATIONS})
601636
set(DEFINES "SNMALLOC_CHECK_CLIENT_MITIGATIONS=${MITIGATION}")
602-
add_shim(snmallocshim-${MITIGATION} SHARED ${SHIM_FILES})
637+
compile(snmallocshim-${MITIGATION} SHARED ${ALLOC})
603638
target_compile_definitions(snmallocshim-${MITIGATION} PRIVATE ${DEFINES})
604639
if (SNMALLOC_BUILD_TESTING)
605640
make_tests(${MITIGATION} ${DEFINES})
@@ -614,7 +649,7 @@ endif()
614649
set(MITIGATIONSET "${MITIGATIONSET}+${MITIGATION}")
615650
message(STATUS "MITIGATIONSET: ${COUNT} -> ${MITIGATIONSET}")
616651
set(DEFINES "-DSNMALLOC_CHECK_CLIENT_MITIGATIONS=${MITIGATIONSET}")
617-
add_shim(snmallocshim-${MITIGATIONNAME} SHARED ${SHIM_FILES})
652+
compile(snmallocshim-${MITIGATIONNAME} SHARED ${ALLOC})
618653
target_compile_definitions(snmallocshim-${MITIGATIONNAME} PRIVATE ${DEFINES})
619654
if (SNMALLOC_BUILD_TESTING)
620655
make_tests(${MITIGATIONNAME} ${DEFINES})
@@ -633,19 +668,24 @@ install(TARGETS EXPORT snmallocConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}
633668
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/snmalloc)
634669

635670
install(DIRECTORY src/snmalloc/aal DESTINATION include/snmalloc)
636-
install(DIRECTORY src/snmalloc/ds DESTINATION include/snmalloc)
637-
install(DIRECTORY src/snmalloc/override DESTINATION include/snmalloc)
638671
install(DIRECTORY src/snmalloc/backend DESTINATION include/snmalloc)
672+
install(DIRECTORY src/snmalloc/backend_helpers DESTINATION include/snmalloc)
673+
install(DIRECTORY src/snmalloc/ds DESTINATION include/snmalloc)
674+
install(DIRECTORY src/snmalloc/ds_aal DESTINATION include/snmalloc)
675+
install(DIRECTORY src/snmalloc/ds_core DESTINATION include/snmalloc)
676+
install(DIRECTORY src/snmalloc/global DESTINATION include/snmalloc)
639677
install(DIRECTORY src/snmalloc/mem DESTINATION include/snmalloc)
678+
install(DIRECTORY src/snmalloc/override DESTINATION include/snmalloc)
640679
install(DIRECTORY src/snmalloc/pal DESTINATION include/snmalloc)
680+
install(DIRECTORY src/snmalloc/stl DESTINATION include/snmalloc)
641681
install(FILES
642682
src/test/measuretime.h
643683
src/test/opt.h
644684
src/test/setup.h
645685
src/test/usage.h
646686
src/test/xoroshiro.h
647687
DESTINATION include/snmalloc/test
648-
)
688+
)
649689
install(FILES src/snmalloc/snmalloc.h;src/snmalloc/snmalloc_core.h;src/snmalloc/snmalloc_front.h DESTINATION include/snmalloc)
650690

651691
install(EXPORT snmallocConfig

3rdparty/exported/snmalloc/src/snmalloc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ These are arranged in a hierarchy such that each of the directories may include
2020
This includes data structures such as pagemap implementations (efficient maps from a chunk address to associated metadata) and buddy allocators for managing address-space ranges.
2121
- `backend/` provides some example implementations for snmalloc embeddings that provide a global memory allocator for an address space.
2222
Users may ignore this entirely and use the types in `mem/` with a custom back end to expose an snmalloc instance with specific behaviour.
23-
Layers above this can be used with a custom configuration by defining `SNMALLOC_PROVIDE_OWN_CONFIG` and exporting a type as `snmalloc::Alloc` that defines the type of an `snmalloc::LocalAllocator` template specialisation.
23+
Layers above this can be used with a custom configuration by defining `SNMALLOC_PROVIDE_OWN_CONFIG` and exporting a type as `snmalloc::Config` that defines the configuration.
2424
- `global/` provides some front-end components that assume that snmalloc is available in a global configuration.
2525
- `override/` builds on top of `global/` to provide specific implementations with compatibility with external specifications (for example C `malloc`, C++ `operator new`, jemalloc's `*allocx`, or Rust's `std::alloc`).
2626

3rdparty/exported/snmalloc/src/snmalloc/backend/backend.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ namespace snmalloc
5959

6060
if (p == nullptr)
6161
{
62-
errno = ENOMEM;
6362
return nullptr;
6463
}
6564

@@ -112,7 +111,6 @@ namespace snmalloc
112111

113112
if (meta == nullptr)
114113
{
115-
errno = ENOMEM;
116114
return {nullptr, nullptr};
117115
}
118116

@@ -124,7 +122,6 @@ namespace snmalloc
124122
if (p == nullptr)
125123
{
126124
local_state.get_meta_range().dealloc_range(meta_cap, meta_size);
127-
errno = ENOMEM;
128125
#ifdef SNMALLOC_TRACING
129126
message<1024>("Out of memory");
130127
#endif

3rdparty/exported/snmalloc/src/snmalloc/backend/fixedglobalconfig.h

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include "../backend_helpers/backend_helpers.h"
4+
#include "../mem/secondary/default.h"
45
#include "snmalloc/stl/type_traits.h"
56
#include "standard_range.h"
67

@@ -13,12 +14,14 @@ namespace snmalloc
1314
*/
1415
template<
1516
SNMALLOC_CONCEPT(IsPAL) PAL,
16-
typename ClientMetaDataProvider = NoClientMetaDataProvider>
17+
typename ClientMetaDataProvider = NoClientMetaDataProvider,
18+
typename SecondaryAllocator_ = DefaultSecondaryAllocator>
1719
class FixedRangeConfig final : public CommonConfig
1820
{
1921
public:
2022
using PagemapEntry = DefaultPagemapEntry<ClientMetaDataProvider>;
2123
using ClientMeta = ClientMetaDataProvider;
24+
using SecondaryAllocator = SecondaryAllocator_;
2225

2326
private:
2427
using ConcretePagemap =
@@ -41,7 +44,7 @@ namespace snmalloc
4144
public:
4245
using LocalState = StandardLocalState<PAL, Pagemap>;
4346

44-
using GlobalPoolState = PoolState<CoreAllocator<FixedRangeConfig>>;
47+
using GlobalPoolState = PoolState<Allocator<FixedRangeConfig>>;
4548

4649
using Backend =
4750
BackendAllocator<PAL, PagemapEntry, Pagemap, Authmap, LocalState>;
@@ -75,15 +78,6 @@ namespace snmalloc
7578
return opts;
7679
}();
7780

78-
// This needs to be a forward reference as the
79-
// thread local state will need to know about this.
80-
// This may allocate, so must be called once a thread
81-
// local allocator exists.
82-
static void register_clean_up()
83-
{
84-
snmalloc::register_clean_up();
85-
}
86-
8781
static void init(LocalState* local_state, void* base, size_t length)
8882
{
8983
UNUSED(local_state);

0 commit comments

Comments
 (0)