Glossary, Resources & Final Checklist

References for further study and the course glossary.

Glossary

Why it matters Tree of a program's syntactic structure without punctuation Every later pass works on it Binary(+, Number(1), Number(2)) Compiling before execution Fast start-up, no warm-up.NET Native AOT, GCC Modules 2, 15, 18

Instructions designed for a virtual machine Compact, portable or cacheable, verifiable JVM bytecode, CPython bytecode Fast JIT tier with few optimisations Removes interpretation overhead quickly V8 Sparkplug, HotSpot C1

Straight-line code with one entry and one exit Unit of control-flow analysis Instructions between leaders Modules 10, 25

Per-call record of function, instruction pointer and slots Enables calls, recursion, traces MiniLang { closure, ip, base } Stack of active frames Stack traces and recursion limits in b() [line 3] Modules 11, 13 Function plus captured variables Callbacks, iterators, counters

CPython's compiled unit: bytecode, constants, names What dis shows

Translator from one representation to another Not only to machine code javac, MiniLang compile

Indexed table of literals and references Instructions refer to it by index CONSTANT 0 → 40

Basic blocks connected by possible transfers Basis of optimisation Loop with a back edge Modules 10, 16

Leaving optimised code back to the interpreter Keeps speculation correct V8 "not a Smi"

Turns bytecode back into readable instructions Debugging and learning javap -c, dis

Resolving references to libraries at load or run time Shared libraries, plugins dlopen, class loading

Mapping from names to values with a parent link Variable lookup and scope block{y} → global{x} Operand stack in CLR terminology IL instructions use it ldarg.0; ldarg.1; add ECMAScript record for running code Scope and this Function call context

Executes a program representation at run time Fast start, flexible Tree-walker, bytecode loop Modules 0, 6, 9

Intermediate representation inside a compiler Enables analysis and optimisation Modules 1, 8, 16 Compiling during execution Speed using run-time knowledge HotSpot C2, V8 Maglev Turns characters into tokens First stage of every front end MiniLang tokenize

Brings code units into a running runtime Start-up, isolation, security JVM class loader Instructions for a physical CPU What finally runs

Descriptions of types, methods and references Reflection, linking, verification.NET metadata tables Modules 17, 18 Number naming an instruction Parameter of an instruction Indices, offsets, counts Stack holding intermediate values JVM frame stack

Builds a tree from tokens according to a grammar Structure and syntax errors Read–eval–print loop interface python prompt

Services and machinery a running program needs GC, loading, exceptions, libraries JVM, CLR, CPython Code programs call at run time Region where a declaration is visible

VM whose instructions use an operand stack Compact code, simple compiler JVM, Wasm, MiniLang VM whose instructions name registers Lua, V8 Ignition

Map from names to declarations during compilation Resolution and checking

Moving code through execution tiers as it gets hot Fast start and fast steady state Interpreter → C1 → C2 Modules 2, 16, 18

Categorised piece of source with a position NUMBER(40) at 1:12 Compiles recorded hot paths Loop-heavy dynamic code

Abstract machine with an instruction set and execution model JVM, CLR, Wasm runtime Checks bytecode before execution Safety against malformed code JVM verifier, MiniLang verify Modules 8, 17, 24 Reclaims unreachable objects Memory safety and convenience Reference the GC starts tracing from Stack slots, globals Mark reachable objects, sweep the rest Simple tracing collector Lua, older collectors Collect young objects often, old rarely Low cost for short-lived objects HotSpot Pause Young Per-site cache of lookup results Fast dynamic dispatch Property access by shape Modules 12, 16, 25 Switching tiers in a running loop Optimise long loops HotSpot % compilations IR where each variable is assigned once Modules 8, 10, 16

Mapping from generated code to original source Debugging transpiled code TypeScript .map

WebAssembly, a validated portable bytecode Sandboxed portable execution Java Virtual Machine Runs class files Common Language Runtime of.NET Runs IL assemblies.NET's intermediate language Compiled C#, F#, VB Reference implementation of Python Most Python runs on it

Time program threads are stopped by the collector Pause Young … 0.6ms

Time until JIT-compiled code reaches steady state Benchmarks and cold starts First requests slow

Restricted environment for untrusted code Wasm, V8 isolates Modules 21, 24

Foreign-function interface to native code Calling C libraries ctypes, P/Invoke Modules 11, 24

Binary calling convention between compiled units System V x86-64 ABI Modules 11, 22

Resources and Further Reading

Robert Nystrom, *Crafting Interpreters* (free online) — the clearest path through tree-walk and bytecode interpreters.

Aho, Lam, Sethi & Ullman, *Compilers: Principles, Techniques, and Tools*, 2nd ed.

Andrew Appel, *Modern Compiler Implementation in ML/Java/C*.

Jones, Hosking & Moss, *The Garbage Collection Handbook*, 2nd ed.

Smith & Nair, *Virtual Machines: Versatile Platforms for Systems and Processes*.

Benjamin Pierce, *Types and Programming Languages*.

Anthony Shaw, *CPython Internals*; Konrad Kokosa, *Pro .NET Memory Management*.

Specifications and official documentation *The Java Virtual Machine Specification* and *The Java Language Specification* (Java SE 21).

ECMA-335 *Common Language Infrastructure*; .NET documentation on tiered compilation, ReadyToRun and Native AOT.

Python Language Reference; CPython dis, gc, tracemalloc and import-system documentation; PEPs 659, 669, 703.

ECMA-262 (ECMAScript); WHATWG HTML "Event loops"; Node.js documentation.

*WebAssembly Core Specification*; WASI documentation.

Papers and articles Ertl & Gregg, "The Structure and Performance of Efficient Interpreters" (2003).

Shi et al., "Virtual Machine Showdown: Stack Versus Registers" (2005).

Hölzle et al., "Optimizing Dynamically-Typed Object-Oriented Languages with Polymorphic Inline Caches" (1991).

Haas et al., "Bringing the Web up to Speed with WebAssembly" (2017).

V8 blog posts on Ignition, Sparkplug, Maglev, hidden classes and Orinoco.

Final Checklist

You have mastered this course when you can:

[ ] Explain how source text becomes execution, and distinguish compilers, interpreters, VMs, runtimes, bytecode and machine code.

[ ] Separate language specifications from implementation- and version-specific behaviour.

[ ] Write a lexer with positions and error recovery, and a recursive-descent or Pratt parser producing ASTs with spans.

[ ] Implement a tree-walk interpreter with environments, short-circuiting and positioned runtime errors.

[ ] Design a bytecode instruction set with a constant pool, compile to it, disassemble it and verify it.

[ ] Implement a stack VM with frames, locals, globals, closures (upvalues), budgets and stack traces.

[ ] Compare stack and register VMs and identify basic blocks and CFGs.

[ ] Explain exceptions and unwinding, garbage collection strategies, and runtime loading and initialisation.

[ ] Explain JIT tiers, inline caches, speculation, deoptimisation and OSR — and read real JIT logs.

[ ] Read JVM bytecode, .NET IL, CPython bytecode, V8 bytecode and WebAssembly.

[ ] Debug and profile interpreted and VM-based programs, and benchmark them fairly.

[ ] Sandbox untrusted code with verification, capabilities and resource limits.

[ ] Reason about evaluation order, overflow, floating point, equality and undefined behaviour across languages.

[ ] Build and document a complete mini-language with two agreeing back ends and a versioned bytecode format.