Skip to main content

NativeFn

Trait NativeFn 

Source
pub trait NativeFn: Send + Sync {
    // Required methods
    fn call(&self, args: &[i64], pins: &[i64], depth: usize) -> NativeOutcome;
    fn entry_ptr(&self) -> i64;
    fn published_regc(&self) -> i64;

    // Provided method
    fn ret(&self) -> NativeRet { ... }
}
Expand description

A natively-compiled function: integer registers in, integer result out. depth is the LIVE LOGOS frame count at the call (the callee’s own frame included) — native self-calls count against the same MAX_CALL_DEPTH the bytecode enforces.

Required Methods§

Source

fn call(&self, args: &[i64], pins: &[i64], depth: usize) -> NativeOutcome

args are the marshalled parameter slots (scalars by value, floats as bits, list params as don’t-care placeholders); pins are the pre-extracted [vec_handle, ptr, len] triples, one per list parameter in declaration order, landing in the frame’s pin slots.

Source

fn entry_ptr(&self) -> i64

The chain’s entry pointer, for the program’s FnTable.

Source

fn published_regc(&self) -> i64

The regcount value to PUBLISH next to the entry pointer: frame_size − 3, which the call stencil’s bound math and limit planting are calibrated against (the plain register count for the classic layout).

Provided Methods§

Source

fn ret(&self) -> NativeRet

How the result re-boxes: a scalar from the raw i64, or the IDENTITY of one of the caller’s list arguments (return-by-parameter).

Implementors§