← Back
Home › Systems › Operating systems and runtimes

bytecode-interpreter

bytecode interpreter

CPython, Lua

SystemTechniques · 5Primitives · 24 bytecode-interpreter Incremental and concurrent garbage…compilers · medium: Trace the heap in small steps or on other threads while the program runs, and use barriers to keep the collector's view correct.›Inline cachescompilers · 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.›Thread caching allocatorsystems · medium: General-purpose malloc with size classes, per-thread caches and free-list sharding (tcmalloc, mimalloc)Stack unwindingcompilers · medium: Frame-pointer, DWARF CFI and compact unwinding of call stacksDebug info (DWARF)compilers · medium: DWARF stores a tree of typed entries (DIEs), a line-number bytecode, unwind tables and location expressions that map machine state back to source; pick it for ELF/Mach-O debug builds.›Mark-sweep garbage collectioncompilers · low: Find everything reachable from the roots, free the rest in place; handles cycles, never moves objects, and is the base of most production collectors.›Slab allocatorsystems · low: Pre-carve pages into equal-size slots per size class with an in-place free list: O(1) alloc and free, no external fragmentation, cache-warm reuse.›Calling conventions abicompilers · low: System V, Windows x64 and AAPCS64 ABIs: argument registers, stack frames, struct passing, FFIBytecode compilationcompilers · 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.›Bytecode interpretercompilers · low: Register/stack VM dispatch loop for executing compiled plans or rules (SQLite VDBE, nftables)Closures and upvaluescompilers · 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.›Pratt parsingcompilers · low: Table-driven expression parsing with one loop and a numeric binding power per operator; the compact core of precedence handling in hand-written parsers.›Recursive-descent parsingcompilers · low: Hand-written top-down parser with one function per grammar rule; simple, fast, with full control over error messages and recovery.›Reference countingcompilers · low: Keep a count of owners in each object, free it when the count hits zero; deterministic and local, but pays on every copy and leaks cycles.›Value tagging and NaN-boxingcompilers · 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.›Fibers stackful coroutinesconcurrency · low: User-mode context switch: stack allocation, register save, M:N scheduling of green threadsString interningdata-structures · low: Store each distinct string once and refer to it by idSwiss tabledata-structures · low: Open-addressing hash table that filters 8-16 slots at once with 1-byte hash tags and SIMD, giving fast lookups at 87.5 % load.›Big integer arithmeticnumerics · low: Multi-limb integer arithmetic (256-bit and up): carries, Karatsuba, Montgomery and Barrett reductionMemory orderingconcurrency · low: What Relaxed, Acquire, Release and SeqCst atomics actually guarantee, what they cost on x86 and ARM, and which one each pattern needs.›Hidden classes (shapes)compilers · 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.›+ 8 more primitives

Similar systems

Share the most building blocks with this one.