diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cbf704a..a2d6f6bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ All notable changes to this project will be documented in this file. This change - Add -keep-gcl option to the clean script - Ignore `*.swp` files +### Changed +- Re-enable FTL JIT on macOS ([#820](https://github.com/planck-repl/planck/issues/820)) + ### Fixed - Switch `strncpy` to `memcpy` to avoid GCC warning - Backslash return return should produce "\n" ([661](https://github.com/planck-repl/planck/issues/661)) diff --git a/planck-c/main.c b/planck-c/main.c index 59e08d0d..da239ea3 100644 --- a/planck-c/main.c +++ b/planck-c/main.c @@ -9,6 +9,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + #include "bundle.h" #include "engine.h" #include "globals.h" @@ -315,10 +319,18 @@ bool should_ignore_arg(const char *opt) { void control_FTL_JIT() { - // Recent versions of JavaScriptCore are crashing in FTL JIT. - // Disable FTL JIT if JSC_useFTLJIT env var not set. + // Older versions of JavaScriptCore were crashing in FTL JIT. + // Disable FTL JIT if older version on macOS or on Unix and + // JSC_useFTLJIT env var not set. + +#ifdef __APPLE__ + int32_t jsc_version = NSVersionOfLinkTimeLibrary("JavaScriptCore"); + bool check_env = (jsc_version < 0x25f0128); +#else + bool check_env = true; +#endif - if (getenv("JSC_useFTLJIT") == NULL) { + if (check_env && getenv("JSC_useFTLJIT") == NULL) { putenv("JSC_useFTLJIT=false"); }