@@ -19,6 +19,7 @@ option(MI_SEE_ASM "Generate assembly files" OFF)
1919option (MI_OSX_INTERPOSE "Use interpose to override standard malloc on macOS" ON )
2020option (MI_OSX_ZONE "Use malloc zone to override standard malloc on macOS" ON )
2121option (MI_WIN_REDIRECT "Use redirection module ('mimalloc-redirect') on Windows if compiling mimalloc as a DLL" ON )
22+ option (MI_WIN_USE_FIXED_TLS "Use a fixed TLS slot on Windows to avoid extra tests in the malloc fast path" OFF )
2223option (MI_LOCAL_DYNAMIC_TLS "Use local-dynamic-tls, a slightly slower but dlopen-compatible thread local storage mechanism (Unix)" OFF )
2324option (MI_LIBC_MUSL "Set this when linking with musl libc" OFF )
2425option (MI_BUILD_SHARED "Build shared library" ON )
@@ -35,7 +36,7 @@ option(MI_NO_THP "Disable transparent huge pages support on Linux/And
3536option (MI_EXTRA_CPPDEFS "Extra pre-processor definitions (use as `-DMI_EXTRA_CPPDEFS=\" opt1=val1;opt2=val2\" `)" "" )
3637
3738# deprecated options
38- option (MI_WIN_USE_FLS "Use Fiber local storage on Windows to detect thread termination" OFF )
39+ option (MI_WIN_USE_FLS "Use Fiber local storage on Windows to detect thread termination (deprecated) " OFF )
3940option (MI_CHECK_FULL "Use full internal invariant checking in DEBUG mode (deprecated, use MI_DEBUG_FULL instead)" OFF )
4041option (MI_USE_LIBATOMIC "Explicitly link with -latomic (on older systems) (deprecated and detected automatically)" OFF )
4142
@@ -90,7 +91,7 @@ endif()
9091
9192if (CMAKE_GENERATOR MATCHES "^Visual Studio.*$" )
9293 message (STATUS "Note: when building with Visual Studio the build type is specified when building." )
93- message (STATUS "For example: 'cmake --build . --config=Release" )
94+ message (STATUS "For example: 'cmake --build . --config=Release" )
9495endif ()
9596
9697if ("${CMAKE_BINARY_DIR} " MATCHES ".*(S|s)ecure$" )
@@ -322,10 +323,15 @@ if(MI_LIBC_MUSL)
322323endif ()
323324
324325if (MI_WIN_USE_FLS)
325- message (STATUS "Use the Fiber API to detect thread termination (MI_WIN_USE_FLS=ON)" )
326+ message (STATUS "Use the Fiber API to detect thread termination (deprecated) ( MI_WIN_USE_FLS=ON)" )
326327 list (APPEND mi_defines MI_WIN_USE_FLS=1)
327328endif ()
328329
330+ if (MI_WIN_USE_FIXED_TLS)
331+ message (STATUS "Use fixed TLS slot on Windows to avoid extra tests in the malloc fast path (MI_WIN_USE_FIXED_TLS=ON)" )
332+ list (APPEND mi_defines MI_WIN_USE_FIXED_TLS=1)
333+ endif ()
334+
329335# Determine architecture
330336set (MI_OPT_ARCH_FLAGS "" )
331337set (MI_ARCH "unknown" )
@@ -543,7 +549,7 @@ if(MI_BUILD_SHARED)
543549 elseif (MI_ARCH STREQUAL "x64" )
544550 set (MIMALLOC_REDIRECT_SUFFIX "" )
545551 if (CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64" )
546- message (STATUS "Note: x64 code emulated on Windows for arm64 should use an arm64ec build of 'mimalloc-override.dll'" )
552+ message (STATUS "Note: x64 code emulated on Windows for arm64 should use an arm64ec build of 'mimalloc-override.dll'" )
547553 message (STATUS " with 'mimalloc-redirect-arm64ec.dll'. See the 'bin\\ readme.md' for more information." )
548554 endif ()
549555 elseif (MI_ARCH STREQUAL "x86" )
@@ -667,7 +673,7 @@ endif()
667673# -----------------------------------------------------------------------------
668674if (MI_OVERRIDE)
669675 if (MI_BUILD_SHARED)
670- target_compile_definitions (mimalloc PRIVATE MI_MALLOC_OVERRIDE)
676+ target_compile_definitions (mimalloc PRIVATE MI_MALLOC_OVERRIDE)
671677 endif ()
672678 if (NOT WIN32 )
673679 # It is only possible to override malloc on Windows when building as a DLL.
0 commit comments