diff options
author | Daan Leijen <daan@microsoft.com> | 2021-01-29 16:53:52 -0800 |
---|---|---|
committer | Daan Leijen <daan@microsoft.com> | 2021-01-29 16:53:52 -0800 |
commit | b93cba3b053da44eea9b7b7c2253d1fc79bc820c (patch) | |
tree | 81f7f195a715e5484a8bb825df205eeb62e59e89 /include/mimalloc-internal.h | |
parent | 3bade4b1bd96ea4d815f2bb40082ff38164354e5 (diff) | |
parent | 92ec493a5d8108cf864f183805d1720242f0e863 (diff) |
merge from dev
Diffstat (limited to 'include/mimalloc-internal.h')
-rw-r--r-- | include/mimalloc-internal.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/include/mimalloc-internal.h b/include/mimalloc-internal.h index 15c1e55..574e5bd 100644 --- a/include/mimalloc-internal.h +++ b/include/mimalloc-internal.h @@ -50,8 +50,8 @@ uintptr_t _os_random_weak(uintptr_t extra_seed); static inline uintptr_t _mi_random_shuffle(uintptr_t x); // init.c -extern mi_stats_t _mi_stats_main; -extern const mi_page_t _mi_page_empty; +extern mi_decl_cache_align mi_stats_t _mi_stats_main; +extern mi_decl_cache_align const mi_page_t _mi_page_empty; bool _mi_is_main_thread(void); bool _mi_preloading(); // true while the C runtime is not ready @@ -180,6 +180,21 @@ bool _mi_page_is_valid(mi_page_t* page); #endif +// ----------------------------------------------------------------------------------- +// On windows x86/x64 with msvc/clang-cl, use `rep movsb` for `memcpy` (issue #201) +// ----------------------------------------------------------------------------------- + +#if defined(_WIN32) && (defined(_M_IX86) || defined(_M_X64)) +#include <intrin.h> +static inline void _mi_memcpy_rep_movsb(void* d, const void* s, size_t n) { + __movsb((unsigned char*)d, (const unsigned char*)s, n); +} +#define _mi_memcpy(d,s,n) _mi_memcpy_rep_movsb(d,s,n) +#else +#define _mi_memcpy(d,s,n) memcpy(d,s,n) +#endif + + /* ----------------------------------------------------------- Inlined definitions ----------------------------------------------------------- */ |