A virtual machine is a fetch-dispatch loop with a stack of frames. This diagram traces one bytecode execution: the instruction pointer advances, the opcode indexes a dispatch table, the handler manipulates the operand stack and frame slots, and calls push new frames while returns pop them. Branch opcodes move the instruction pointer; inline caches record observed types at call sites; counters feed the tiering system that eventually hands hot methods to a JIT. The ordering matters because the dispatch loop is the constant, and every optimization — inline caches, tier-up, on-stack replacement — is a faster way of doing what the loop already does. The done state: the interpreter has executed the method, and its profiling data is ready for the optimizing tiers.
Virtual Machine Execution
Inside a bytecode VM: fetch-dispatch loop, operand stacks, frames, inline caches, and the profiling that feeds JIT tiers.
The Runtime Theory Team07 stages
trace / request.md
readyThe dispatch loop reads the bytecode at the current instruction pointer — one byte for the opcode, with operands (constants, locals, branch targets) inlined as 16- or 32-bit fields.