Call

← Reference
Io

C implementation of the Call object created once per block/method activation. IoCallData captures the activation's sender (caller's locals), the target receiver, the triggering message, the slotContext (where the slot was found during lookup — can differ from target when the slot lives on a proto), the activated Block/CFunction itself, the coroutine that is running, and the stopStatus used to signal return/continue/break. Each Call is exposed through the block's locals as the "call" slot so Io code can read sender, message argAt, etc. IoCall_rawStopStatus is the primary C-level read path; the iterative evaluator (IoState_iterative.c) and IoBlock_activate both poke the status here when an early exit is requested.

IoCall_free(self)

Registered as the tag's freeFunc. Frees the IoCallData payload; all referenced IoObjects are GC-managed.

IoCall_initSlots(self)

Seeds all IoObject* slots with state->ioNil and the stopStatus with MESSAGE_STOP_STATUS_NORMAL. Called by both proto and rawClone so no Call is ever observed with uninitialized pointers — the GC mark function would otherwise dereference garbage.

IoCall_mark(self)

Registered as the tag's markFunc. Marks every field: sender, target, message, slotContext, activated block/cfunction, and the owning coroutine. No nil check because initSlots guarantees all fields are valid IoObjects.

IoCall_new(state)

Convenience constructor: looks up the registered proto and clones it. Used by IoCall_with; direct callers are rare since activation always wants the fields filled in at construction.

IoCall_newTag(state)

Builds the Call tag with clone/mark/free function pointers. No activateFunc — Call is data only, it does not run itself.

IoCall_proto(state)

Creates the Call proto, allocates a zeroed IoCallData payload, and wires up the Io-visible method table (sender, message, slotContext, target, activated, coroutine, evalArgAt, argAt, stopStatus, setStopStatus). Every activation clones this proto via IoCall_with.

IoCall_rawClone(proto)

Registered as the tag's cloneFunc. Copies the proto's data block byte for byte then re-initializes slots to nil/NORMAL so a clone never inherits a stale sender/message pointer from the proto.

IoCall_rawStopStatus(self)

Direct C accessor for the stopStatus field. Hot-path read: the iterative evaluator and IoBlock_activate both call it on every block exit to decide whether to propagate return/continue/break.

IoCall_with(state, sender, target, message, slotContext, activated, coroutine)

Canonical constructor invoked from IoBlock_activate and the iterative evaluator's block activation path. Clones the Call proto and fills every slot in one pass, leaving stopStatus at NORMAL. The returned Call is stashed in the block's locals as the "call" slot so Io code can query sender/message at runtime.