Only use MAP_JIT on Apple Silicon

MAP_JIT causes performance regression for fork()

See https://github.com/desktop/desktop/issues/12978
This commit is contained in:
mio 2022-01-18 21:01:49 +01:00
parent c84dbac9a8
commit 218bddc0e0
No known key found for this signature in database
GPG Key ID: DFF27E34A47CB873
1 changed files with 6 additions and 11 deletions

View File

@ -119,18 +119,13 @@ struct uc_struct;
* Only allow MAP_JIT for Mojave or later.
*
* Source: https://github.com/moby/hyperkit/pull/259/files#diff-e6b5417230ff2daff9155d9b15aefae12e89410ec2dca1f59d04be511f6737fcR41
*
* But using MAP_JIT causes performance regression for fork() so we only use MAP_JIT on Apple M1.
*
* Issue: https://github.com/desktop/desktop/issues/12978
*/
#if defined(__APPLE__)
#if defined(HAVE_PTHREAD_JIT_PROTECT)
#if defined(__APPLE__) && defined(HAVE_PTHREAD_JIT_PROTECT) && defined(__arm__)
#define USE_MAP_JIT
#else
#include <Availability.h>
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 && defined(MAP_JIT)
#define USE_MAP_JIT
#endif
#endif
#endif
#endif
#include <glib_compat.h>