Implementing Software Machines in Go and C
summary
Implements small VMs in C and Go and shows working code: a bytecode interpreter, a function-pointer dispatcher, a C computed goto version that replaces opcodes with label addresses for speed, and a Go version using function values and closures (but without computed labels). Builds stacks (array and cactus stack), a hash map in C and Go, and a tiny assembler/VM that runs examples (13+28 and a countdown from 13 to 0). Uses unsafe and reflect tricks to mutate memory and demonstrates which approaches actually speed up execution.
AI-written summary · about
chapters (12)
- 0:00Start
- 3:34System Virtualization
- 10:27The Harvard Memory Model
- 12:18Stacks
- 20:24Associative Array
- 23:55Cache
- 31:40Closures
- 34:43Vm Harness
- 35:41Stack Machines
- 37:35Accumulator
- 38:12Accumulator Machines
- 38:34Register Machines
related talks
44mImplementing Software Machines in Go and C
53mReconciling the irreconcilable and accelerating the unacceleratable using Go assembler☠️
40mCreating efficient VM with JIT in Go
42mCan you write an OS Kernel in Go?
48mOptimizing Performance using a VM and Go Plugins
05mWhat have the architects ever done for us?
39mIs Go A Good Language to Build Compilers?
49m“Which Machine Am I Coding To?”
