// the find
tenderlove/tenderjit
JIT for Ruby that is written in Ruby
TenderJIT is Aaron Patterson's experimental JIT compiler for Ruby, written in Ruby itself. It translates YARV bytecode to native x86-64 or ARM64 machine code using Fiddle for FFI and a custom IR with register allocation. It's a learning project first, production runtime second — explicitly modeled after YJIT but built to understand JIT construction, not to ship.
The IR pipeline is legitimately well-structured: SSA-style intermediate representation, a proper interference graph for register allocation, and lazy basic block versioning borrowed from academic work (Chevalier-Boisvert's LBBV paper). The test suite covers nearly every YARV opcode individually, which is more than most experimental runtimes bother with. Supporting both x86-64 and ARM64 backends from a shared IR is non-trivial and they got it working. Reading this alongside YJIT's Rust source is one of the better ways to understand what a Ruby JIT actually does.
Last commit is January 2024 and it was already dormant before that — YJIT shipped in mainline Ruby and ate this project's reason to exist. It still requires manual `jit.compile(method(:foo))` calls rather than automatic compilation triggers, which means you can't just drop it in and get speedups. It only targets Ruby 3.0.x; the YARV bytecode format has moved and it won't run on anything modern without porting work. As a learning resource it's excellent, but anyone hoping to use this in a real app is going to be disappointed.