0x0LearnReferenceLibraries0x0.jmp0x1b.com

Inlining, Unrolling, Tail Calls, And Low-Level Control

This page explains the native optimizer controls that decide when 0x0 may

inline a call, unroll a loop, or verify a required no-stack-growth tail call.

The bounded gates are:


make native-inlining-check
make loop-unroll-check
make tail-call-check

They validate the source-owned control rules, positive and negative fixtures,

generated explain report, benchmark rows, compatibility contract, public docs,

and ADR/RFC records.

Evidence Files

release/native-control-decisions.tsv is the explain report. It records every

accepted and rejected inline, unroll, and tail-call decision with cost, size,

stack, factor, proof, guard, and reason fields.

Inlining

Inlining replaces a call with the callee body only when the call is small enough

and safe enough. The current production policy checks:

The default policy rejects effectful and volatile inlining because moving a call

body can change when effects happen or how many volatile operations execute.

Important diagnostics:


NATIVE_CONTROL_INLINE_RECURSIVE
NATIVE_CONTROL_INLINE_BUDGET
NATIVE_CONTROL_EFFECT
NATIVE_CONTROL_VOLATILE
NATIVE_CONTROL_ATTRIBUTE

Loop Unrolling

Loop unrolling duplicates a loop body a fixed number of times. The bounded

unroller only accepts finite known trip counts with a factor inside the

configured budget.

The current policy rejects:

Important diagnostics:


NATIVE_CONTROL_UNROLL_BOUNDS
NATIVE_CONTROL_UNROLL_BUDGET
NATIVE_CONTROL_VOLATILE
NATIVE_CONTROL_EFFECT
NATIVE_CONTROL_ATTRIBUTE

Required Tail Calls

A required tail call is a correctness promise: it must not grow the stack. 0x0

therefore treats no-stack-growth as a verifier requirement, not a hint.

The verifier accepts a required tail call only when all of these are true:

Important diagnostics:


NATIVE_CONTROL_TAIL_POSITION
NATIVE_CONTROL_TAIL_ABI
NATIVE_CONTROL_TAIL_CLEANUP
NATIVE_CONTROL_TAIL_LIFETIME
NATIVE_CONTROL_TAIL_TARGET
NATIVE_CONTROL_TAIL_STACK

What This Does Not Overpromise

These gates prove the optimizer-control decisions and required-tail verifier

rules. Later native machine-code and backend milestones must still prove the

actual emitted instruction sequences, stack-depth behavior, and target-specific

machine constraints before a release can claim machine-code parity across all

targets.