Expand description
Builtin bridge: tree-walker builtins callable from the VM. Builtin bridge: allows the bytecode VM to call tree-walker builtins.
The VM has native implementations for ~103 builtins, but nixpkgs needs ~119+. Instead of reimplementing every builtin in the VM’s value system, this module provides a callback mechanism that delegates to the tree-walker’s builtins for any builtin the VM doesn’t handle natively.
§Architecture
Follows the same pattern as set_flake_resolver in vm.rs:
a thread-local callback with an RAII guard for cleanup.
sui-eval (BytecodeEvaluator)
│
├─ set_builtin_bridge(callback) ← installs bridge before VM eval
│
└─ VM execution
│
└─ CallBuiltin for "getEnv" etc.
│
└─ BuiltinRegistry stub → call_builtin_bridge("getEnv", args)
│
└─ callback converts VMValue↔Value, calls tree-walker builtinStructs§
- Builtin
Bridge Guard - RAII guard that restores the previous builtin bridge on drop.
Functions§
- call_
builtin_ bridge - Call the builtin bridge for a named builtin.
- set_
builtin_ bridge - Install a builtin bridge callback for the current thread.
Type Aliases§
- Builtin
Bridge Fn - Callback type for bridging tree-walker builtins into the VM.