Merge pull request #3570 from bylaws/ec_pt8

Enable jemalloc for ARM64EC
This commit is contained in:
Ryan Houdek 2024-04-11 12:57:36 -07:00 committed by GitHub
commit a9b7ad841c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 13 deletions

View File

@ -124,6 +124,9 @@ endif()
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm64ec")
set(_M_ARM_64EC 1)
add_definitions(-D_M_ARM_64EC=1)
# Required as FEX is not allowed to lock the CRT heap lock during compilation or callbacks
set(ENABLE_JEMALLOC TRUE)
endif()
if (ENABLE_CCACHE)

2
External/jemalloc vendored

@ -1 +1 @@
Subproject commit 16f80619558c44c917695228e00c1a7ec1b2b752
Subproject commit 569545241370457e2d14b0458b0ae9261491ea83

View File

@ -90,7 +90,18 @@ namespace FEXCore::Allocator {
#endif
// Memory allocation routines aliased to jemalloc functions.
#ifdef _WIN32
#ifdef ENABLE_JEMALLOC
inline void *malloc(size_t size) { return ::je_malloc(size); }
inline void *calloc(size_t n, size_t size) { return ::je_calloc(n, size); }
inline void *memalign(size_t align, size_t s) { return ::je_memalign(align, s); }
inline void *valloc(size_t size) { return ::je_valloc(size); }
inline int posix_memalign(void** r, size_t a, size_t s) { return ::je_posix_memalign(r, a, s); }
inline void *realloc(void* ptr, size_t size) { return ::je_realloc(ptr, size); }
inline void free(void* ptr) { return ::je_free(ptr); }
inline size_t malloc_usable_size(void *ptr) { return ::je_malloc_usable_size(ptr); }
inline void *aligned_alloc(size_t a, size_t s) { return ::je_aligned_alloc(a, s); }
inline void aligned_free(void* ptr) { return ::je_free(ptr); }
#elif defined(_WIN32)
inline void *malloc(size_t size) { return ::malloc(size); }
inline void *calloc(size_t n, size_t size) { return ::calloc(n, size); }
inline void *memalign(size_t align, size_t s) { return ::_aligned_malloc(s, align); }
@ -110,17 +121,6 @@ namespace FEXCore::Allocator {
inline size_t malloc_usable_size(void *ptr) { return ::_msize(ptr); }
inline void *aligned_alloc(size_t a, size_t s) { return ::_aligned_malloc(s, a); }
inline void aligned_free(void* ptr) { return ::_aligned_free(ptr); }
#elif defined(ENABLE_JEMALLOC)
inline void *malloc(size_t size) { return ::je_malloc(size); }
inline void *calloc(size_t n, size_t size) { return ::je_calloc(n, size); }
inline void *memalign(size_t align, size_t s) { return ::je_memalign(align, s); }
inline void *valloc(size_t size) { return ::je_valloc(size); }
inline int posix_memalign(void** r, size_t a, size_t s) { return ::je_posix_memalign(r, a, s); }
inline void *realloc(void* ptr, size_t size) { return ::je_realloc(ptr, size); }
inline void free(void* ptr) { return ::je_free(ptr); }
inline size_t malloc_usable_size(void *ptr) { return ::je_malloc_usable_size(ptr); }
inline void *aligned_alloc(size_t a, size_t s) { return ::je_aligned_alloc(a, s); }
inline void aligned_free(void* ptr) { return ::je_free(ptr); }
#else
inline void *malloc(size_t size) { return ::malloc(size); }
inline void *calloc(size_t n, size_t size) { return ::calloc(n, size); }