Home › Compilers & runtimes

Compilers & runtimes

Parsing, type checking, IR and optimization, code generation, binaries, interpreters, JITs and garbage collectors.

Parsing & syntax trees

Turning text into trees that tools can edit, and back into text.

Names & types

Resolving names and checking or inferring types.

IR & program analysis

SSA, control flow and dataflow facts that optimizers and checkers rely on.

Optimization passes

Classic passes that make code smaller and faster.

function inlining

Planned.

global value numbering

Planned.

sparse conditional constant propagation

Planned.

loop optimizations

Planned.

auto vectorization

Planned.

peephole optimization

Planned.

profile guided optimization

Planned.

e graphs

Planned.

tree shaking

Planned.

minification name mangling

Planned.

Code generation

From IR to machine code, bytecode and binary module formats.

Instruction selection

medium

Cover the IR with target instruction patterns at least cost; greedy maximal munch is simple, dynamic programming over a tree or DAG is optimal.

tree tiling O(n * patterns) by labelling; optimal selection on DAGs is NP-hard in general, so DAG selectors are heuristic or restricted

Register allocation

medium

Map unlimited virtual registers onto a few machine registers, spilling the rest to the stack; linear scan is fast, graph coloring and splitting allocators give better code.

linear scan O(n log n) in intervals (O(n) with sorted input); graph coloring O(n + e) per round, several rounds; optimal allocation is NP-complete in general

instruction scheduling

Planned.

machine code emission

Planned.

calling conventions abi

Planned.

Linking and relocation

medium

The linker merges object files, matches each undefined name to one definition, assigns addresses and patches every recorded reference (relocation); dynamic linking defers part of that to load time.

O(total input bytes + symbols + relocations); symbol resolution is hash lookups, patching is one pass over relocations

executable formats elf pe

Planned.

WebAssembly binary format

low

A section-based module container with LEB128 integers and structured, typed code, so untrusted bytes are validated in one pass and compiled as they stream in.

parse and validate O(bytes) in one pass; section skipping O(1) per section

spirv binary format

Planned.

Bytecode compilation

low

Flatten an AST into compact linear instructions with a constant pool, backpatched jumps and slot-numbered locals, so a small loop can execute it.

O(n) in AST size, one pass; jump patching O(1) per jump; bytecode about 1-3 bytes per stack instruction

idl code generation

Planned.

FFI bindings generation

medium

Describe a library's C-ABI surface once (header, attributes or IDL) and generate the declarations, converters and wrappers for each caller language.

generation O(declarations); per call: one indirect call plus argument conversion, O(bytes) for strings and buffers

Binaries & debugging

Reading machine code back: disassembly, recovery, debug info and stack traces.

Interpreters & JITs

Executing dynamic languages and sandboxed bytecode fast.

bytecode interpreter

Planned.

JIT compilation

medium

Run cold code in a cheap tier, count executions, and compile only what gets hot, trading warm-up time and memory for peak speed.

per call O(1) counter bump; compile cost O(size of hot code), paid once per tier; peak speed bought at warm-up

Inline caches

medium

Per-call-site cache of "this object shape, that slot or target", turning dynamic property and method lookup into a compare and a load.

hit O(1), one shape compare plus one load; miss pays the full lookup; polymorphic hit O(k) for k cached shapes (k about 4)

Hidden classes (shapes)

low

Objects that gained the same properties in the same order share one layout descriptor, so a property is an index and the layout is one comparable id.

add property O(1) amortized via a transition table; layout id compare O(1); name to slot lookup O(1) with a per-shape table, O(depth) walking the tree

Deoptimization

medium

Speculate with guards, and on failure rebuild the slow-tier frames from compile-time metadata and resume there, so optimized code may assume the common case.

guard O(1) on the fast path; a deopt costs O(frames x live values), paid only when it fires

On-stack replacement

medium

Count loop back-edges, compile code that can start at a loop header, and copy the live frame state into it, so one running call gets faster.

counter bump O(1) per back-edge; entry and exit O(live values); one compile per hot loop entry

Value tagging and NaN-boxing

low

Pack the type and the payload of any value into one 64-bit word, using spare low bits of aligned pointers or the unused payload of NaNs, so type tests are one mask compare.

O(1) per type test, encode and decode; 8 bytes per value

Closures and upvalues

low

How interpreters and compilers let a function keep using its enclosing variables after they return: flat closures, open and closed upvalues, closure conversion, capture by value or reference.

capture O(open upvalues above the slot); close O(variables captured in the frame); call-time access O(1)

Executable memory under W^X

low

How JITs and code generators emit machine code under W^X: RW to RX flips, dual mappings, per-thread write toggles, and the instruction-cache flush.

emit = O(code bytes) copy + 1 protection change + 1 I-cache flush per batch; toggle cost grows with threads (TLB shootdown)

Instruction metering

low

Charge a fuel budget per instruction or per basic block and trap at zero, so untrusted code is bounded by work done, deterministically.

one subtract-and-compare per charge point; per-block charging pays it once per basic block instead of once per instruction

webassembly runtime

Planned.

heap snapshot startup

Planned.

Hot reloading

medium

Replace code in a running process by swapping an indirection point, then migrate the live state to the new layout at a safe moment.

call overhead one extra indirect load and jump; swap O(1); state migration O(state size)

javascript event loop

Planned.

Garbage collection

Reclaiming memory automatically.

Developer tooling

Package resolution, code indexes, language servers and debugging aids.

Type theory & proof assistants

Kernels and automation behind proof assistants and equality reasoning.

dependent type theory

Planned.

normalization by evaluation

Planned.

de bruijn indices

Planned.

term rewriting

Planned.

congruence closure

Planned.