Lunacy - Lua 5.1 interpreter with Lazy Basic Block Versioning and JIT
Summary
The article presents Lunacy, a Lua 5.1 interpreter implemented in Rust that employs Lazy Basic Block Versioning (LBBV) with a JIT. It contrasts Lunacy’s interpreter-first design with Higgs’ pure-JIT approach, describing how coroutines and a closure-generating interpreter drive both interpretation and JIT, and detailing runtime residuals, type specialization, and table/shapes handling. Performance results show modest gains over Lua in some benchmarks and highlight current limitations and future optimization ideas.