MEP-42 Phase 1: Naive Backend Recommendation
One-paragraph recommendation, plus reasoning, for which naive-emission technique Mochi MEP-42 should adopt as the first cut.
10 notes
One-paragraph recommendation, plus reasoning, for which naive-emission technique Mochi MEP-42 should adopt as the first cut.
A 14k-LOC SSA compiler backend by Quentin Carbonneaux that targets x86-64, arm64, and riscv64 from a textual SSA IR. The "70% of LLVM in 10% of the code" pitch. The natural fallback if writing our own emitter feels too risky.
Rui Ueyama's ~10k LOC C compiler that emits x86-64 GAS assembly directly from a recursive-descent parser. The clearest published example of a single-pass codegen pipeline that produces correct code with no IR, no SSA, no register allocator. The right educational template for a "naive AOT" pass of MEP-42.
The general pattern that Sparkplug, Liftoff, JSC Baseline, and the HotSpot template interpreter all instantiate. Per-op native template, fixed register convention, stub calls for slow paths, optional inline caches as patchable code regions. Specifically considered here as an engineering implementation in pure Go without cgo.
A converged design pattern across three independent implementations: per-opcode template emission, a virtual operand stack with lazy register promotion, no IR, no global optimization. The current state of the art in "fast and simple" Wasm code generation.
Tree-walk to tuples to native assembly. The textbook recipe from the Dragon Book and Cooper/Torczon, still the right starting point when you want correctness before performance.
Stencil-driven code generation that harvests pre-compiled opcode snippets at build time and stitches them into native code at runtime via relocation patches. No IR, no register allocator, no instruction selector. The technique CPython 3.13+ ships in production.
Apple WebKit's original template-style baseline compiler, the longest-running production baseline JIT for a dynamic language, and the design template for every modern four-tier VM.
A single-pass, IR-free transpiler from Ignition bytecode to native machine code, designed to add a fast tier between an interpreter and an optimizer with minimal engineering cost.
Sparkplug, JSC Baseline, copy-and-patch (Xu+Kjolstad PLDI 2021), single-pass classic, Wasm baseline, per-opcode template JIT, chibicc walkthrough, QBE for naive emit.