v3 VM + GC
Heap-backed values
- arrays, maps, closures are heap objects
- scalars stay immediate
Closure execution model
OpMakeClosurecaptures current environment- call uses lexical parent chain
Mark-and-sweep
- mark from stack + active frame/env roots
- traverse arrays, maps, closures
- sweep removes unmarked
- reset marks each collection
Critical correctness rules
- mark map keys as well as values
- mark captured environments
- recursive mark idempotence via visited/marked bit
Runtime safety
- non-closure call errors
- invalid key/index/type operations at runtime
- bounds/type checks remain runtime responsibility
Debug checks
- same program should leak fewer objects after GC trigger
- closure call behavior confirms captured references retained
1 / 1