Skip to main content

Module machine

Module machine 

Source
Expand description

The Machine: the single runtime context every compiled predicate receives (%M in generated IR). Owns the term heap, trail, choice-point stack, argument registers, the current success continuation, step accounting, and the runtime atom table.

Structs§

ChoicePoint
Machine
RegistryEntry
Registry row emitted by codegen as { i32, i32, ptr }, sorted by (functor, arity) for binary search.
RtError
A runtime error in flight. The ball is a relocatable copy (it must survive heap rewinding on the way to a catch frame); the message is its v1-format rendering for top-level output (exit code 3).
SrcLoc
One source-location row of the codegen-emitted @plg_srcmap side-table (SPANS.md Layer 3). A raising call site passes its index (site_id) and the error path resolves it to file:line:col. Layout mirrors the IR’s {i32, i32, i32}.

Enums§

CpKind
Catch frames participate in error unwinding (drive() in solve.rs) and stop cut truncation (v1 rule: catch is opaque to cut).

Constants§

MAX_ARGS
Maximum predicate arity passed via argument registers (v1 had no practical limit; raise alongside a frame-passing scheme if ever hit).
NO_SITE
site_id sentinel meaning “no source location” — runtime-internal raises (query-side undefined goals) and any binary built without provenance. The error message gets no at file:line:col suffix.

Type Aliases§

ContFn
Uniform signature shared by every compiled predicate, continuation, and retry function — and by runtime-provided continuations. The uniform C-ABI prototype is what makes musttail transfers valid. Returns 0 = fail/exhausted (driver backtracks), 1 = stop (limit hit or final success).