Skip to main content

DEBUG_VALUE_STACK_SLOTS

Constant DEBUG_VALUE_STACK_SLOTS 

Source
pub const DEBUG_VALUE_STACK_SLOTS: usize = _; // 732_096usize
Expand description

The size of the debug value reservation, in slots.

Sized by its own headroom term (ADR-128 decision 3), not written as SHADOW_STACK_SLOTS: root slots are colored by live range and debug value slots stay dense, one per Gc local, so the two index spaces answer different questions and are bounded by different caps (MAX_SHADOW_SLOTS and MAX_DEBUG_VALUE_SLOTS).

Exhaustion is unrepresentable here exactly as it is on the shadow stack, and for the same reason: every generated prologue rejects stack_left < frame_cost(slots) before it claims anything, and frame_cost charges the dense count of Gc locals (ADR-128 decision 4) — which is precisely this stack’s width. So the claimed debug value slots of all live frames are bounded by MAX_LIVE_SLOTS, the same budget / FRAME_BYTES_PER_SLOT + MAX_RECURSION_DEPTH × REFERENCE_FRAME_SLOTS that bounds the shadow stack, and generated code emits no bounds check because there is nothing left to check.

The headroom term is MAX_DEBUG_VALUE_SLOTS rather than MAX_SHADOW_SLOTS, for the reason SHADOW_STACK_SLOTS keeps one at all: the Rust-side push_frame callers spend no budget, so the argument above does not cover them, and one widest frame of headroom is what covers them instead.

This is a reservation, and the weak scan (ADR-106) does not walk it. Its cost is bounded by top - base — the slots live calls have actually claimed — so raising this number costs address space and not collection time.