Skip to main content

MAX_FRAME_WORDS

Constant MAX_FRAME_WORDS 

Source
pub const MAX_FRAME_WORDS: usize = 65_536;
Expand description

The most words one function’s frame may hold.

A slot operand is sixteen bits, so slots 0 through 65,535 are nameable and a frame of exactly 65,536 words is exactly encodable. ADR 0041 adopts this as a compiler limit and crate::lower is where a frame over it is refused, with a diagnostic at the declaration — never a truncation and never a wrap.

It is not the run’s stack budget. SEGMENT_WORDS bounds one whole task’s stack at 1 << 20 words and is answered at run time by Memory::push_frame; this bounds one function, at compile time, and is one sixteenth of that.