Skip to content

Commit

Permalink
Re-enable FTL JIT on macOS
Browse files Browse the repository at this point in the history
Fixes #820
  • Loading branch information
mfikes committed Apr 27, 2019
1 parent b6a41a4 commit ac1904b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
18 changes: 15 additions & 3 deletions planck-c/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
#include <signal.h>
#include <sys/stat.h>

#ifdef __APPLE__
#include <mach-o/dyld.h>
#endif

#include "bundle.h"
#include "engine.h"
#include "globals.h"
Expand Down Expand Up @@ -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");
}

Expand Down

0 comments on commit ac1904b

Please sign in to comment.