pub struct SlotOffset {
pub class: SlotClass,
pub word_offset: u32,
pub bit_width: u32,
pub elem_word_count: u32,
pub row_stride_words: u32,
pub num_rows: u32,
}Expand description
Compile-time layout query result STATE hands to CODEGEN (state.md §3: “baked
into compiled kernels as LLVM constants”; ledger ST-027, ST-037, ST-129,
ST-134, ST-135). Pure Rust (not #[repr(C)]) — this crosses the CODEGEN/STATE
boundary as ordinary Rust values at compile time, not as bytes across the
compiled-kernel ABI, so it has no FFI-layout obligation.
Task 7 adds PartialEq (previously Clone, Copy, Debug only): slot_of
(ST-129) is required to return a byte-identical SlotOffset across
repeated calls regardless of intervening allocate_instance calls, and
the direct field-by-field way to prove that in a test is a structural
equality check, not a Debug-string comparison. Every field is itself
PartialEq (SlotClass already derives it; the rest are plain integers),
so this is a safe, non-lossy derive addition.
Task 10 (ST-027): state.md’s original state-pointer ABI design — CODEGEN
inlining a raw compile-time base + word_offset pointer directly, bypassing
the accessor calls above — is superseded by ARCHITECTURE §7 item 1’s
accessor-ABI (ST-026). This struct’s fields stay pub and readable (CODEGEN
needs them to size/typecheck a slot at compile time — width, class, element
count), but no function anywhere in vj-sim::state hands a caller a raw
*mut/*const pointer it could add one of these fields to itself: the
actual address computation (InstanceBase + SlotOffset) happens only
inside accessor_impl::slot_location_for/write::commit_write_at, never
re-derived by a caller from these fields against a raw base pointer it also
holds.
Fields§
§class: SlotClass§word_offset: u32§bit_width: u32§elem_word_count: u32§row_stride_words: u32§num_rows: u32