vader/pipeline/comptime_vm
Functions
resolve_vm_required_decls :: fn(loaded: LoadedProject, typed: TypedProject, evaluated: Ct.EvaluatedProject, diags: Diagnostic[]) -> void Bake every VM-required @comptime decl into its module's comptime_decls.
No-op when evaluated.vm_required is empty (the common case: most projects
have no loop-bearing comptime const). Mutates evaluated in place.
The decls run in layers: a decl whose value reads another one still waiting
runs once that one is baked, so each runs once, in the folder of its own
source (evaluate_layer).
Parameters
| loaded | LoadedProject | the loaded project (staging lower input). |
| typed | TypedProject | the typed project (staging lower input). |
| evaluated | Ct.EvaluatedProject | the complete evaluated project ; its modules[...].comptime_decls are mutated. |
| diags | Diagnostic[] | comptime diagnostics: a failed staging / VM run appends C4002 (panic) here ; the decl is left un-baked. |
Errors
- C4002 when the staged callee traps in the VM ; C4001 when its result
Valuecan't be bridged (cf.bridge.vader).
copy_baked_values :: fn(from: Ct.EvaluatedProject, into: Ct.EvaluatedProject, diags: Diagnostic[]) -> void Copy into into the values the VM baked for the deferred decls of from, a
load of the same sources under another view (HostBodies). A decl is matched
by its position in the source, which both loads share; its symbol id is not.
Parameters
| from | Ct.EvaluatedProject | the evaluated project the VM ran on. |
| into | Ct.EvaluatedProject | the evaluated project the values belong to. |
| diags | Diagnostic[] | receives the decls of into that from did not defer. |
Errors
- C4001 for a decl
fromevaluated otherwise, which would otherwise be left to run in the built program.