Skip to main content

Module marshal

Module marshal 

Source
Expand description

The boundary marshalling a compiled node kit reads its arguments and writes its outputs through (compiled_handles.md §4): a node crate’s kits use it as the core’s own do. Marshalling between typed Values and compiled-tier slots. One place owns the rule for every port type, so embedded cones and whole compiled kernels decode alike:

  • scalars ride as their slot bits, one slot or two;
  • every Ref2 kind rides as a (ptr, len) pair (jit_boundary.md, axioms S1–S10): a typed vector, a string, or a byte string as a slice of its elements, and a JSON, extension, or handle value as a one-element slice holding the Value.

Entering the compiled tier, a Value is borrowed: the pair points into the value the caller holds for the duration of the call. Leaving it, the pair is copied out to an owned Value: the interpreter and the host never hold a reference into a state’s buffers.

Functions§

arg_ref
An argument’s slots as a borrowed view of the value, decoded by its port type: nothing is copied. A string, byte string, or value is borrowed through its pair, valid while its producer’s storage is.
decode_output
An output at slot of buffer as the Value its port type names: decode_slot for a one-slot carrier and a Ref2 pair, and the two-limb reassembly for a 128-bit integer or a register word, which ride two consecutive slots (alignment §8.4 layer 1). This is the typed read every compiled kernel’s get_value makes.