Expand description
Array FFI Functions for JIT
Functions for creating and manipulating arrays in JIT-compiled code.
All arrays are stored as JitAlloc<JitArray> via jit_box(HK_ARRAY, ...).
Structs§
- Array
Info - Extract array data pointer and length from a NaN-boxed array value.
Functions§
- create_
array_ from_ elements - Helper: Create a new array from elements
- get_
array_ elements - Helper: Extract elements from a NaN-boxed array (returns a clone as Vec)
- jit_
array_ filled - Create a pre-allocated array filled with a given value.
Array.filled(size, value)— equivalent tovec![value; size]. - jit_
array_ first - Get first element of array
- jit_
array_ get - Get element from array by index (supports negative indexing)
- jit_
array_ info - jit_
array_ last - Get last element of array
- jit_
array_ max - Get maximum element of numeric array
- jit_
array_ min - Get minimum element of numeric array
- jit_
array_ pop - Pop last element from array (returns new array without last element)
- jit_
array_ push - Push multiple values onto array (returns new array)
- jit_
array_ push_ elem - Push single element onto array (returns new array with element appended) Used by ArrayPush opcode in list comprehensions
- jit_
array_ push_ element - Push a single element onto an array (method call style).
Returns new array with element appended.
Used by JIT inline path for
.push(element). - jit_
array_ push_ local - Push a value into an array in-place, mutating the existing JitArray.
Returns the same array bits (the JitAlloc pointer doesn’t move; JitArray handles realloc internally).
This is O(1) amortized vs O(n) for jit_array_push_elem which copies all elements.
Used by ArrayPushLocal opcode for
x = x.push(val)optimization. - jit_
array_ reserve_ local - Ensure array capacity is at least
min_capacityelements. Returns original array bits. - jit_
array_ reverse - Reverse an array, returning a new reversed array.
Used by JIT inline path for
.reverse(). - jit_
array_ zip - Zip two arrays into array of pairs
- jit_
hof_ array_ alloc - Allocate a new empty array with pre-allocated capacity. Returns a NaN-boxed HK_ARRAY. Used by HOF inlining to pre-allocate result arrays.
- jit_
hof_ array_ push - Push a single element into an in-place array (used by HOF inlining loops). Mutates the JitArray, returns the same boxed array bits. Identical to jit_array_push_local but with a different name for clarity.
- jit_
make_ range - Create a Range object from start and end values This creates a proper Range object (not an array), used by MakeRange opcode
- jit_
new_ array - Create a new array from values on stack
- jit_
range - Create a range array [start, start+1, …, end-1]
- jit_
slice - Slice an array or string