Skip to main content

Module vm

Module vm 

Source
Expand description

Bytecode interpreter / execution engine. Bytecode VM execution engine.

A stack-based interpreter that executes compiled Chunks. The VM maintains a NaN-boxed value stack (8 bytes per entry), a call stack for function invocations, and dispatches instructions via a match loop.

§NaN-boxing

The value stack uses [NanBox] instead of VMValue. Scalars (null, bool, int, float) are stored inline as 8-byte values without heap allocation. Complex types (strings, lists, attrsets, closures, builtins, thunks) use an Rc<HeapObject> pointer encoded in the NaN payload bits.

The constant pool (in Chunk) still uses VMValue; values are converted to NanBox when pushed onto the stack and converted back only at the external API boundary (execute returns VMValue).

Structs§

FlakeResolverGuard
RAII guard that restores the previous flake resolver on drop.
VM
The bytecode virtual machine.

Functions§

set_flake_resolver
Install a flake resolver callback for the current thread.
vm_fallback_count
Return the number of files that fell back to tree-walker evaluation.

Type Aliases§

FlakeResolverFn
Signature for an external flake resolver.