merge from dev

This commit is contained in:
Daan 2025-05-04 19:55:35 -07:00
commit ccaa4a1de9
4 changed files with 10 additions and 7 deletions

View file

@ -282,8 +282,8 @@
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="mimalloc-lib.vcxproj"> <ProjectReference Include="mimalloc-override-dll.vcxproj">
<Project>{abb5eae7-b3e6-432e-b636-333449892ea6}</Project> <Project>{abb5eae7-b3e6-432e-b636-333449892ea7}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View file

@ -1078,8 +1078,8 @@ static inline uintptr_t _mi_random_shuffle(uintptr_t x) {
// --------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------
#if !MI_TRACK_ENABLED && defined(_WIN32) && (MI_ARCH_X64 || MI_ARCH_X86) #if !MI_TRACK_ENABLED && defined(_WIN32) && (MI_ARCH_X64 || MI_ARCH_X86)
extern bool _mi_cpu_has_fsrm; extern mi_decl_hidden bool _mi_cpu_has_fsrm;
extern bool _mi_cpu_has_erms; extern mi_decl_hidden bool _mi_cpu_has_erms;
static inline void _mi_memcpy(void* dst, const void* src, size_t n) { static inline void _mi_memcpy(void* dst, const void* src, size_t n) {
if ((_mi_cpu_has_fsrm && n <= 128) || (_mi_cpu_has_erms && n > 128)) { if ((_mi_cpu_has_fsrm && n <= 128) || (_mi_cpu_has_erms && n > 128)) {

View file

@ -209,7 +209,7 @@ static inline void mi_prim_tls_slot_set(size_t slot, void* value) mi_attr_noexce
#elif _WIN32 && MI_WIN_USE_FIXED_TLS && !defined(MI_WIN_USE_FLS) #elif _WIN32 && MI_WIN_USE_FIXED_TLS && !defined(MI_WIN_USE_FLS)
// On windows we can store the thread-local heap at a fixed TLS slot to avoid // On windows we can store the thread-local heap at a fixed TLS slot to avoid
// thread-local initialization checks in the fast path. // thread-local initialization checks in the fast path.
// We always use the second user TLS slot (the first one is always allocated already), // We always use the second user TLS slot (the first one is always allocated already),
// and at initialization (`windows/prim.c`) we call TlsAlloc and verify // and at initialization (`windows/prim.c`) we call TlsAlloc and verify
// we indeed get the second slot (and fail otherwise). // we indeed get the second slot (and fail otherwise).
@ -271,6 +271,9 @@ static inline void mi_prim_tls_slot_set(size_t slot, void* value) mi_attr_noexce
// defined in `init.c`; do not use these directly // defined in `init.c`; do not use these directly
#ifdef _MSC_VER
__declspec(selectany) // make it part of the comdat section to have faster TLS access (issue #1078)
#endif
extern mi_decl_hidden mi_decl_thread mi_heap_t* _mi_heap_default; // default heap to allocate from extern mi_decl_hidden mi_decl_thread mi_heap_t* _mi_heap_default; // default heap to allocate from
extern mi_decl_hidden bool _mi_process_is_initialized; // has mi_process_init been called? extern mi_decl_hidden bool _mi_process_is_initialized; // has mi_process_init been called?
@ -407,7 +410,7 @@ static inline mi_heap_t* mi_prim_get_default_heap(void) {
#elif defined(MI_TLS_PTHREAD) #elif defined(MI_TLS_PTHREAD)
extern pthread_key_t _mi_heap_default_key; extern mi_decl_hidden pthread_key_t _mi_heap_default_key;
static inline mi_heap_t* mi_prim_get_default_heap(void) { static inline mi_heap_t* mi_prim_get_default_heap(void) {
mi_heap_t* heap = (mi_unlikely(_mi_heap_default_key == (pthread_key_t)(-1)) ? _mi_heap_main_get() : (mi_heap_t*)pthread_getspecific(_mi_heap_default_key)); mi_heap_t* heap = (mi_unlikely(_mi_heap_default_key == (pthread_key_t)(-1)) ? _mi_heap_main_get() : (mi_heap_t*)pthread_getspecific(_mi_heap_default_key));
return (mi_unlikely(heap == NULL) ? (mi_heap_t*)&_mi_heap_empty : heap); return (mi_unlikely(heap == NULL) ? (mi_heap_t*)&_mi_heap_empty : heap);

View file

@ -112,7 +112,7 @@ static bool mi_page_is_valid_init(mi_page_t* page) {
return true; return true;
} }
extern bool _mi_process_is_initialized; // has mi_process_init been called? extern mi_decl_hidden bool _mi_process_is_initialized; // has mi_process_init been called?
bool _mi_page_is_valid(mi_page_t* page) { bool _mi_page_is_valid(mi_page_t* page) {
mi_assert_internal(mi_page_is_valid_init(page)); mi_assert_internal(mi_page_is_valid_init(page));