Expand description
JIT-side parallel-kind track encoding (ADR-006 §2.7.7 / Q9).
This module is the JIT-tier analog of the VM-side
Vec<NativeKind> parallel track on crates/shape-vm/src/executor/vm_impl/ stack.rs::VmStack. The JIT stores its parallel kind track as a
contiguous [u8; 512] array (JITContext.stack_kinds) so Cranelift
codegen can write a kind in lockstep with each data push via a plain
iconst(types::I8, code) + byte store, mirroring the existing 8-byte
data store at JITContext.stack[i].
The encoding is the §2.7.5 cross-crate stable-FFI raw-pair shape: each
NativeKind value (including all Ptr(HeapKind::*) arms) maps to a
single byte. The producing site stamps the code from the call signature
at JIT-compile time; the consuming FFI side decodes the byte back to
NativeKind and dispatches per ADR-006 §2.7.6 / Q8. No tag-bit decode
on the raw u64, no is_heap() probe — the kind IS the discriminator.
Forbidden under §2.7.7:
Option<NativeKind>in the track — every push has a known kind from the producing call signature; if the kind genuinely isn’t known the answer issurface-and-stop, notNone. TheSENTINELvalue is the uninitialized-slot pattern set byJITContext::default(); reading it at a pop site is a kind-source gap (forbidden #9).Vec<KindedSlot>for the stack — same §2.7.5 rule the VM-side rules out; storage stays raw u64 + parallel byte track.- 16-byte slot — would conflict with the §2.1 8-byte invariant.
- Encoding
Ptr(HeapKind)arms via a tag-bit probe on the slot’s u64 — the deleted ValueWordtag_bitsdispatch (CLAUDE.md “Forbidden Patterns” #4). Kind comes from the producing call signature, period.
Constants§
- C_BOOL
- C_CHAR
- C_
DECIMAL_ V2 - C_
FLOA T32 - C_
FLOA T64 - C_INT8
- C_INT16
- C_INT32
- C_INT64
- C_
INTSIZE - C_NULL
- C_
NULLABLE_ FLOA T64 - C_
NULLABLE_ INT8 - C_
NULLABLE_ INT16 - C_
NULLABLE_ INT32 - C_
NULLABLE_ INT64 - C_
NULLABLE_ INTSIZE - C_
NULLABLE_ UINT8 - C_
NULLABLE_ UINT16 - C_
NULLABLE_ UINT32 - C_
NULLABLE_ UINT64 - C_
NULLABLE_ UINTSIZE - C_
STRING - C_
STRING_ V2 - C_UINT8
- C_
UINT16 - C_
UINT32 - C_
UINT64 - C_
UINTSIZE - PTR_
BASE - Base code for
Ptr(HeapKind::*)arms. EachHeapKindordinal is added toPTR_BASEto produce the byte. With HeapKind ordinals 0..=28 today the Ptr-range is128..=156, well clear of the scalar codes0..=23and theSENTINEL = 255. - SENTINEL
- Sentinel byte for uninitialized stack slots (matches
JITContext::default()initialization). Reading this at a pop site is a kind-source gap per ADR-006 §2.7.7 #9 — surface, do not Bool-default.