Skip to main content

Module abi

Module abi 

Source
Expand description

The C-ABI surface generated code calls into (plg_rt_*).

Every function here matches a declaration emitted by plgc codegen; the pairing is documented in docs/design/RUNTIME_ABI.md and protected by the compiler↔runtime version sync in crates/compiler/build.rs.

Safety: all m pointers originate from plg_rt_init and live for the whole process; generated code is single-threaded.

Functions§

plg_rt_areg_get
plg_rt_areg_set
plg_rt_breg_set
plg_rt_existence_error
Raise existence_error(procedure, F/A) — the compiled stub for body goals that reference a predicate with no clauses (and the runtime path for unknown query goals shares the message shape).
plg_rt_frame_alloc
Allocate an n-cell continuation frame; returns the base index.
plg_rt_frame_get
plg_rt_frame_set
plg_rt_k_env
plg_rt_k_fn
plg_rt_new_var
Fresh unbound variable; returns its REF word.
plg_rt_pred_fail
Always-fail predicate body: the target for :- dynamic predicates with no clauses (silent-fail linter contract).
plg_rt_push_cp
Push a choice point whose retry re-enters generated code.
plg_rt_put_big
Box an i64 outside the i61 immediate range (BIG cell).
plg_rt_put_float
plg_rt_put_list
plg_rt_put_struct
Build a compound from breg[0..arity]; returns its STR word.
plg_rt_set_k
Set the success continuation (k_fn passed as a raw pointer-sized integer in IR; the transmute re-types it).
plg_rt_step
Bump the step counter. Returns 0 when the limit is exceeded (the uncatchable resource error is set; generated code returns 0).
plg_rt_unify
Generic unification; returns 1 on success.