An experimental project that hooks into Apple's Rosetta to replace x87 instruction handlers with faster implementations, and patches the translation pipeline to emit AArch64 instructions directly for improved performance.
- macOS 15 or later
- C compiler (clang)
- CMake
cmake -B build
cmake --build build
Tests and benchmarks are built automatically as part of the CMake build.
Run the test suite:
bash scripts/run_tests.sh # build + test (native Rosetta & runtime_loader)
bash scripts/run_tests.sh --no-build # skip build
bash scripts/run_tests.sh --native-only # native Rosetta only
bash scripts/run_tests.sh test_arith # run a specific testRun benchmarks (compares native Rosetta, loader with optimizations disabled, and loader with full optimizations):
bash scripts/run_benchmarks.sh # build + benchmark
bash scripts/run_benchmarks.sh --no-build # skip buildYou will see a popup asking you to authorize debugging. Once approved, the process is granted a debug session. Reference: Debugging tool entitlement
Alternatively (Not Recommended), you can disable Debugging Restrictions part of System Integrity Protection (SIP) by running csrutil enable --without debug in macOS Recovery.
Warning: This reduces system security. NOT recommended.
All flags are set via environment variables and read at runtime.
| Variable | Description |
|---|---|
ROSETTA_X87_FAST_ROUND=1 |
Skip rounding mode dispatch (faster but unsafe for FLDCW-heavy code) |
ROSETTA_X87_EXTENDED_FPR_SCRATCH=1 |
Expand FPR scratch register pool |
These flags are primarily useful for narrowing down bugs by selectively disabling features.
| Variable | Description |
|---|---|
ROSETTA_X87_DISABLE_CACHE=1 |
Disable x87 translation cache |
ROSETTA_X87_DISABLE_DEFERRED_FXCH=1 |
Disable deferred FXCH optimization |
ROSETTA_X87_DISABLE_IR=1 |
Disable IR optimization pipeline |
ROSETTA_X87_DISABLE_ALL_OPS=1 |
Disable all translated opcodes (fall back to Rosetta default) |
ROSETTA_X87_DISABLE_ALL_FUSIONS=1 |
Disable all instruction fusions |
ROSETTA_X87_DISABLE_OPS=op1,op2,... |
Disable specific opcodes (comma-separated) |
ROSETTA_X87_DISABLE_FUSIONS=f1,f2,... |
Disable specific fusions (comma-separated) |
ROSETTA_X87_LOGS=1 |
Enable verbose logging output from the loader |
ROSETTA_X87_FORCE_ATTACH=1 |
Always attach the debugger, bypassing the automatic x64 detection |
When used with Wine, runtime_loader automatically detects whether the Windows executable is 32-bit (x86) or 64-bit (x64) by reading its PE headers. 64-bit programs do not use x87 instructions, so the loader passes them through directly without attaching the debugger.
You can use the brew wine@devel cask with RosettaHack x87+JIT. It supports launching Windows applications through Wine with an environment variable ROSETTA_X87_PATH.
- Install
wine@develusing Homebrew
brew install --cask wine@devel- To permanently set the environment variable, add the following to your
~/.bashrcor~/.zshrcfile:
export ROSETTA_X87_PATH=/Path/To/runtime_loader- Run the Windows application
wine PATH_TO_BINARY.exeThis project is licensed under MIT.