Skip to main content

Module aot_tier

Module aot_tier 

Source
Expand description

AOT-native tier loader (HOTSWAP §Axis-3 / P15): dlopen a rustc-built cdylib (produced by crate::compile::build_native_cdylib) and wrap an exported logos_native_<fn> symbol as a NativeFn the VM dispatches through the existing NativeSlot::Ready path — no new dispatch, the hot-swap seam already exists.

Sound subset: ALL-INT signatures (every param + the return Int). Those cross by value in general-purpose registers, so a single i64 calling convention is exact. Float/Bool need per-type fn-pointer ABIs (f64 rides XMM) and are deferred — a function outside the subset simply gets no AOT fn and stays on VM+JIT (no gap).

The interpreter is the only caller of the loaded symbol, and ownership of the Library is held for the program’s lifetime (an Arc inside the NativeFn), so the code stays mapped while any call can occur.

Structs§

AotNativeFn
One AOT-native function: the resolved symbol address, its arity, the Library it lives in (kept alive), and a call counter for observability/tests. Send + Sync because the address is immutable and the code is read-only once loaded.

Functions§

load_aot_native
dlopen path and resolve the AOT-native symbol (logos_native_<fn>) as an all-Int function of arity, wrapping it as a NativeFn plus its shared call counter. Returns None if the library or symbol cannot be loaded (the caller then keeps the function on VM+JIT — no gap at the seam).