pub struct Match<Cfg: EGraphConfig> {
pub nodes: Vec<Option<Cfg::G>>,
pub mults: Vec<Cfg::M>,
pub lit_vals: Vec<Cfg::V>,
pub seq_pool: Vec<Cfg::G>,
pub seq_spans: Vec<(<Cfg as EGraphConfig>::Index, <Cfg as EGraphConfig>::Index)>,
pub set_pool: Vec<Cfg::G>,
pub set_spans: Vec<(<Cfg as EGraphConfig>::Index, <Cfg as EGraphConfig>::Index)>,
pub mset_pool: Vec<Cfg::C>,
pub mset_spans: Vec<(<Cfg as EGraphConfig>::Index, <Cfg as EGraphConfig>::Index)>,
}Fields§
§nodes: Vec<Option<Cfg::G>>E-node bindings indexed by VarId.
mults: Vec<Cfg::M>Multiplicity bindings indexed by MultVarId.
lit_vals: Vec<Cfg::V>Literal value bindings indexed by LitValVarId.
seq_pool: Vec<Cfg::G>Sequence rest pool — all seq slices packed contiguously.
seq_spans: Vec<(<Cfg as EGraphConfig>::Index, <Cfg as EGraphConfig>::Index)>Span (start, len) into seq_pool, indexed by SeqVarId.
set_pool: Vec<Cfg::G>Set rest pool — all set slices packed contiguously.
set_spans: Vec<(<Cfg as EGraphConfig>::Index, <Cfg as EGraphConfig>::Index)>Span (start, len) into set_pool, indexed by SetVarId.
mset_pool: Vec<Cfg::C>Multiset rest pool — packed AC children (id + mult).
mset_spans: Vec<(<Cfg as EGraphConfig>::Index, <Cfg as EGraphConfig>::Index)>Span (start, len) into mset_pool, indexed by MsetVarId.
Implementations§
Source§impl<Cfg: EGraphConfig> Match<Cfg>
impl<Cfg: EGraphConfig> Match<Cfg>
pub fn new(shape: &MatchShape) -> Self
pub fn get(&self, v: VarId) -> Cfg::G
pub fn set(&mut self, v: VarId, val: Cfg::G)
pub fn clear(&mut self, v: VarId)
Sourcepub fn get_opt(&self, v: VarId) -> Option<Cfg::G>
pub fn get_opt(&self, v: VarId) -> Option<Cfg::G>
Read the raw binding (bound value or None). For save/restore of a slot that may
already be bound (the bound-node re-join in leapfrog_join).
Sourcepub fn set_opt(&mut self, v: VarId, val: Option<Cfg::G>)
pub fn set_opt(&mut self, v: VarId, val: Option<Cfg::G>)
Restore a raw binding saved by get_opt.
Sourcepub fn resolve_pv<S: Copy>(
&self,
pv: PatVar,
globals: &GlobalCtx<S, Cfg::G>,
) -> Cfg::G
pub fn resolve_pv<S: Copy>( &self, pv: PatVar, globals: &GlobalCtx<S, Cfg::G>, ) -> Cfg::G
Resolve a PatVar: local from env, global from GlobalCtx.
pub fn get_mult(&self, v: MultVarId) -> Cfg::M
pub fn set_mult(&mut self, v: MultVarId, val: Cfg::M)
pub fn get_lit_val(&self, v: LitValVarId) -> Cfg::V
pub fn set_lit_val(&mut self, v: LitValVarId, val: Cfg::V)
pub fn seq_slice(&self, v: SeqVarId) -> &[Cfg::G]
pub fn push_seq(&mut self, v: SeqVarId, data: &[Cfg::G])
pub fn pop_seq(&mut self, v: SeqVarId)
pub fn set_slice(&self, v: SetVarId) -> &[Cfg::G]
pub fn push_set(&mut self, v: SetVarId, data: &[Cfg::G])
pub fn pop_set(&mut self, v: SetVarId)
pub fn mset_slice(&self, v: MsetVarId) -> &[Cfg::C]
pub fn push_mset(&mut self, v: MsetVarId, data: &[Cfg::C])
pub fn pop_mset(&mut self, v: MsetVarId)
Sourcepub fn push_mset_residual(
&mut self,
v: MsetVarId,
residual: &[(Cfg::G, Cfg::M)],
)
pub fn push_mset_residual( &mut self, v: MsetVarId, residual: &[(Cfg::G, Cfg::M)], )
Bind v to the still-available residual entries, writing them
straight onto the pool tail (E15). push_mset with a caller-built
slice re-bought a temporary per binding at every leaf of the AC
assignment search - 221k bindings per allocprobe run, three growth
allocations each; the pool was the destination all along.
Sourcepub fn push_set_residual(
&mut self,
v: SetVarId,
residual: &[Cfg::G],
used: &BitSet,
)
pub fn push_set_residual( &mut self, v: SetVarId, residual: &[Cfg::G], used: &BitSet, )
The ACI counterpart: bind v to the residual ids not consumed by the
element assignment (same write-through mechanism).
Trait Implementations§
Source§impl<Cfg: EGraphConfig> Clone for Match<Cfg>
impl<Cfg: EGraphConfig> Clone for Match<Cfg>
Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Overwrite in place, keeping every existing allocation.
Spelled out rather than left to the default *self = source.clone(),
which drops nine buffers and allocates nine more. Vec::clone_from
reuses the destination’s capacity when it suffices, so a recycled match
costs nine memcpys and no allocator traffic. This is what makes
MatchPool worth retaining across matches.