struct State {
values: IndexVec<ValueIndex, FlatSet<Loc>>,
}
Expand description
The dataflow state for the PointsToAnalysis
.
Every instance specifies a lattice that represents the possible values of a single tracked
place. If we call this lattice V
and set of tracked places P
, then a State
is an
element of {unreachable} ∪ (P -> V)
. This again forms a lattice, where the bottom element is
unreachable
and the top element is the mapping p ↦ ⊤
. Note that the mapping p ↦ ⊥
is not
the bottom element (because joining an unreachable and any other reachable state yields a
reachable state). All operations on unreachable states are ignored.
Flooding means assigning a value (by default ⊤
) to all tracked projections of a given place.
Fields§
§values: IndexVec<ValueIndex, FlatSet<Loc>>
Implementations§
Source§impl State
impl State
fn flood(&mut self, place: PlaceRef<'_>, map: &Map)
fn flood_with(&mut self, place: PlaceRef<'_>, map: &Map, value: FlatSet<Loc>)
Sourcefn assign(&mut self, target: PlaceRef<'_>, result: PlaceOrValue, map: &Map)
fn assign(&mut self, target: PlaceRef<'_>, result: PlaceOrValue, map: &Map)
Helper method to interpret target = result
.
Sourcefn insert_idx(&mut self, target: PlaceIndex, result: PlaceOrValue, map: &Map)
fn insert_idx(&mut self, target: PlaceIndex, result: PlaceOrValue, map: &Map)
Low-level method that assigns to a place. This does nothing if the place is not tracked.
The target place must have been flooded before calling this method.
Sourcefn insert_place_idx(
&mut self,
target: PlaceIndex,
source: PlaceIndex,
map: &Map,
)
fn insert_place_idx( &mut self, target: PlaceIndex, source: PlaceIndex, map: &Map, )
Copies source
to target
, including all tracked places beneath.
If target
contains a place that is not contained in source
, it will be overwritten with
Top. Also, because this will copy all entries one after another, it may only be used for
places that are non-overlapping or identical.
The target place must have been flooded before calling this method.
Sourcefn insert_value_idx(
&mut self,
target: PlaceIndex,
value: FlatSet<Loc>,
map: &Map,
)
fn insert_value_idx( &mut self, target: PlaceIndex, value: FlatSet<Loc>, map: &Map, )
Low-level method that assigns a value to a place. This does nothing if the place is not tracked.
The target place must have been flooded before calling this method.
Sourcefn get(&self, place: PlaceRef<'_>, map: &Map) -> FlatSet<Loc>
fn get(&self, place: PlaceRef<'_>, map: &Map) -> FlatSet<Loc>
Retrieve the value stored for a place, or ⊤ if it is not tracked.
Sourcefn get_idx(&self, place: PlaceIndex, map: &Map) -> FlatSet<Loc>
fn get_idx(&self, place: PlaceIndex, map: &Map) -> FlatSet<Loc>
Retrieve the value stored for a place index, or ⊤ if it is not tracked.
Sourcefn get_tracked_idx(&self, place: PlaceIndex, map: &Map) -> Option<FlatSet<Loc>>
fn get_tracked_idx(&self, place: PlaceIndex, map: &Map) -> Option<FlatSet<Loc>>
Retrieve the value stored for a place index if tracked
Trait Implementations§
Source§impl DebugWithContext<PointsToAnalysis<'_>> for State
impl DebugWithContext<PointsToAnalysis<'_>> for State
This is used to visualize the dataflow analysis.
fn fmt_with(&self, ctxt: &PointsToAnalysis<'_>, f: &mut Formatter<'_>) -> Result
Source§fn fmt_diff_with(
&self,
old: &Self,
ctxt: &PointsToAnalysis<'_>,
f: &mut Formatter<'_>,
) -> Result
fn fmt_diff_with( &self, old: &Self, ctxt: &PointsToAnalysis<'_>, f: &mut Formatter<'_>, ) -> Result
impl Eq for State
impl StructuralPartialEq for State
Auto Trait Implementations§
impl Freeze for State
impl RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnwindSafe for State
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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