Skip to main content

MAX_SHADOW_SLOTS

Constant MAX_SHADOW_SLOTS 

Source
pub const MAX_SHADOW_SLOTS: usize = 192;
Expand description

The maximum Gc roots a single JIT’d function may spill. The backend rejects (at compile time) any function exceeding this, through SlotCount; real Praxis functions have small root sets.

It is not what bounds the stack, and it is not a performance dial (ADR-101). The budget guard bounds every claimed slot on its own — see SHADOW_STACK_SLOTS — and this constant contributes only that reservation’s headroom term for Rust-side pushes. It appears in exactly two places that survive to run time: the size of the reservation, and SlotCount::new, which is a compile-time check. It appears in no generated code. Raising it changes the cost of no program that compiles today; it changes only which programs compile.

A frame’s root width is the number of colors its co-live root sets need, not its count of Gc locals (ADR-128), and over all 71 functions of tests/aoc-corpus the largest co-live root set is 11 — which is REFERENCE_FRAME_SLOTS. So this cap is in practice unreachable. What a programmer can still exhaust is MAX_DEBUG_VALUE_SLOTS, which bounds the thing they can see: how many Gc locals one function may have.

This is part of the contract between the backend and the runtime; bumping it is an ABI-affecting change caught by the ABI version check (§11.6) only in that the two are rebuilt together.