Expand description
AST → bytecode compiler.
Layout: Main’s bytecode is emitted first (entry pc 0) and ends with Halt;
each function body is appended after it and reached via Call (an absolute
jump to its entry_pc). Function names are registered in a first pass so
forward references and (mutual) recursion resolve.
Locals are assigned registers as they are first bound; expression temporaries get fresh registers above them, so a call’s argument block never overlaps a live caller local.
Structs§
Functions§
- magic_
div_ enabled - Whether the W24 constant-divisor magic-reciprocal lowering is enabled.
Default ON (it is bit-identical to
Op::Div/Op::Modfor the proven non-negative dividend it gates on, validated by the corpus differential).LOGOS_MAGIC_DIV=0is the kill-switch — also the A/B handle for measuring the lever’s effect on a quiet box. Read once. - magic_
eval - Evaluate the magic reciprocal:
x / cwhenmul_back == 0, elsex % c(mul_back == c).xis the dividend reinterpreted asu64— sound because the op is emitted ONLY for a proven non-negativex, where the i64 bit pattern equals the mathematical value and the unsigned quotient/remainder equal the signed truncating ones. The remainder isx - q*ccomputed in wrapping i64 (the low 64 bits agree with the u64 difference), bit-exact with the kernel’swrapping_remfor non-negativex. - magic_
u64_ gen - Precompute the unsigned magic-reciprocal constants
(magic, more)for a constant divisorc(c != 0), reusing the single canonicallogicaffeine_data::LogosDivU64generator — the same algorithm the AOTcompile_to_rustpath emits, exhaustively proven against hardware//%. Themorebyte encoding (low 6 bits = shift,0x40= the 65-bit add-marker path,0x80= the pure-shift power-of-two path) is exactly whatmagic_evalconsumes. - narrow_
vm_ enabled - Narrow a
new Seq of Intwhose elements provably fiti32into half-width (Vec<i32>) VM storage — the interpreter analogue of the AOTVec<i64>→Vec<i32>narrowing, halving the array footprint and cache pressure. The JIT region path is i32-array aware (the hot region still tiers — 0 bails). PROMOTED 2026-06-21: default ON (kill-switch LOGOS_NARROW_VM=0) — graph_bfs -27.6% and array_fill -16.7% on the faithful interleaved A/B, all 33 benchmarks bit-identical, full suite 10341/10341 green, no regression.