shape_jit/jit_array.rs
1//! JIT array — Route A close.
2//!
3//! ## Route A close (ADR-006 §2.7.14 / W11-jit-new-array)
4//!
5//! Q15 resolved Route A: kinded per-element-kind `Arc<TypedArrayData>`
6//! monomorphization. The deleted `UnifiedArray` heap layout
7//! (`#[repr(C)]` with `data` / `len` / `cap` / `typed_data` /
8//! `element_kind` byte) is gone. Under Route A the JIT and VM share
9//! the `shape_value::v2::typed_array::TypedArray<T>` carrier (24-byte
10//! header: `HeapHeader` at offset 0, `*mut T` at offset 8, `len: u32`
11//! at offset 16, `cap: u32` at offset 20). Element kind is stamped at
12//! the producing call-site (`jit_v2_array_new_<kind>`) and not stored
13//! on the heap object — it lives on the `HeapValue::TypedArray(arc)`
14//! variant the `HeapHeader.kind` field discriminates (§2.7.6 / Q8
15//! single-discriminator).
16//!
17//! Cranelift offsets for the typed-array layout live inline at the
18//! consumer sites (`mir_compiler/v2_array.rs`'s `DATA_PTR_OFFSET = 8`
19//! and `LEN_OFFSET = 16`). The five legacy offset constants
20//! (`DATA_OFFSET`, `LEN_OFFSET`, `CAP_OFFSET`, `TYPED_DATA_OFFSET`,
21//! `ELEMENT_KIND_OFFSET`) that the W10-cascade close marked
22//! `#[allow(dead_code)]` are deleted — under Route A there is no
23//! ELEMENT_KIND byte on the heap, and the remaining offsets are no
24//! longer the JIT's canonical reference shape.
25//!
26//! ## Forbidden under any future expansion
27//!
28//! - `UnifiedArray` revival under any renamed shape (CLAUDE.md
29//! "Renames to refuse on sight" — broader-family regex).
30//! - `tag_bits`-based element decoder.
31//! - Bool-default fallback for unknown element kind.
32//! - Re-introducing an ELEMENT_KIND byte on the heap object — the
33//! discriminator lives on `HeapValue::TypedArray(arc)` per ADR-005
34//! §1 single-discriminator.
35
36// No public items — Route A close (W11-jit-new-array): consumers use
37// `shape_value::v2::typed_array::TypedArray<T>` directly via the
38// existing `jit_v2_array_*` FFI surface and the inline-codegen helpers
39// in `mir_compiler/v2_array.rs`.