Skip to main content

Module callstack

Module callstack 

Source
Expand description

Kernel-internal call stack.

Per v3 spec §3 “The Instance status state machine and kernel call stack”:

  • InstanceEntry — pushed by CALL. Introduces a fresh invocation of an Instance. Carries that invocation’s PC, regs, and reference to the in-flight Instance state.

  • ReferenceEntry — pushed by host_yield. Refers to an InstanceEntry earlier in the stack; the referenced entry’s PC and regs are shared (the ReferenceEntry is just a “this position also depends on entry N” pointer for yield-resume routing).

Invariants (enforced via enforce_invariants in debug builds):

  • Exactly one entry is Running — the top of the stack.
  • All others are Waiting.
  • A ReferenceEntry at position i has target_position < i and the target is an InstanceEntry.

State storage: an InstanceEntry owns its in-flight working root cnode and references into a shared CacheDirectory for the underlying Image and Instance content. The Vm consults the stack top to find the actively executing Instance; it consults lower entries during yield-marker routing.

Structs§

CallStack
The kernel-internal call stack.
InstanceEntry
In-flight state of an Instance currently on the call stack.
ReferenceEntry
Stack entry that refers to an InstanceEntry earlier on the stack. Pushed by host_yield after a yield marker matches the target’s YieldCatcher; the target resumes when this entry rotates to the top (via CALL_RESUME or HALT-unwind).

Enums§

Entry
One slot on the call stack.
EntryStatus
Status of a stack entry. Exactly one entry is Running (the top); all others are Waiting. Block-end faults any remaining Waiting entries per spec §3.

Constants§

DEFAULT_MAX_DEPTH
Per the spec §18 default; the chain spec may override.