Skip to main content

STATE_SLOT_TAG

Constant STATE_SLOT_TAG 

Source
pub const STATE_SLOT_TAG: usize = 0;
Expand description

The state object’s layout, word-indexed: slot n is at byte offset 8 * n. async_lower.rs (Task 5) must build exactly this layout – this executor and every generated poll function address it by raw offset, with no shared Rust type to keep the two ends in sync if one of them drifts.

  • STATE_SLOT_TAG (offset 0): the resume tag. A poll function’s entry block switches on this to pick up wherever it last suspended.
  • STATE_SLOT_OUTPUT (offset 8): the output value, written exactly once, by the call that returns POLL_READY.
  • STATE_SLOT_TEMPS (offset 16) and up: one slot per MIR temp in the async fn body, unconditionally – every local is spilled here whether or not it is live across a suspend point, so no local is ever live in a register or on the stack across one.