Expand description
JIT-FFI bits ↔ runtime-tier carrier conversions (ADR-006 §2.7.5).
Pre-strict-typing this module bridged the JIT’s NaN-boxed u64
representation and the VM’s ValueWord (the v1 dynamic tagged word).
The Phase-2 bulldozer deleted both the ValueWord type and the
tag_bits::* discriminator family.
§Carrier shape (§2.7.5 stamp-at-compile-time)
Per ADR-006 §2.7.5 the JIT-FFI surface is (u64, NativeKind) — raw
bits plus a parallel kind companion. The kind is stamped at JIT
compile time from the call signature; it is never decoded from the
bits. Consumers that need a runtime-tier carrier wrap the pair as
KindedSlot::new(ValueSlot::from_raw(bits), kind) per §2.7.6/Q7 when
crossing into runtime-tier dispatch.
§What this module does (W11-jit-carrier-conversion close)
These functions are the bookkeeping layer between the JIT call
signature’s separate bits: u64 and kind: NativeKind parameters
(the §2.7.5 stable-FFI raw-pair shape) and the in-Rust JitFfiCarrier
tuple alias (u64, NativeKind). The body is intentionally trivial —
per §2.7.5 the conversion is identity: raw bits stay raw bits, and
the kind companion is whatever the caller’s static stamp passed in.
No decode, no probe, no is_heap() classification — the kind is
authoritative because the caller proved it at JIT compile time.
§What is forbidden
- Decoding kind from
bits(CLAUDE.md “Forbidden Patterns” #4, ADR-006 §2.7.7 #4 — the deletedtag_bitsdispatch). is_heap()/is_tagged()probe to classify (§2.7.7 #7).- Bool-default fallback when the caller didn’t supply a kind (forbidden #9 — surface-and-stop instead).
ValueWordresurrection under any name — the body’s pre-bulldozer shape decodedArc<HeapValue>from raw bits viaValueWord::clone_from_bitsand re-encoded per-arm viaValueWord::as_heap_ref/tag_bits::TAG_HEAP; all deleted.
§Historical context (pre-bulldozer body, what’s gone)
The deleted pipeline ran:
nanboxed_to_jit_bits(&ValueWord)decodedValueWordper arm (each arm atag_bits::TAG_*discriminator), produced JIT bits.jit_bits_to_nanboxed(bits)re-decoded raw bits via the sametag_bitsmachinery, constructed aValueWordviaValueWord::from_*constructors, returned it.- The
UNIFIED_HEAP_REFSthread-local accumulator captured retainedArc<HeapValue>shares fordrain_unified_heap_refs()to release at the end of each JIT call.
All three steps are gone. The retain/release path now flows through
clone_with_kind / drop_with_kind at the producing call site
(ADR-006 §2.7.7), driven by the parallel-kind track — no global
drain accumulator.
Functions§
- drain_
unified_ heap_ refs - Per-JIT-call ref-drain hook. Retained as a named export for the JIT
executor’s per-call epilogue (
executor.rs). The pre-bulldozer body drained the deletedUNIFIED_HEAP_REFSthread-local that the deletednanboxed_to_jit_bitspushedArc<HeapValue>retain-shares into. - jit_
bits_ to_ nanboxed - Pack raw JIT-FFI bits + their static
NativeKindstamp into aJitFfiCarrierper ADR-006 §2.7.5. - jit_
bits_ to_ nanboxed_ with_ ctx - Variant of
jit_bits_to_nanboxedwithJITContextaccess, retained for downstream call sites (async_ops,control,generic_builtin,data_access, etc.) that need function-name resolution from the JIT context. The ctx pointer is plumbing for caller-side lookups (function table, function names) — the carrier itself is the same(bits, kind)pair. - jit_
bits_ to_ typed_ scalar - Convert JIT NaN-boxed bits to a
TypedScalarwith an optional type hint. - nanboxed_
to_ jit_ bits - Unpack a
JitFfiCarrierback to raw JIT-FFI bits per ADR-006 §2.7.5. - typed_
scalar_ to_ jit_ bits - Convert a
TypedScalarto JIT NaN-boxed bits. Integer kinds box asbox_number(value as f64)since the JIT’s Cranelift IR uses f64 for all numeric operations internally — this is JIT-internal scalar encoding, nottag_bitsdispatch.