Skip to main content

RECLAIMED_WORD

Constant RECLAIMED_WORD 

Source
pub const RECLAIMED_WORD: usize = 1;
Expand description

The word DebugFrameStackHeader::clear_reclaimed writes over a reference slot whose object the sweep took, and the one word DebugLocalMeta::read decodes as DebugValue::Reclaimed.

§Why a reserved word costs nothing, where the zero word cost a payload

DebugSlotKind::store_bias documents the trade the unwritten state forces: a scalar slot has 2^64 payloads and 2^64 words, so reserving one word costs one payload, and the bias only chooses which. Reserving a second word here looks like the same trade and is not, because this word is only ever interpreted in a DebugSlotKind::Reference slot — and a reference slot has far fewer than 2^64 inhabitants. align_of::<GcHeader>() is 8 (asserted in crate::gc, and BLOCK_GRANULE is that same alignment), so no GcRef can ever be 1. Scalar slots keep every payload they had; Int loses only i64::MIN, to the bias, and nothing to this.

None — the other reserved word — would say “nothing was ever written here” about a slot whose value the collector had just taken. Those are different facts about the program: one is a line that never ran, the other a line that ran and whose result is simply no longer around to show.

§Not part of the ABI

Generated code only ever stores into a debug value slot (store_debug_local is a str at a fixed displacement, with no matching load), so no compiled program can observe this word — a store past the clear overwrites it, which is exactly the right behaviour if a local is written again. It is therefore not a RUNTIME_ABI_VERSION concern: this word is written and read by the runtime alone.