weir/summary.rs
1//! DF-9 - persistent procedure summaries.
2//!
3//! Bottom-up fixpoint: compute a summary for each function describing
4//! its effect on caller state (inputs tainted → outputs tainted,
5//! inputs ranged → outputs ranged, etc.). Persist to the pipeline
6//! cache keyed by function AST hash so unchanged functions are not
7//! reanalysed across scans.
8//!
9//! This is the performance gate for the whole dataflow stack - Linux
10//! has ~450k functions; reanalysing per-rule is infeasible without
11//! summaries.
12//!
13//! # Implementation
14//!
15//! Two-layer composition:
16//!
17//! 1. **Kernel:** a single-dispatch Program that reads the
18//! per-function input-bitset (`fn_ast_in`), unions callee
19//! summaries from the callgraph (`callgraph_in`), falls back
20//! to the previous iteration's cached summary
21//! (`cached_summary_in`), and writes the new summary.
22//!
23//! 2. **Host loop:** the caller drives this Program in a
24//! bottom-up order (callees before callers) using the topsort
25//! primitive; once a function's summary is unchanged across two
26//! consecutive passes it is written to the pipeline cache
27//! (G8's blake3-keyed content cache) keyed by AST hash +
28//! callee-summary hash.
29//!
30//! Soundness: inherited from the underlying primitives.
31
32#[cfg(any(test, feature = "cpu-parity"))]
33mod cpu_oracle;
34mod dispatch;
35mod program;
36mod scratch;
37mod soundness;
38
39#[cfg(test)]
40mod tests;
41
42pub(crate) const OP_ID: &str = "weir::summary";
43
44#[cfg(any(test, feature = "cpu-parity"))]
45#[allow(deprecated)]
46pub(crate) use cpu_oracle::summarize_function_cpu;
47pub use dispatch::{
48 summarize_function_borrowed_into_result_with_scratch_via, summarize_function_borrowed_into_via,
49 summarize_function_borrowed_via, summarize_function_borrowed_with_scratch_via,
50 summarize_function_evidence_via, summarize_function_via,
51};
52pub use program::{summarize_function, summarize_function_with_count};
53pub use scratch::SummarizeFunctionScratch;
54pub use soundness::Summary;