How yyax13/customvm works
This repository implements a small C virtual machine: callers supply bytecode, and the VM decodes and executes instructions against registers, stacks, and memory, returning an exit code. Its instruction set includes arithmetic, control flow, memory operations, hashing, and host calls for process I/O and exit. The tree contains assembler-related types, but no assembler implementation or documented assembly-to-bytecode workflow. Some VM interactions are visible only in partial excerpts, so uncertain links are omitted or marked unverified.
Main entry points: vm/main.c Execution loop · instructions/main.c Instruction decoder · hostcalls/main.c Hostcall registry · main.h Instruction set
Components 14
VM execution
- Execution loop
src/vm/main.c - Instruction set
src/vm/instructions/main.h - Instruction decoder
src/vm/instructions/main.c - Assembler types
src/assembler/types/main.h - Program entry
src/main.c
VM state
- VM data types
src/vm/types/main.h - Common types
src/types/main.h - Registers and state
src/vm/registers/main.c - Operand decoding
src/vm/registers/main.c
Runtime services
- FNV hashing
src/utils/hash/main.c - Hostcall registry
src/vm/hostcalls/main.c - Host I/O
src/vm/hostcalls/main.c
Other components
- VM caller
- Operating system
Connections 9
- VM caller → Execution loop: runs bytecode
- Execution loop → Operand decoding: decodes operands
src/vm/main.c - Execution loop → Registers and state: checks registers
src/vm/main.c - Execution loop → FNV hashing: hashes values
src/vm/main.c - Execution loop → Hostcall registry: dispatches hostcalls
src/vm/main.c - Execution loop → Instruction decoder: decodes instructions
- Instruction decoder → Instruction set: uses opcodes
src/vm/instructions/main.c - Hostcall registry → Host I/O: provides handlers
src/vm/hostcalls/main.c - Host I/O → Operating system: reads and writes
src/vm/hostcalls/main.c