Research substrate for Mochi MEP-42 (May 2026). A 73-file deep dive into how managed-language runtimes lower typed IR to native machine code: code generation backends, AOT case studies, naive emission techniques, target ISAs and ABIs, object formats, linkers, runtime and libc, debug info, and recent PLDI/POPL papers.
Background research for Mochi MEP-42: the native-codegen positioning that pairs a copy-and-patch JIT (Xu+Kjolstad PLDI 2021, validated by CPython 3.13 in October 2024) for mochi run hot loops with a C-as-target AOT pipeline (Nim / V / Vala lineage) for mochi build distributables.
Each subsection drills into one thread of the 2024-2026 native-codegen landscape. Every file has a §1 Provenance with canonical URLs, a §2 Mechanism, a §3 status as of May 2026, a Mochi adaptation note, and open questions.
Sections
- Backends — LLVM 20, Cranelift, QBE, MIR, libgccjit, copy-and-patch, DynASM, golang-asm, MLIR, C-as-target, TCC/chibicc, Wasmtime AOT.
- AOT case studies — GraalVM Native Image, .NET NativeAOT, Zig, Crystal, Nim, Hare, V, Julia, Mojo, GHC NCG, Embedded Swift, Static Python.
- Naive emission — Sparkplug, JSC Baseline, copy-and-patch, single-pass classic, Wasm baseline, per-op template JIT, chibicc, QBE for naive.
- Targets — x86_64, AArch64, RISC-V 64, Wasm 3.0, other ISAs.
- Formats — ELF, Mach-O, PE/COFF, Wasm module, APE / Cosmopolitan.
- Linkers — LLD, mold, Apple ld_prime, GNU ld + gold, no-linker path.
- Runtime — musl, glibc, Cosmopolitan libc, Go runtime, freestanding, universal binaries, static-PIE, signing.
- Debug — DWARF 5, CodeView / PDB, source maps for Wasm.
- Papers — PLDI 2024-2025, POPL 2024-2025, MLIR dialects, Cranelift design, textbooks, compile-time vs runtime tradeoff.