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 methods
fn call_with_writeback(
&self,
args: &[i64],
pins: &[i64],
depth: usize,
slots: &[u16],
writeback: &mut Vec<(u16, NativeWriteback)>,
) -> NativeOutcome { ... }
fn materialize_side_exit(
&self,
_status: i64,
_entry_depth: usize,
_frame: &[i64],
_pins: &[i64],
) -> Option<NativeOutcome> { ... }
fn ret(&self) -> NativeRet { ... }
fn code_extents(&self) -> Vec<(usize, usize)> { ... }
}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§
Sourcefn call(&self, args: &[i64], pins: &[i64], depth: usize) -> NativeOutcome
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.
Sourcefn published_regc(&self) -> i64
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§
Sourcefn call_with_writeback(
&self,
args: &[i64],
pins: &[i64],
depth: usize,
slots: &[u16],
writeback: &mut Vec<(u16, NativeWriteback)>,
) -> NativeOutcome
fn call_with_writeback( &self, args: &[i64], pins: &[i64], depth: usize, slots: &[u16], writeback: &mut Vec<(u16, NativeWriteback)>, ) -> NativeOutcome
On success, return each requested final argument exactly once. A list output must either own a boxed value or be one of the boundary pin handles; native temporary storage must remain valid until ownership is transferred. A precise deopt carries output state in its frames instead. Backends without an output-argument ABI decline before executing such a call.
Sourcefn materialize_side_exit(
&self,
_status: i64,
_entry_depth: usize,
_frame: &[i64],
_pins: &[i64],
) -> Option<NativeOutcome>
fn materialize_side_exit( &self, _status: i64, _entry_depth: usize, _frame: &[i64], _pins: &[i64], ) -> Option<NativeOutcome>
Materialize a precise side exit from a call made by a native region. The frame starts at this function’s entry window; pins name the region’s borrowed buffers. Owned values must detach before cleanup.
Sourcefn ret(&self) -> NativeRet
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).
Sourcefn code_extents(&self) -> Vec<(usize, usize)>
fn code_extents(&self) -> Vec<(usize, usize)>
The machine code behind this function, as (start address, length) extents — what the
LOGOS_PERF_MAP symbol map names. Default: none to report.