pub const MAX_DEBUG_VALUE_SLOTS: usize = 4096;Expand description
The maximum Gc locals a single JIT’d function may have — the bound on the
dense index space the crash debugger reads (ADR-128 decision 3).
This is a different index space from the shadow slots, so it has its own
bound: root slots are as many as a function’s co-live root sets need, debug
value slots are one per Gc local, in MIR local order, so that the debugger
can render a local the program has finished with.
It is sized for the thing it limits: how many Gc locals a function may
have, which is a property of the source text a programmer can see and can
act on. A bound of 192 would bite — bfs’s and vm’s entry points are
already at 178 and 185 locals, and a 40-line function of twenty
var v = [1, 2, 3] / out(v.len()) pairs reaches it while its largest
co-live root set is 2.
The cost of the headroom is address space and nothing else, and it is
one reservation’s, not two: only
DEBUG_VALUE_STACK_SLOTS carries
it, at (4096 − 192) × 8 = 30.5 KiB over SHADOW_STACK_SLOTS.
SlotStack::new allocates zeroed, which for the shadow stack’s raw
pointers is an mmap of untouched zero pages, so resident memory tracks how
wide programs actually are.