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

Function deserialize_source_info

crates/compile/src/decompile.rs:261–297  ·  view source on GitHub ↗

Deserialize SourceInfo from bytes.

(
  buf: &mut &[u8],
  stt: &CompileState,
)

Source from the content-addressed store, hash-verified

259 if same(s, &si) {
260 e.clone()
261 } else {
262 LeanExpr(Arc::new(ED::Proj(n.clone(), i.clone(), si, *h)))
263 }
264 },
265 ED::Bvar(..)
266 | ED::Fvar(..)
267 | ED::Mvar(..)
268 | ED::Sort(..)
269 | ED::Const(..)
270 | ED::Lit(..) => e.clone(),
271 };
272 let canonical = self
273 .expr_intern
274 .entry(*e.get_hash().as_bytes())
275 .or_insert(rebuilt)
276 .clone();
277 memo.insert(key, canonical);
278 }
279
280 memo
281 .remove(&Arc::as_ptr(&root.0))
282 .expect("intern walk: root not canonicalized")
283 }
284}
285
286/// Per-block decompilation cache.
287///
288/// Index-space invariants (see `load_meta_extensions` for details):
289/// - `sharing` holds the block `Constant.sharing` table and is the target
290/// of `Expr::Share(idx)` lookups produced by whole-block sharing
291/// analysis (`apply_sharing_to_*`). These indices start at 0 and are
292/// block-wide.
293/// - `meta_sharing` holds the per-constant `ConstantMeta.meta_sharing`
294/// table — collapsed call-site argument expressions — and is the
295/// target of `CallSiteEntry::Collapsed.sharing_idx` lookups. These
296/// indices also start at 0 but live in a SEPARATE namespace from the
297/// block sharing: compile writes them as `surgery_sharing.len() +
298/// collapsed_idx` where `surgery_sharing` is reset per constant (see
299/// `src/ix/compile.rs::compile_expr` BuildCallSite path).
300///

Callers 1

deserialize_syntax_innerFunction · 0.85

Calls 3

deserialize_substringFunction · 0.85
read_tag0Function · 0.85
is_emptyMethod · 0.45

Tested by

no test coverage detected