pub fn compile_function_regalloc(
ops: &[MicroOp],
shared_status: Option<Arc<AtomicI64>>,
depth_addr: i64,
) -> Option<CompiledChain>Expand description
Compile a recursive FUNCTION’s micro-op stream into ONE contiguous
register-allocated x86-64 function — including its DIRECT self-calls
(CallSelf/CallSelfCopy) — callable through the crate::buffer::JitChain
ABI. Returns None (caller falls back to the per-piece stencil tier) on any
unsupported op (a cross-function Call, list/map ops, byte arrays, …) or a
missing terminator.
The self-call is a REAL SysV call to this same chain’s entry. The entry
address is unknown until the code is mapped, so it rides an Arc<AtomicI64>
ENTRY CELL whose address is baked into every call site (mov rax,[cell]; call rax) and which is written with chain.base() AFTER mapping — mirroring
logos_stencil_call_self’s patched-entry word (an unpatched 0 deopts). The
cell is kept alive by the returned CompiledChain.
depth_addr is the live-depth cell’s address (the caller’s ctx.depth),
matching the function tier’s wiring; the self-call increments/decrements it
and side-exits (status = 5) at [SELF_CALL_DEPTH_LIMIT].