MCPcopy Create free account
hub / github.com/argumentcomputer/ix / ingress_expr

Function ingress_expr

crates/kernel/src/ingress.rs:597–1374  ·  view source on GitHub ↗
(
  root_expr: &Arc<IxonExpr>,
  root_arena: u64,
  ctx: &Ctx<'_, M>,
  intern: &mut InternTable<M>,
  ixon_env: &IxonEnv,
  cache: &mut ExprCache<M>,
  univ_cache: &mut UnivCache<M>,
  stats: &mut Co

Source from the content-addressed store, hash-verified

595 };
596 let changed = univ_idxs
597 .iter()
598 .zip(ingressed.iter())
599 .any(|(&idx, k)| !ixon_matches_kuniv(stored_at(idx), k));
600 if !changed {
601 return None;
602 }
603 let spellings: Box<[Arc<IxonUniv>]> =
604 univ_idxs.iter().map(|&idx| stored_at(idx).clone()).collect();
605 Some(UnivDecor::Const(spellings))
606}
607
608/// Stage-2 decoration source for a `Const`-shaped occurrence
609/// (canonicity §10.6): a `univ_patches` entry keyed by the occurrence's
610/// (post-mdata) arena index carries the FULL original spelling list in
611/// the virtual index space — decorate from it. Without a patch, fall
612/// back to the stage-1 mk*-rebuild test against the stored primary
613/// entries; on canonical tables the fallback never fires (P3), but it
614/// keeps hand-built raw-table fixtures exercised. Meta mode only — call
615/// inside `M::meta_field_try`.
616fn univ_args_decor_at<M: KernelMode>(
617 arena_idx: u64,
618 univ_idxs: &[u64],
619 ctx: &Ctx<'_, M>,
620 ingressed: &[KUniv<M>],
621) -> Result<Option<UnivDecor>, String> {
622 let Some(patch_idxs) = ctx.univ_patch(arena_idx) else {
623 return Ok(univ_args_decor(univ_idxs, ctx, ingressed));
624 };
625 if patch_idxs.len() != ingressed.len() {
626 return Err(format!(
627 "univ patch at arena index {arena_idx} has {} entries but the \
628 occurrence has {} level args",
629 patch_idxs.len(),
630 ingressed.len()
631 ));
632 }
633 let mut spellings = Vec::with_capacity(patch_idxs.len());
634 for &vidx in patch_idxs {
635 spellings.push(ctx.univ_at_virtual(vidx)?.clone());
636 }
637 let changed = spellings
638 .iter()
639 .zip(ingressed.iter())
640 .any(|(s, k)| !ixon_matches_kuniv(s, k));
641 Ok(if changed {
642 Some(UnivDecor::Const(spellings.into_boxed_slice()))
643 } else {
644 None
645 })
646}
647
648// ============================================================================
649// Expression ingress (iterative)
650// ============================================================================
651
652enum ExprFrame<M: KernelMode> {
653 Process {
654 expr: Arc<IxonExpr>,

Callers 6

ingress_defnFunction · 0.85
ingress_recursorFunction · 0.85
ingress_standaloneFunction · 0.85
ingress_muts_inductiveFunction · 0.85
ingress_anon_inductiveFunction · 0.85

Calls 15

elapsed_nsFunction · 0.85
resolve_kvmapFunction · 0.85
timed_intern_or_buildFunction · 0.85
ingress_univFunction · 0.85
sort_hashFunction · 0.85
resolve_nameFunction · 0.85
ingress_univ_argsFunction · 0.85
let_hashFunction · 0.85
prj_hashFunction · 0.85
pushMethod · 0.80
synth_nameMethod · 0.80
cloneMethod · 0.45