FrostJIT: how bifrost-emu runs ARM64 code on an x86_64 PC
A phone game is machine code for ARM64 processors, which a PC's x86_64 processor cannot run. FrostJIT, bifrost-emu's just-in-time compiler, translates that code into native x86_64 code while the game runs, keeps the translation and reuses it. Your PC then runs mostly its own code, instead of interpreting the game one ARM instruction at a time.
From ARM64 to x86_64
The first time a piece of code runs, it goes through these steps once. After that, the translated code runs directly.
- ARM64 codeThe game's own machine code, read from its files.
- DecodeEach instruction is read by the decoder the interpreter also uses.
- Typed IRAn intermediate form where values are tracked and simplified.
- x86_64 codeRegisters are assigned and native PC instructions written.
- Chained blocksTranslated blocks jump straight to each other.
An interpreter runs anything the JIT does not translate, and it is the reference the JIT is checked against. The JIT guide maps each step to its source.
What makes it fast
Translated once, run many times
Code is compiled in blocks of up to 32 instructions (a loop body up to 64) the first time it runs, and kept in a code cache. Several threads of a game can translate at the same time.
Blocks jump to each other
A translated block jumps straight into the next one. Returns and other computed jumps go through a per-thread lookup table, not back through the emulator.
Values stay in registers
Loop counters and hot values stay in the PC's registers across loop iterations, past branches and from one block to the next, and ARM condition flags stay in the PC's own flags wherever the next instruction can use them.
Native vector and float math
ARM NEON and floating-point instructions become SSE and AVX instructions. The JIT needs SSE4.1 and FMA3, and uses AVX2 and other extensions where your CPU has them.
One cache for every thread
A game's threads share one JIT. A full code cache (512 MiB by default) is replaced as a whole and the old code freed once no thread can still be running it.
Warm helper processes
Android starts an app's helper processes by forking a prepared process. Each child keeps the parent's translations, so it starts out running native code.
Experimental and off by default: a disk cache that reuses translations from an earlier launch.
How fast
CoreMark, an integer and control-flow benchmark, measured on a Ryzen 7 5800X3D (November 29, 2026): the current build runs 2.8 times as many iterations per second as QEMU's user-mode emulator, and 56% of what the same program does when it is compiled for the PC itself.
| Build | Iterations per second |
|---|---|
Native x86_64 (gcc 16.2.1, -O2) | 38,647 |
| bifrost-emu 2.0.0-rc.2 (JIT) | 21,768 |
| bifrost-emu 2.0.0-rc.1 (JIT) | 19,821 |
| bifrost-emu 2.0.0-beta.3 (JIT, headless build) | 14,898 |
| QEMU 11.1.3 user mode (TCG) | 7,648 |
CoreMark with several threads (iterations per second, all threads together)
| Threads | Native | bifrost-emu | QEMU | bifrost-emu / native |
|---|---|---|---|---|
| 1 | 38,647 | 19,133 | 7,648 | 50% |
| 2 | 76,967 | 34,916 | 16,071 | 45% |
| 4 | 151,774 | 68,021 | 31,713 | 45% |
| 8 | 297,122 | 130,007 | 61,101 | 44% |
| 16 | 404,756 | 136,246 | 67,004 | 34% |
The same programs with and without the JIT
| Benchmark | Interpreter | JIT | Speedup |
|---|---|---|---|
| fib(35) | 6.74 s | 0.056 s | ~120x |
| memcpy 256 MiB | 202 MiB/s | ~12,750 MiB/s | ~63x |
| qsort 100K ints | 4.25 s | 0.063 s | ~67x |
| matrix 256×256 | 12.0 MFLOPS | ~1,286 MFLOPS | ~107x |
| bench_mips (800M instructions) | ~53 MIPS | ~4,545 MIPS | ~86x |
From the performance page in the repository, where the method and its limits are written down. Neither
benchmark predicts a game's frame rate, and differences of a few percent are within the noise of these runs. Run them
yourself with Scripts/Bench/run_benchmarks.py.
Correct first, then fast
Checked against a reference
A verification mode runs each translated block next to the interpreter and compares the results, and many of the tests' expected results were checked under QEMU.
Exact faults
When guest code touches memory it must not, the game's own crash handler sees exactly the state an ARM CPU would show at that instruction. Android's runtime relies on it.
ARM floating-point rules
NaN results, signed zeros and fused multiply-adds follow ARM's rules, not x86's, so math gives the same answers as on a phone.
Read more
The JIT guide describes how it works for contributors, and its history records each change with its measurements. The JIT needs an x86_64 CPU with SSE4.1 and FMA3; see the install page.