Skip to main content

shape_jit/ffi/call_method/
array.rs

1//! Array method implementations for JIT — surface-and-stop.
2//!
3//! ## Status: SURFACE (ADR-006 §2.7.4 / W10 jit-playbook §5)
4//!
5//! All array method dispatch (`length`, `first`, `last`, `slice`,
6//! `reverse`, `sort`, `unique`, `concat`, `flatten`, `take`, `drop`,
7//! `join`, `sum`/`avg`/`min`/`max`, `includes`/`indexOf`) walked the
8//! deleted `JitArray` heap layout via `from_heap_bits` /
9//! `from_slice` / `from_vec`. The kinded rebuild reads the receiver
10//! as `Arc<TypedArrayData>` per-element-kind arm (§2.7.6/Q8) and
11//! dispatches each method on the JIT-stamped element kind (§2.7.5)
12//! — every aggregator (sum/min/max/...) becomes a per-kind native
13//! arithmetic loop with no element-bit unboxing.
14
15/// Call a method on an array value.
16///
17/// SURFACE (W10 jit-playbook §5 / ADR-006 §2.7.4): the entire
18/// method-dispatch table walked the deleted `JitArray` heap layout
19/// (`from_heap_bits` decode + per-method `from_slice`/`from_vec`
20/// allocations). Kinded rebuild reads `Arc<TypedArrayData>` per the
21/// receiver's stamped `NativeKind::Ptr(HeapKind::TypedArray)` companion
22/// and dispatches per-element-kind through §2.7.6/Q8.
23#[inline(always)]
24pub fn call_array_method(_receiver_bits: u64, _method_name: &str, _args: &[u64]) -> u64 {
25    todo!(
26        "phase-2c §2.7.4 / W10 jit-playbook §5: JitArray rebuild — \
27         call_array_method. The deleted UnifiedArray heap layout \
28         (`JitArray::from_heap_bits`, `from_slice`, `from_vec`) \
29         blocks every array method; kinded rebuild reads \
30         `Arc<TypedArrayData>` per-element-kind arm per ADR-006 \
31         §2.7.6/Q8."
32    )
33}