Hasty Briefsbeta

Bilingual

A tail-call interpreter in (nightly) Rust

20 hours ago
  • #Tail-Call Optimization
  • #Performance
  • #Rust
  • Using Rust's nightly become keyword to implement a tail-call interpreter for Uxn CPU emulation.
  • Tail-call interpreter outperforms previous Rust and ARM64 assembly implementations on ARM64.
  • Performance on x86-64 is worse than assembly backend, especially in Fibonacci microbenchmark.
  • WebAssembly performance with tail calls is significantly worse than VM interpreter.
  • Implementation involves storing VM state in function arguments and ending each function with a call to the next.
  • Macro used to reduce boilerplate in defining tail-call functions.
  • Codegen analysis shows good optimization on ARM64 but suboptimal on x86-64 with register spills.
  • Tail-call interpreter is merged and released, with defaults based on architecture.