Expand description
JIT-side value-encoding helpers (NaN-box layout used by JIT-emitted code).
Per ADR-006 §2.7.5, the JIT FFI boundary carries raw u64 plus a parallel
NativeKind companion stamped at JIT compile time from the call signature.
The constants and helpers in this module are JIT-internal: they encode the
sentinel u64 layout that JIT-emitted Cranelift code uses for inline scalars
(TAG_NULL, TAG_BOOL_*, TAG_UNIT, TAG_DATA_ROW) and the JitAlloc /
UnifiedValue pointer shape for heap values.
The deleted shape_value::tag_bits::*, shape_value::ValueWord*,
shape_value::ValueBits, shape_value::unified_string, and
shape_value::unified_wrapper references that this file previously
relied on were retired by the strict-typing bulldozer (Phase 2). The
tag constants below are defined locally with the exact u64 layout the
JIT-emitted code already targets — they are not a “tag_bits restoration
shim” (forbidden per W10 playbook §3) but the JIT-internal sentinel
encoding that survives §2.7.5’s stable-FFI rule (raw u64 ABI, no
runtime kind discrimination from the bits themselves; consumers that
need a runtime-tier carrier wrap the bits as
KindedSlot::new(ValueSlot::from_raw(bits), kind) per §2.7.5/Q7).
Heap-pointer values produced by box_string / box_ok / box_err /
box_some / box_typed_object / box_column_ref use the
jit_kinds::unified_box shape: a UnifiedValue<T> heap allocation with
a kind: u16 prefix at offset 0, readable via
jit_kinds::read_heap_kind (per §2.7.5: this is not tag-bit dispatch —
it reads a field from a heap-resident struct). The HK_* constants
mirror HeapKind ordinals (cast to u16) for use as the prefix.
Constants§
- CANONICAL_
NAN - IEEE-754 canonical quiet NaN (positive sign).
- HEAP_
PTR_ MASK - HK_
ARRAY - HK_
BIG_ INT - HK_
BOOL_ ARRAY - HK_
CLOSURE - HK_
COLUMN_ REF - HK_
DATATABLE - HK_
DATA_ DATETIME_ REF - HK_
DATA_ REFERENCE - HK_
DATETIME_ EXPR - HK_
DECIMAL - HK_
DURATION - HK_ENUM
- HK_ERR
- HK_
EXPR_ PROXY - HK_
F32_ ARRAY - HK_
FILTER_ EXPR - HK_
FLOAT_ ARRAY - HK_
FLOAT_ ARRAY_ SLICE - HK_
FUNCTION_ REF - HK_
FUTURE - HK_
HASHMAP - HK_
HOST_ CLOSURE - HK_
I8_ ARRAY - HK_
I16_ ARRAY - HK_
I32_ ARRAY - HK_
INDEXED_ TABLE - HK_
INT_ ARRAY - HK_
MATRIX - HK_OK
- HK_
PRINT_ RESULT - HK_
RANGE - HK_
ROW_ VIEW - HK_
SIMULATION_ CALL - HK_SOME
- HK_
STRING - HK_
TASK_ GROUP - HK_TIME
- HK_
TIMEFRAME - HK_
TIMESPAN - HK_
TIME_ REFERENCE - HK_
TRAIT_ OBJECT - HK_
TYPED_ OBJECT - HK_
TYPED_ TABLE - HK_
TYPE_ ANNOTATED_ VALUE - HK_
TYPE_ ANNOTATION - HK_
U8_ ARRAY - HK_
U16_ ARRAY - HK_
U32_ ARRAY - HK_
U64_ ARRAY - I48_MAX
i48payload range — JIT inline-int encoding fits in 48 bits.- I48_MIN
- JIT_
LEGACY_ HK_ BASE - NAN_
BASE - NaN base: all 1s in exponent (bits 62-52). Used for number detection.
- PAYLOAD_
MASK - 48-bit payload mask.
- TAG_
BASE - Tagged-value base: negative-NaN exponent + sign bit.
- TAG_
BOOL_ FALSE - Boolean false. Uses shared TAG_BOOL (0b010) with payload 0.
- TAG_
BOOL_ TRUE - Boolean true. Uses shared TAG_BOOL (0b010) with payload 1.
- TAG_
DATA_ ROW - Data row tag: uses the shared TAG_INT (0b001) encoding in negative NaN space. Row indices are stored as i48 in the 48-bit payload.
- TAG_
MASK - 16-bit tag mask – used for legacy positive-NaN tag discrimination in translator IR.
- TAG_
NONE - None sentinel — alias for
TAG_NULL(Option::NoneJIT representation). Re-exported underTAG_NONEfor legacy callers. - TAG_
NULL - Null/None value. Uses shared TAG_NONE (0b011).
- TAG_
NUMBER - Number tag sentinel (not a real tag – numbers are plain f64).
- TAG_
SHIFT - Bit shift for the 3-bit inline-tag field at bits 50-48.
- TAG_
UNIT - Unit (void return). Uses shared TAG_UNIT (0b100).
- UNIFIED_
HEAP_ FLAG - Bit-47 marker for unified-heap pointers; legacy bit retained for the
JIT consumer migration window where some helpers still discriminate the
pointer shape. Per Band 1 close (§2.7.5): the discriminator no longer
gates kind decode — both shapes are raw
Box::into_rawpointers and the kind flows through the parallelNativeKindcompanion. - UNIFIED_
PTR_ MASK
Functions§
- box_
bool - Box a boolean into a NaN-boxed u64 (shared scheme).
- box_
column_ ref - box_
column_ result - Box a
Vec<f64>as a new column reference. - box_
data_ row - Box a row index as a data row reference using shared TAG_INT encoding.
- box_err
- box_
function - Box an inline function reference (shared TAG_FUNCTION, payload = function_id).
- box_
number - Box a number into a NaN-boxed u64.
- box_ok
- box_
some - box_str
- Box a &str as a unified heap string value.
- box_
string - Box a String as a unified heap string value.
- box_
typed_ object - extract_
column ⚠ - Extract a
&[f64]slice from a NaN-boxed column reference. - heap_
kind - Get the heap kind of a value, or None if not a heap value.
- is_
column_ ref - is_
data_ row - Check if a value is a data row reference. Data rows use the shared TAG_INT encoding (tag bits 50-48 == 0b001).
- is_
err_ tag - is_heap
- Check if a value has TAG_HEAP (tag bits 50-48 == 0, in negative NaN space).
- is_
heap_ kind - Check if a value is a heap value with a specific kind.
- is_
inline_ function - Check if a value is an inline function reference.
- is_
none_ tag - is_
number - Check if a value is a plain f64 number (not NaN-boxed with any tag). All tags live in negative NaN space (sign bit = 1).
- is_
ok_ tag - is_
option_ tag - is_
result_ tag - is_
some_ tag - is_
typed_ object - unbox_
column_ ⚠ref - unbox_
data_ row - Extract the row index from a data row reference (TAG_INT payload).
- unbox_
function_ id - Extract function_id from an inline function reference.
- unbox_
heap_ pointer - Extract the raw pointer from a TAG_HEAP value (points to JitAlloc header).
- unbox_
number - Unbox a number (assumes value is a number – check with
is_number()first). - unbox_
result_ ⚠inner - unbox_
result_ pointer - unbox_
some_ ⚠inner - unbox_
string ⚠ - Read a string from a NaN-boxed heap value.
- unbox_
typed_ object