pub enum Opcode {
Show 131 variants
PushNull,
PushBool(bool),
PushInt(i64),
PushFloat(f64),
PushStr(Arc<str>),
PushRoot,
PushCurrent,
GetField(Arc<str>),
GetIndex(i64),
GetSlice(Option<i64>, Option<i64>),
DynIndex(Arc<Program>),
OptField(Arc<str>),
Descendant(Arc<str>),
DescendAll,
InlineFilter(Arc<Program>),
Quantifier(QuantifierKind),
RootChain(Arc<[Arc<str>]>),
FieldChain(Arc<FieldChainData>),
FilterCount(Arc<Program>),
FindFirst(Arc<Program>),
FindOne(Arc<Program>),
FilterMap {
pred: Arc<Program>,
map: Arc<Program>,
},
FilterFilter {
p1: Arc<Program>,
p2: Arc<Program>,
},
MapMap {
f1: Arc<Program>,
f2: Arc<Program>,
},
MapFilter {
map: Arc<Program>,
pred: Arc<Program>,
},
MapSum(Arc<Program>),
MapToJsonJoin {
sep_prog: Arc<Program>,
},
StrTrimUpper,
StrTrimLower,
StrUpperTrim,
StrLowerTrim,
StrSplitReverseJoin {
sep: Arc<str>,
},
MapReplaceLit {
needle: Arc<str>,
with: Arc<str>,
all: bool,
},
MapUpperReplaceLit {
needle: Arc<str>,
with: Arc<str>,
all: bool,
},
MapLowerReplaceLit {
needle: Arc<str>,
with: Arc<str>,
all: bool,
},
MapStrConcat {
prefix: Arc<str>,
suffix: Arc<str>,
},
MapSplitLenSum {
sep: Arc<str>,
},
MapProject {
keys: Arc<[Arc<str>]>,
ics: Arc<[AtomicU64]>,
},
MapStrSlice {
start: i64,
end: Option<i64>,
},
MapFString(Arc<[CompiledFSPart]>),
MapSplitCount {
sep: Arc<str>,
},
MapSplitCountSum {
sep: Arc<str>,
},
MapSplitFirst {
sep: Arc<str>,
},
MapSplitNth {
sep: Arc<str>,
n: usize,
},
MapAvg(Arc<Program>),
FilterMapSum {
pred: Arc<Program>,
map: Arc<Program>,
},
FilterMapAvg {
pred: Arc<Program>,
map: Arc<Program>,
},
FilterMapFirst {
pred: Arc<Program>,
map: Arc<Program>,
},
FilterMapMin {
pred: Arc<Program>,
map: Arc<Program>,
},
FilterMapMax {
pred: Arc<Program>,
map: Arc<Program>,
},
FilterLast {
pred: Arc<Program>,
},
TopN {
n: usize,
asc: bool,
},
UniqueCount,
ArgExtreme {
key: Arc<Program>,
lam_param: Option<Arc<str>>,
max: bool,
},
MapFlatten(Arc<Program>),
MapFirst(Arc<Program>),
MapLast(Arc<Program>),
MapMin(Arc<Program>),
MapMax(Arc<Program>),
MapFieldSum(Arc<str>),
MapFieldAvg(Arc<str>),
MapFieldMin(Arc<str>),
MapFieldMax(Arc<str>),
MapField(Arc<str>),
MapFieldChain(Arc<[Arc<str>]>),
MapFieldUnique(Arc<str>),
MapFieldChainUnique(Arc<[Arc<str>]>),
FlatMapChain(Arc<[Arc<str>]>),
FilterFieldEqLit(Arc<str>, Val),
FilterFieldCmpLit(Arc<str>, BinOp, Val),
FilterFieldCmpField(Arc<str>, BinOp, Arc<str>),
FilterFieldEqLitMapField(Arc<str>, Val, Arc<str>),
FilterFieldCmpLitMapField(Arc<str>, BinOp, Val, Arc<str>),
FilterFieldsAllEqLitCount(Arc<[(Arc<str>, Val)]>),
FilterFieldsAllCmpLitCount(Arc<[(Arc<str>, BinOp, Val)]>),
FilterFieldEqLitCount(Arc<str>, Val),
FilterFieldCmpLitCount(Arc<str>, BinOp, Val),
FilterFieldCmpFieldCount(Arc<str>, BinOp, Arc<str>),
FilterCurrentCmpLit(BinOp, Val),
FilterStrVecStartsWith(Arc<str>),
FilterStrVecEndsWith(Arc<str>),
FilterStrVecContains(Arc<str>),
MapStrVecUpper,
MapStrVecLower,
MapStrVecTrim,
MapNumVecArith {
op: BinOp,
lit: Val,
flipped: bool,
},
MapNumVecNeg,
GroupByField(Arc<str>),
CountByField(Arc<str>),
UniqueByField(Arc<str>),
FilterTakeWhile {
pred: Arc<Program>,
stop: Arc<Program>,
},
FilterDropWhile {
pred: Arc<Program>,
drop: Arc<Program>,
},
MapUnique(Arc<Program>),
EquiJoin {
rhs: Arc<Program>,
lhs_key: Arc<str>,
rhs_key: Arc<str>,
},
LoadIdent(Arc<str>),
Add,
Sub,
Mul,
Div,
Mod,
Eq,
Neq,
Lt,
Lte,
Gt,
Gte,
Fuzzy,
Not,
Neg,
CastOp(CastType),
AndOp(Arc<Program>),
OrOp(Arc<Program>),
CoalesceOp(Arc<Program>),
CallMethod(Arc<CompiledCall>),
CallOptMethod(Arc<CompiledCall>),
MakeObj(Arc<[CompiledObjEntry]>),
MakeArr(Arc<[Arc<Program>]>),
FString(Arc<[CompiledFSPart]>),
KindCheck {
ty: KindType,
negate: bool,
},
SetCurrent,
BindVar(Arc<str>),
StoreVar(Arc<str>),
BindObjDestructure(Arc<BindObjSpec>),
BindArrDestructure(Arc<[Arc<str>]>),
LetExpr {
name: Arc<str>,
body: Arc<Program>,
},
IfElse {
then_: Arc<Program>,
else_: Arc<Program>,
},
ListComp(Arc<CompSpec>),
DictComp(Arc<DictCompSpec>),
SetComp(Arc<CompSpec>),
GetPointer(Arc<str>),
PatchEval(Arc<Expr>),
}Variants§
PushNull
PushBool(bool)
PushInt(i64)
PushFloat(f64)
PushStr(Arc<str>)
PushRoot
PushCurrent
GetField(Arc<str>)
GetIndex(i64)
GetSlice(Option<i64>, Option<i64>)
DynIndex(Arc<Program>)
OptField(Arc<str>)
Descendant(Arc<str>)
DescendAll
InlineFilter(Arc<Program>)
Quantifier(QuantifierKind)
RootChain(Arc<[Arc<str>]>)
PushRoot + GetField* fused — resolves chain via pointer arithmetic.
FieldChain(Arc<FieldChainData>)
GetField(k1) + GetField(k2) + … fused — walks TOS through N fields.
Applies mid-program where RootChain does not match (e.g. after a
method call or filter produces an object on stack).
Carries a per-step inline-cache array so that map(a.b.c) over a
shape-uniform array of objects hits get_index(cached_slot)
instead of re-hashing the key at every iteration.
FilterCount(Arc<Program>)
filter(pred) + len/count fused — counts matches without temp array.
FindFirst(Arc<Program>)
filter(pred) + First quantifier fused — early-exit on first match.
FindOne(Arc<Program>)
filter(pred) + One quantifier fused — early-exit at 2nd match (error).
FilterMap
filter(pred) + map(f) fused — single pass, no intermediate array.
FilterFilter
filter(p1) + filter(p2) fused — single pass, both predicates.
MapMap
map(f1) + map(f2) fused — single pass, composed.
MapFilter
map(f) + filter(p) fused — single pass; emit f(x) only when p(f(x)) holds.
MapSum(Arc<Program>)
Fused map(f).sum() — evaluates f per item, accumulates numeric sum.
MapToJsonJoin
Fused map(@.to_json()).join(sep) — single-pass stringify + concat.
Skips the intermediate VecVal::Str (N Arc allocations) and writes
each item’s JSON form straight into one output buffer. Columnar
receivers (Val::IntVec / Val::FloatVec) shortcut further via
native number-formatting in a tight loop.
StrTrimUpper
Fused .trim().upper() — one allocation instead of two, ASCII fast-path.
StrTrimLower
Fused .trim().lower() — one allocation instead of two, ASCII fast-path.
StrUpperTrim
Fused .upper().trim() — one allocation instead of two.
StrLowerTrim
Fused .lower().trim() — one allocation instead of two.
StrSplitReverseJoin
Fused .split(sep).reverse().join(sep) — byte-scan segments and
emit reversed join into one buffer. No intermediate Vec<Arc<str>>.
MapReplaceLit
Fused map(@.replace(lit, lit)) (and replace_all) — literal needle
and replacement inlined; skips per-item sub_prog evaluation for arg
strings. all=true means replace every occurrence, else only first.
MapUpperReplaceLit
Fused map(@.upper().replace(lit, lit)) (and replace_all) — scan
bytes once: ASCII-upper + memchr needle scan into a single pre-sized
output String per item. Falls back to non-ASCII path for Unicode.
MapLowerReplaceLit
Fused map(@.lower().replace(lit, lit)) (and replace_all) — same as
above but ASCII-lower.
MapStrConcat
Fused map(prefix + @ + suffix) — per item, allocate exact-size
Arc<str> with one uninit slice + copy_nonoverlapping. Either
prefix or suffix may be empty for the 2-operand forms.
MapSplitLenSum
Fused map(@.split(sep).map(len).sum()) — emits IntVec of per-row
sum-of-segment-char-lengths. Uses byte-scan (memchr/memmem) for ASCII
source; falls back to char counting for Unicode.
MapProject
Fused map({k1, k2, ..}) — map over an array projecting each object
to a fixed set of Short-form fields (bare identifiers). Avoids the
nested MakeObj dispatch per row and hoists key Arc<str> clones
outside the inner loop. Uses one IC slot per key for shape lookup.
MapStrSlice
Fused map(@.slice(lit, lit)) — per-row ASCII byte-range slice via
borrowed Val::StrSlice into the parent Arc. Non-ASCII rows fall
through to character-index resolution. Zero allocation per row
when the input is already Val::Str (just an Arc bump for the
borrowed view).
MapFString(Arc<[CompiledFSPart]>)
Fused map(f"…") — map over an array applying an f-string to each
element. Skips the inner CallMethod dispatch / FString Arc-clone
per row; runs the f-string parts in a tight loop.
MapSplitCount
Fused map(@.split(sep).count()) — byte-scan per row, returns Int;
zero per-row allocations.
MapSplitCountSum
Fused map(@.split(sep).count()).sum() — scalar Int, no intermediate
[Int,Int,...] array. One memchr-backed scan per row, accumulated.
MapSplitFirst
Fused map(@.split(sep).first()) — first segment only; one Arc per
row instead of N.
MapSplitNth
Fused map(@.split(sep).nth(n)) — nth segment; one Arc per row.
MapAvg(Arc<Program>)
Fused map(f).avg() — evaluates f per item, computes mean as float.
FilterMapSum
Fused filter(p).map(f).sum() — single pass, numeric sum of mapped
values that pass the predicate. No intermediate array.
FilterMapAvg
Fused filter(p).map(f).avg() — mean as float over mapped values
that pass the predicate.
FilterMapFirst
Fused filter(p).map(f).first() — early-exit: apply map once,
to the first item that satisfies pred.
FilterMapMin
Fused filter(p).map(f).min() — single pass, numeric min over
mapped values that pass the predicate. No intermediate array.
FilterMapMax
Fused filter(p).map(f).max() — single pass, numeric max over
mapped values that pass the predicate.
FilterLast
Fused filter(p).last() — reverse scan, return last item
satisfying pred (or Null when none match / input is Null).
TopN
Fused sort() + [0:n] — partial-sort smallest N using BinaryHeap.
asc=true → smallest N; asc=false → largest N.
UniqueCount
Fused unique() + count()/len() — count distinct elements without
materialising the deduped array.
ArgExtreme
Fused sort_by(k).first() / .last() — O(N) single pass instead of
an O(N log N) sort followed by discard. Preserves stable-sort ordering:
max=false returns the earliest item whose key is minimal
(matches sort_by(k).first()); max=true returns the latest item
whose key is maximal (matches sort_by(k).last()).
MapFlatten(Arc<Program>)
Fused map(f).flatten() — single-pass concat of mapped arrays.
MapFirst(Arc<Program>)
Fused map(f).first() — apply f only to the first element.
Empty input → Null (matches plain first() on []).
MapLast(Arc<Program>)
Fused map(f).last() — apply f only to the last element.
MapMin(Arc<Program>)
Fused map(f).min() — single-pass numeric min over mapped values.
MapMax(Arc<Program>)
Fused map(f).max() — single-pass numeric max over mapped values.
MapFieldSum(Arc<str>)
map(k).sum() where k is a single field ident. Skips sub-program exec.
MapFieldAvg(Arc<str>)
map(k).avg() where k is a single field ident.
MapFieldMin(Arc<str>)
map(k).min() where k is a single field ident.
MapFieldMax(Arc<str>)
map(k).max() where k is a single field ident.
MapField(Arc<str>)
map(k) where k is a single field ident — emit array of field values.
MapFieldChain(Arc<[Arc<str>]>)
map(a.b.c) on arr-of-obj → walk chain per item, push resulting
Val (Null if any step hits a non-Obj or missing key).
MapFieldUnique(Arc<str>)
map(k).unique() where k is a single field ident. FxHashSet dedup.
MapFieldChainUnique(Arc<[Arc<str>]>)
map(a.b.c).unique() — walk chain + inline dedup, no intermediate array.
FlatMapChain(Arc<[Arc<str>]>)
.map(k1).flatten().map(k2).flatten()… collapsed into a single walk.
Input is an array of objects; each step descends the named array-valued
field and concatenates. N levels → N+1 buffers (current+next) instead
of 2N allocations.
FilterFieldEqLit(Arc<str>, Val)
filter(k == lit) — predicate is equality of a single field to a literal.
FilterFieldCmpLit(Arc<str>, BinOp, Val)
filter(k <op> lit) — predicate is a comparison of a single field to a literal.
FilterFieldCmpField(Arc<str>, BinOp, Arc<str>)
filter(k1 <op> k2) — predicate compares two fields of the same item.
FilterFieldEqLitMapField(Arc<str>, Val, Arc<str>)
filter(kp == lit).map(kproj) fused — single pass, no intermediate array.
FilterFieldCmpLitMapField(Arc<str>, BinOp, Val, Arc<str>)
filter(kp <cop> lit).map(kproj) fused — single pass, no intermediate array.
FilterFieldsAllEqLitCount(Arc<[(Arc<str>, Val)]>)
filter(f1 == l1 AND f2 == l2 AND …).count() fused — zero alloc,
one IC slot per conjunct field.
FilterFieldsAllCmpLitCount(Arc<[(Arc<str>, BinOp, Val)]>)
filter(f1 <o1> l1 AND f2 <o2> l2 AND …).count() fused — general cmp.
FilterFieldEqLitCount(Arc<str>, Val)
filter(k == lit).count() — count without materialising.
FilterFieldCmpLitCount(Arc<str>, BinOp, Val)
filter(k <op> lit).count() — count cmp without materialising.
FilterFieldCmpFieldCount(Arc<str>, BinOp, Arc<str>)
filter(k1 <op> k2).count() — cross-field count.
FilterCurrentCmpLit(BinOp, Val)
filter(@ <op> lit) — predicate on the current element itself.
Columnar fast path: IntVec/FloatVec receivers loop on the raw
slice and emit a typed vec; Arr falls back to element iteration.
FilterStrVecStartsWith(Arc<str>)
filter(@.starts_with(lit)) — columnar prefix compare on StrVec.
FilterStrVecEndsWith(Arc<str>)
filter(@.ends_with(lit)) — columnar suffix compare on StrVec.
FilterStrVecContains(Arc<str>)
filter(@.contains(lit)) — SIMD substring (memchr::memmem) on StrVec.
MapStrVecUpper
map(@.upper()) — ASCII-fast in-lane StrVec→StrVec.
MapStrVecLower
map(@.lower()) — ASCII-fast in-lane StrVec→StrVec.
MapStrVecTrim
map(@.trim()) — in-lane StrVec→StrVec.
MapNumVecArith
map(@ <op> lit) / map(lit <op> @) — columnar arith over
IntVec / FloatVec receivers. flipped=true means the literal is
on the LHS (matters for Sub/Div). Output lane:
IntVec × Int × {Add,Sub,Mul,Mod} → IntVec
IntVec × Int × Div → FloatVec
IntVec × Float × * → FloatVec
FloatVec × Int/Float × * → FloatVec
MapNumVecNeg
map(-@) — unary negation per element, preserves lane.
GroupByField(Arc<str>)
group_by(k) where k is a single field ident. Uses FxHashMap with
primitive-key fast path.
CountByField(Arc<str>)
.count_by(k) with trivial field key — per-row obj.get(k) instead
of lambda dispatch; builds Val::Obj<Arc
UniqueByField(Arc<str>)
.unique_by(k) with trivial field key — per-row obj.get(k) direct.
FilterTakeWhile
Fused filter(p).take_while(q) — scan while both predicates hold.
FilterDropWhile
Fused filter(p).drop_while(q) — skip leading matches of q on
p-filtered elements.
MapUnique(Arc<Program>)
Fused map(f).unique() — apply f and dedup by resulting value.
EquiJoin
Fused equi-join: TOS is lhs array; rhs program evaluates
to rhs array; join by (lhs_key, rhs_key) string field names.
Produces array of merged objects (rhs wins on collision).
LoadIdent(Arc<str>)
Add
Sub
Mul
Div
Mod
Eq
Neq
Lt
Lte
Gt
Gte
Fuzzy
Not
Neg
CastOp(CastType)
AndOp(Arc<Program>)
OrOp(Arc<Program>)
CoalesceOp(Arc<Program>)
CallMethod(Arc<CompiledCall>)
CallOptMethod(Arc<CompiledCall>)
MakeObj(Arc<[CompiledObjEntry]>)
MakeArr(Arc<[Arc<Program>]>)
FString(Arc<[CompiledFSPart]>)
KindCheck
SetCurrent
Pop TOS → env.current, then push it back (pass-through with context update).
BindVar(Arc<str>)
TOS → env var by name, TOS remains (for -> bind).
StoreVar(Arc<str>)
Pop TOS → env var (for let init).
BindObjDestructure(Arc<BindObjSpec>)
Object destructure bind: TOS obj → multiple vars.
BindArrDestructure(Arc<[Arc<str>]>)
Array destructure bind: TOS arr → multiple vars.
LetExpr
IfElse
Python-style ternary: TOS is cond; branch into then_ or else_.
Short-circuits — only the taken branch is executed.