brain

tamnd's digital brain — notes, problems, research

42734 notes

APE (Actually Portable Executable) and Cosmopolitan Libc

A single binary that is simultaneously a valid ELF, Mach-O, PE, and BSD a.out.

native-codegenformats
GHC NCG and the LLVM Backend Choice

The Glasgow Haskell Compiler's native code generator: hand-written, x86_64 / aarch64 / risc-v, alongside an LLVM alternative.

native-codegenaot
ELF (Executable and Linkable Format)

The universal Unix object/executable format: Linux, *BSD, Solaris, Haiku, embedded.

native-codegenformats
Static Python, Cinder, and CPython's Copy-and-Patch JIT

Meta's typed Python subset that can be AOT-aware, the Cinder JIT, and CPython 3.13+'s experimental copy-and-patch JIT.

native-codegenaot
Targets Summary

Single-page roll-up of every (target ISA x OS) combination Mochi MEP-42 could ship, with status and engineering complexity recommendations.

native-codegentargets
WebAssembly Module Binary Format

The .wasm container, plus the component model binary and WAT text format.

native-codegenformats
Cranelift Internals: ISLE, Proof-Carrying Code, and the Portable Backend Story

The most actively researched mid-tier compiler backend of the 2020s. ISLE for instruction selection, proof-carrying code for Wasm-sandbox memory accesses, and VeriISLE for verified instruction-lowering rules.

native-codegenpapers
Swift and Embedded Swift

Apple's Swift in two modes: full LLVM-driven AOT for app platforms, and a stripped Embedded Swift mode for microcontrollers and freestanding binaries.

native-codegenaot
DWARF 5 (and the DWARF 6 draft)

The cross-platform binary debug format, its current standard, and where the next version is going.

native-codegendebug
MLIR Dialect Literature 2023-2026

The Triton dialect (OpenAI, GPU codegen), the IREE dialect (Google, ML compiler), Mojo's MLIR-based KGEN compiler, and the broader trend of language frontends as MLIR dialects. The "if we wanted to be ambitious" backend story for Mochi.

native-codegenpapers
POPL 2024 and 2025: Compiler-Construction Papers

Recent foundational work from POPL and its co-located CPP (Certified Programs and Proofs) workshop on verified compilation, secure calling conventions, and packet-filter codegen.

native-codegenpapers
TCC, chibicc, Cuik as Reference Points for Mochi

"How small can a useful native backend be?"

native-codegenbackends
C as a Code-Generation Backend for Mochi

The lowest-cognitive-load path: emit C, let GCC/Clang do the rest.

native-codegenbackends
Wasmtime AOT as a Code-Generation Backend for Mochi

"Mochi → Wasm → wasmtime compile → native": skip the backend, use the wasm ecosystem.

native-codegenbackends
MLIR as a Code-Generation Backend for Mochi

Multi-Level IR, dialect framework, the foundation under Mojo, IREE, and OpenXLA.

native-codegenbackends
PLDI 2024 and 2025: Relevant Code-Generation Papers

Recent work from the flagship PL conference on lightweight backends, baseline JIT design, superoptimization for stack bytecode, and library composition that sidesteps heavyweight compilation.

native-codegenpapers
Freestanding / no-libc

Direct syscalls on Linux, why this is impossible on macOS, and the APE alternative.

native-codegenruntime
Nim

Static, GC-by-default systems language that emits C (or C++, JavaScript, LLVM) and inherits the host toolchain's optimiser.

native-codegenaot
Julia

JIT-first scientific language adding a real AOT path via juliac and a trimming-based static binary mechanism.

native-codegenaot
Hare

Tiny systems language built on QBE, deliberately constrained, BSD/Linux-only, manual memory.

native-codegenaot
The Go Runtime as a Library

cgo, c-shared, c-archive: keep vm3 in Go and call into it from native code.

native-codegenruntime
Cosmopolitan Libc

One binary, six operating systems, two ISAs. The APE format and cosmocc toolchain.

native-codegenruntime
V Language

Statically-typed Go-influenced language that defaults to emitting C, with experimental native and LLVM backends and a multi-mode memory model.

native-codegenaot
QBE as a Naive-But-Good-Enough Backend

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.

native-codegennaive
golang-asm as a Code-Generation Backend for Mochi

Go's internal assembler exported as a library, already used by Mochi's vm2jit.

native-codegenbackends
chibicc: A Minimal C Compiler as a Mochi Backend Reference

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.

native-codegennaive
DynASM as a Code-Generation Backend for Mochi

Mike Pall's preprocessor-driven assembler with runtime patching; LuaJIT's secret weapon.

native-codegenbackends
libgccjit as a Code-Generation Backend for Mochi

GCC as a shared library, used by Emacs native compilation, GCC Rust, GDC, Cython.

native-codegenbackends
Copy-and-Patch as a Code-Generation Backend for Mochi

Stencil-based binary stitching from OOPSLA 2021, now shipping in CPython 3.13/3.14.

native-codegenbackends
glibc

The default Linux libc, and the reasons "fully static linking" is officially unsupported.

native-codegenruntime
RISC-V RV64GC

The general-purpose 64-bit RISC-V baseline plus vector and recent extensions.

native-codegentargets
The Per-Opcode Template JIT Pattern

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.

native-codegennaive
musl libc

The static-friendly C library that makes "build once, ship anywhere" actually work on Linux.

native-codegenruntime
Wasm Baseline Compilers: Liftoff, RabaldrMonkey, Winch

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.

native-codegennaive
WebAssembly

Wasm 3.0 (2025) as the stable target, plus WASI Preview 2/3 and the component model.

native-codegentargets
Other ISAs: PowerPC, MIPS, LoongArch, s390x, Apple GPU/Metal

Survey of niche or specialized architectures that MEP-42 should be aware of but probably defer.

native-codegentargets
AArch64 Windows (Windows-on-ARM64)

Windows 11 on Snapdragon X / X2 Elite, Surface Pro X lineage, and ARM64EC interop.

native-codegentargets
Skipping the Linker Entirely

Emitting a self-contained executable from the compiler, no external linker required.

native-codegenlinkers
Zig Self-Hosted Compiler

Systems language rebuilding its compiler around its own native backends, with LLVM demoted to an optional path.

native-codegenaot
Crystal

Ruby-syntax statically-typed language with global type inference, LLVM backend, and Boehm GC.

native-codegenaot
GraalVM Native Image

Closed-world AOT compilation that turns a managed JVM application into a self-contained native executable.

native-codegenaot
.NET NativeAOT

Microsoft's production successor to CoreRT: trimmed CoreCLR plus RyuJIT-as-AOT, shipping single-file native binaries.

native-codegenaot
Classical Single-Pass 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.

native-codegennaive
Copy-and-Patch Compilation

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.

native-codegennaive
GNU ld (bfd) and gold

The historical Linux workhorse and its dying sibling.

native-codegenlinkers
LLVM as a Code-Generation Backend for Mochi

The workhorse SSA infrastructure, version 20 era, evaluated for MEP-42.

native-codegenbackends
MIR as a Code-Generation Backend for Mochi

Vladimir Makarov's lightweight JIT+AOT, fast compile times, lazy basic-block versioning.

native-codegenbackends
Cranelift as a Code-Generation Backend for Mochi

Bytecode Alliance's Rust-native SSA backend, ISLE-driven, ~10x faster compile than LLVM.

native-codegenbackends
QBE as a Code-Generation Backend for Mochi

Quentin Carbonneaux's deliberately tiny SSA backend, "70% of LLVM in 10% of the code."

native-codegenbackends
Apple's New Linker (ld_prime / ld_new)

The closed-source Mach-O linker that ships in Xcode 15 and later.

native-codegenlinkers
x86_64 System V AMD64 ABI

The default 64-bit Unix ABI: Linux, macOS, FreeBSD, OpenBSD, NetBSD, illumos.

native-codegentargets
AArch64 AAPCS64

The base 64-bit Arm calling standard, with Apple and Microsoft deltas called out.

native-codegentargets
x86_64 Windows (Microsoft x64) ABI

The 4-register fast-call convention used by every Windows-on-AMD64 binary.

native-codegentargets
Sparkplug: V8's Non-Optimizing Baseline JavaScript Compiler

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.

native-codegennaive
JavaScriptCore Baseline JIT

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.

native-codegennaive
mold: The Modern Linker

The fastest production ELF linker, single-author, MIT licensed.

native-codegenlinkers
LLD: The LLVM Linker

One binary, four object formats, cross-link from any host.

native-codegenlinkers
Chrome Memory-Safety Data and the Rust-in-Chrome Rollout

Chrome Security's published per-quarter memory-safety data for 2024-2026, the JSON / PNG / fonts Rust rollouts, and the V8 sandbox.

memory-safetyindustry
MTE in a Managed Runtime

MTE in a Managed Runtime

memory-safetyhardware
Inko — Singly-Owned Values

Single ownership with deterministic destruction, multiple simultaneous borrows allowed, runtime borrow-count enforcement. No GC, no compile-time borrow checker, no lifetime variables. Concurrency uses `uni T` (unique values) for safe inter-process transfer.

memory-safetyownership
Mojo (2026)

A Rust-like ownership system with simpler call-site syntax, taped onto a Python-shaped surface, sitting on MLIR, headed to open source in fall 2026.

memory-safetyownership
Lobster — Compile-Time Reference Counting

A pragmatic language by Wouter van Oortmerssen that elides 95% of refcount ops at compile time through flow-typed lifetime analysis. Cycles handled by a cleanup at program exit.

memory-safetyruntime
Rust Polonius (2026)

The state of Rust's borrow checker as the Polonius "alpha" lands behind a nightly feature gate, and what a non-ownership language can still steal from it.

memory-safetyownership
CISA Secure-by-Design Pledge and the January 2026 Memory-Safety Deadline

The voluntary US federal pledge that has set the de-facto industry baseline for memory-safety roadmaps.

memory-safetyindustry
W^X Enforcement in Modern JITs

What every shipping JIT must do on day 1 to be production-grade: never have a code page that is both writable and executable to the same thread at the same time.

memory-safetyruntime
Use-After-Free Landscape: Temporal vs Spatial, kCFI, and the Proven-by-Construction Story

The 2024-2026 industry picture on temporal memory safety, kernel mitigations, and the convergence of UAF defences.

memory-safetyindustry
Verus

Microsoft Research's SMT-backed Rust verifier, the leading tool for verified systems software at scale in 2025-2026.

memory-safetyverification
CompCert and the Verified-Compiler Toolchain

The production-grade formally verified C compiler, the CompCertO / Owlang line, and why it matters for JIT verification.

memory-safetyverification
RustBelt and Iris

Foundational separation-logic verification of Rust's safe / unsafe core, and its 2024-2026 RefinedRust successor.

memory-safetyverification
WasmGC

Native GC primitives in a portable bytecode. Ratified in Wasm 3.0 (Sep 2025), shipped in all major browsers by Dec 2024. Dart, Kotlin, OCaml, Java/Scala/Scheme can now compile to Wasm without bundling a GC.

memory-safetyruntime
CHERIoT

CHERIoT

memory-safetyhardware
MEP-41 Research Substrate: Memory Safety Advances 2023–May 2026

MEP-41 Research Substrate: Memory Safety Advances 2023–May 2026

memory-safetyoverview
Linear Haskell

Linearity attached to function arrows, not to types. Backwards-compatible: ordinary code continues to type-check unchanged. Experimental since GHC 9.0; still labelled experimental in 9.12 / 9.15 (2024–2026).

memory-safetyownership
V8 Sandbox

A purely software in-process sandbox for the V8 JS heap. Ban raw pointers, replace with offsets into a 1 TB sandbox region and indices into out-of-sandbox pointer tables. About 1% perf cost, enabled by default in Chrome 123. Every modern JIT is moving this direction.

memory-safetyruntime
White House ONCD "Back to the Building Blocks" (February 2024)

The White House Office of the National Cyber Director's memory-safety report and the C/C++-adverse federal stance.

memory-safetyindustry
V8 — Orinoco + Oilpan

Chrome's two cooperating collectors. Orinoco runs V8's young-generation JS heap in parallel; Oilpan is Blink's traced C++ GC, recently hosted inside V8 as a library, learning to do generational collection with conservative stack scanning.

memory-safetyruntime
Google: Android Rust, Chrome Rust, V8 Sandbox

Google's published 2022-2026 data on memory-safety progress — Android's 76% → <20% trajectory, the CVE-2025-48530 near-miss, the V8 sandbox.

memory-safetyindustry
MarkUs and quarantine-style UAF prevention

MarkUs and quarantine-style UAF prevention

memory-safetyhardware
Spectre Mitigations in Hosted JITs

Speculative-execution attacks haven't gone away. As of May 2026, every shipping JIT either implements index masking + bounds-check hardening, or relies on process-level Site Isolation, or both.

memory-safetyruntime
Aeneas

Rust verification by functional translation: compile Rust to a pure lambda calculus, verify there.

memory-safetyverification
Microsoft "70% of CVEs Are Memory Safety" Statistic

The canonical industry data point on memory-safety vulnerability prevalence, and every follow-up through 2026.

memory-safetyindustry
NSA "Software Memory Safety" Guidance (2022) and the June 2025 Reissue

The NSA's formal language-level guidance, the named-language list, and the joint CISA reissue.

memory-safetyindustry
Jane Street OxCaml — Modes (Uniqueness, Locality, Linearity)

Orthogonal modes layered onto OCaml's type system. Mode is a property of a value, separate from its type, tracked through inference. Production in Jane Street; open-sourced as OxCaml in 2025.

memory-safetyownership
Formal Models of the Rust Borrow Checker

Stacked Borrows, the 2025 Tree Borrows replacement, and the trajectory of NLL / two-phase formalisation.

memory-safetyverification
Intel CET Shadow Stack + IBT

Intel CET Shadow Stack + IBT

memory-safetyhardware
Android Scudo + MTE inside ART

The canonical "secure allocator inside a managed runtime." Scudo is Android's hardened native heap, used for ART's non-managed allocations (JIT code, off-heap buffers, JNI). Pairs with ARM MTE on Armv9 hardware for hardware-checked tagging.

memory-safetyruntime
DoD Safe Coding Practices and Military / Aerospace Memory-Safety Procurement (2024-2026)

The DoD's evolving acquisition posture on memory-safe languages, the SWFT framework, and aerospace coding standards.

memory-safetyindustry
Scala 3 Capture Checking

Capability tracking in the type system. Each value's type may carry a capture set listing which capabilities it could reference. Foundation for capability-based effects, separation checking (System Capybara), and ownership for resources.

memory-safetyownership
Separation Logic for Managed (GC'd) Heaps

Iris-based separation logics with space credits, tracing GC, and the 2025 IrisFit + Nextgen-Modality lines.

memory-safetyverification
JavaScriptCore — Riptide

WebKit's retreating-wavefront concurrent garbage collector. Marks objects while JS runs, throttles allocation when it falls behind, and uses logical versioning to skip clearing bitmaps.

memory-safetyruntime
Perceus (Koka)

"Garbage-free" precise reference counting with reuse — in-place updates without locks, statically inserted at compile time.

memory-safetyruntime
MSWasm — Memory-Safe WebAssembly

A WebAssembly extension that replaces linear memory with segments and handles. Handles are unforgeable, typed pointers carrying bounds and provenance — closely modelled on CHERI capabilities but pure software.

memory-safetyruntime
MMTk and LXR

A research framework that cleanly separates GC plans from policies, plus the LXR collector that proves a stop-the-world RC+mark-region design can beat industrial concurrent GCs on tail latency.

memory-safetyruntime
Vale Generational References

The direct intellectual ancestor of vm3's handle design: a per-allocation generation counter, a per-reference remembered generation, and a check on every dereference. Same idea, different layer.

memory-safetyownership
Arm Morello

Arm Morello

memory-safetyhardware
Project Verona Regions

Microsoft Research's experimental concurrent-ownership language. Ownership is over **regions** (groups of objects) instead of individual objects. Cowns (concurrent owners) serialise access; behaviours schedule work over multiple cowns atomically.

memory-safetyownership
CHERI (Next Generation)

CHERI (Next Generation)

memory-safetyhardware
Austral

Strict linear types as the load-bearing primitive for memory and protocol safety, plus capability-based effect control. Spec-and-compiler-small enough to read in a weekend.

memory-safetyownership
Swift consuming / borrowing / inout & Noncopyable Types

Swift 6.x has shipped a complete move-only/noncopyable system layered on top of ARC. Parameter conventions are explicit; the law of exclusivity (Swift's variant from 2017) supplies the static aliasing discipline.

memory-safetyownership
Arm MTE

Arm MTE

memory-safetyhardware