Skip to main content

Module context

Module context 

Source
Expand description

The RuntimeContext handed to every generated function (§10.3, Appendix B) and the Runtime that owns the heap + immortals.

Every generated function receives a hidden first parameter — a pointer to RuntimeContext — followed only by GcRef arguments, and returns one GcRef. The context is the single channel through which generated code reaches the GC heap, the pending fault, the debug frame chain, the input source, and so on.

Structs§

DebugLocal
One local variable in a debug frame snapshot (§9.3).
Fault
The fault record a RuntimeContext points at. pending_fault is non-null and points at the owning runtime’s slot.
FaultMessage
The message a FaultKind::Panic or FaultKind::AssertFailed carries.
RaisedFault
A FaultKind that is actually a fault.
Runtime
The owner of the heap and the immortal singletons.
RuntimeContext
The hidden first argument to every generated function.
StackBudget
A native-stack budget a RuntimeContext may be minted with: a u32 proven no larger than STACK_BUDGET_BYTES at construction.

Enums§

FaultKind
What kind of runtime fault occurred (§9.2, §10.4). Set by the runtime wrapper that detected it; read by the host after the generated code unwinds to its fault epilogue.

Constants§

FRAME_BYTES_BASE
What any call spends, however narrow: the floor of frame_cost, in bytes (ADR-105).
FRAME_BYTES_PER_SLOT
What each Gc local past REFERENCE_FRAME_SLOTS adds to a frame’s cost, in bytes (ADR-105). Rounds up arm64’s measured 1.06 B per local; x86_64 measures no slope at all, and FRAME_BYTES_BASE says why that left this constant where it was.
MAX_RECURSION_DEPTH
The deepest recursion a reference-width function reaches, and the figure STACK_BUDGET_BYTES is derived from.
REFERENCE_FRAME_SLOTS
The frame width MAX_RECURSION_DEPTH is calibrated against: the Gc local count of
STACK_BUDGET_BYTES
The native stack, in bytes, that Praxis frames may occupy — and the largest budget a host may install (ADR-105).

Functions§

current_fault_kind
Read the current fault kind from a context’s pending_fault slot (§9.2). Returns FaultKind::None if no fault is pending or the slot is null. Used by crate::crash_snapshot::praxis_snapshot_debug_chain to record which fault kind triggered the snapshot.
frame_cost
What one call spends of StackBudget: a floor, plus a per-slot term for every Gc local past the reference width (ADR-105).