Skip to main content

Module slice

Module slice 

Source
Expand description

Backward program slicer (DF-6).

Prepare a graph for backward slicing:

use weir::slice::prepare_slice_graph;

let graph = prepare_slice_graph(
    2,
    &[0, 1, 1],
    &[1],
    &[0xFFFF_FFFF],
).unwrap();
assert_eq!(graph.node_count(), 2);

DF-6 - backward slicer.

Given a sink node s, emit the minimal sub-graph that may affect it. Reduces to reverse reachability on the merged dependence graph: walk backward from the sink, union-in every predecessor along data dependences (DF-2 reaching, DF-3 points-to, DF-5 callgraph) and control dependences (security::dominator_tree).

§Implementation

Reverse-BFS is [csr_backward_traverse] applied to the caller-supplied ProgramGraph. The caller merges reach, callgraph, and dom into a single CSR before dispatch (dense-OR of three CSRs

  • a one-kernel fusion via fuse_programs). The edge_kind_mask channel already supports up to 32 independent edge kinds, so we admit every kind with u32::MAX - the slicer is intentionally maximal, and false-positives are filtered by the downstream rule.

§Soundness

MayOver. Rules requiring zero-FP pair this slicer with a sanitizer filter on each edge in the returned slice.

Structs§

BackwardSlice
Marker type for the backward-slice dataflow primitive.
SliceFamily

Functions§

backward_slice
Build one reverse-BFS step. Caller invokes this Program in a host loop until the slice bitset stops growing (same fixpoint driver pattern as DF-2 reaching, DF-3 points-to).
backward_slice_with_shapeDeprecated
Deprecated alias for back-compat with callers that imported the pre-fix backward_slice_with_shape name.
prepare_slice_graph
prepare_slice_graph_into
Repack backward-slice graph buffers into an existing prepared graph.
prepare_slice_graph_with_scratch
Prepare backward-slice graph buffers using caller-owned scratch.
prepare_slice_plan
Prepare backward-slice graph buffers and Program once for repeated runs.
prepare_slice_plan_into
Repack backward-slice graph buffers and refresh the emitted Program in place.
slice_closure_borrowed_into_result_with_scratch_via
slice_closure_borrowed_into_via
slice_closure_borrowed_into_with_scratch_via
slice_closure_borrowed_via
slice_closure_plan_borrowed_into_result_with_scratch_via
slice_closure_plan_borrowed_into_with_scratch_via
slice_closure_prepared_borrowed_into_result_with_scratch_via
slice_closure_prepared_borrowed_into_with_scratch_via
slice_closure_resident_plan_with_backend_scratch
slice_closure_resident_plan_with_backend_scratch_into
slice_closure_resident_plan_with_reusable_frontier_scratch
slice_closure_resident_plan_with_reusable_frontier_scratch_into
slice_closure_resident_plan_with_reusable_frontier_scratch_sequence_window
slice_closure_resident_plan_with_reusable_frontier_scratch_sequence_window_into
slice_closure_resident_plan_with_scratch
slice_closure_resident_plan_with_scratch_into
slice_closure_via