Skip to main content

SliceResult

Struct SliceResult 

Source
pub struct SliceResult {
    pub criterion: i64,
    pub slice_nodes: AHashSet<i64>,
    pub control_nodes: AHashSet<i64>,
    pub data_nodes: AHashSet<i64>,
    pub size: usize,
}
Expand description

Result of a program slicing operation.

Contains the complete slice with separation between control-dependent and data-dependent nodes for debugging and analysis.

§Fields

  • criterion: The slicing criterion node (the target/source node)
  • slice_nodes: All nodes in the slice (union of control + data)
  • control_nodes: Nodes in the slice due to control dependence
  • data_nodes: Nodes in the slice due to data dependence
  • size: Number of nodes in the slice

§Example

let result = backward_slice(&graph, &cdg, target)?;

println!("Slice size: {}", result.size);
println!("Control nodes: {:?}", result.control_nodes);
println!("Data nodes: {:?}", result.data_nodes);

// Check if a node is in the slice
if result.contains(node_id) {
    println!("Node {} is in the slice", node_id);
}

// Get deterministic sorted output
for node in result.sorted_nodes() {
    println!("Slice node: {}", node);
}

Fields§

§criterion: i64

The slicing criterion (node the slice is based on)

§slice_nodes: AHashSet<i64>

All nodes in the slice (union of control + data dependence)

§control_nodes: AHashSet<i64>

Control-dependent nodes in the slice (via CDG)

§data_nodes: AHashSet<i64>

Data-dependent nodes in the slice (via reachability)

§size: usize

Number of nodes in the slice

Implementations§

Source§

impl SliceResult

Source

pub fn contains(&self, node: i64) -> bool

Checks if a node is in the slice.

Returns true if the node is in the complete slice (either control or data dependence).

§Arguments
  • node - Node ID to check
§Returns

true if node is in slice_nodes, false otherwise

§Example
let result = backward_slice(&graph, &cdg, target)?;
if result.contains(some_node) {
    println!("Node {} is relevant to the criterion", some_node);
}
Source

pub fn sorted_nodes(&self) -> Vec<i64>

Gets sorted slice nodes for deterministic output.

Returns nodes in ascending order by ID. Useful for testing, debugging, and consistent display.

§Returns

Vector of node IDs sorted in ascending order

§Example
let result = backward_slice(&graph, &cdg, target)?;
for node in result.sorted_nodes() {
    println!("Slice node: {}", node);
}
Source

pub fn sorted_control_nodes(&self) -> Vec<i64>

Gets sorted control nodes for deterministic output.

Returns control-dependent nodes in ascending order by ID.

Source

pub fn sorted_data_nodes(&self) -> Vec<i64>

Gets sorted data nodes for deterministic output.

Returns data-dependent nodes in ascending order by ID.

Trait Implementations§

Source§

impl Clone for SliceResult

Source§

fn clone(&self) -> SliceResult

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SliceResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V