Struct miri::Tree

source ·
pub struct Tree { /* private fields */ }
Expand description

Tree structure with both parents and children since we want to be able to traverse the tree efficiently in both directions.

Implementations§

source§

impl<'tcx> Tree

source

pub fn give_pointer_debug_name( &mut self, tag: BorTag, nth_parent: u8, name: &str ) -> InterpResult<'tcx>

Debug helper: assign name to tag.

source

pub fn is_allocation_of(&self, tag: BorTag) -> bool

Debug helper: determines if the tree contains a tag.

source§

impl<'tcx> Tree

source

pub fn print_tree( &self, protected_tags: &FxHashMap<BorTag, ProtectorKind>, show_unnamed: bool ) -> InterpResult<'tcx>

Display the contents of the tree.

source§

impl Tree

source

pub fn new(root_tag: BorTag, size: Size, span: Span) -> Self

Create a new tree, with only a root pointer.

source§

impl<'tcx> Tree

source

pub fn new_child( &mut self, parent_tag: BorTag, new_tag: BorTag, default_initial_perm: Permission, reborrow_range: AllocRange, span: Span ) -> InterpResult<'tcx>

Insert a new tag in the tree

source

pub fn dealloc( &mut self, tag: BorTag, access_range: AllocRange, global: &RefCell<GlobalStateInner>, alloc_id: AllocId, span: Span ) -> InterpResult<'tcx>

Deallocation requires

  • a pointer that permits write accesses
  • the absence of Strong Protectors anywhere in the allocation
source

pub fn perform_access( &mut self, access_kind: AccessKind, tag: BorTag, access_range: Option<AllocRange>, global: &RefCell<GlobalStateInner>, alloc_id: AllocId, span: Span, access_cause: AccessCause ) -> InterpResult<'tcx>

Map the per-node and per-location LocationState::perform_access to each location of access_range, on every tag of the allocation.

If access_range is None, this is interpreted as the special access that is applied on protector release:

  • the access will be applied only to initialized locations of the allocation,
  • and it will not be visible to children.

LocationState::perform_access will take care of raising transition errors and updating the initialized status of each location, this traversal adds to that:

  • inserting into the map locations that do not exist yet,
  • trimming the traversal,
  • recording the history.
source§

impl Tree

Integration with the BorTag garbage collector

source

pub fn remove_unreachable_tags(&mut self, live_tags: &FxHashSet<BorTag>)

source§

impl<'tcx> Tree

source

pub fn new_allocation( id: AllocId, size: Size, state: &mut GlobalStateInner, _kind: MemoryKind, machine: &MiriMachine<'_, 'tcx> ) -> Self

Create a new allocation, i.e. a new tree

source

pub fn before_memory_access( &mut self, access_kind: AccessKind, alloc_id: AllocId, prov: ProvenanceExtra, range: AllocRange, machine: &MiriMachine<'_, 'tcx> ) -> InterpResult<'tcx>

Check that an access on the entire range is permitted, and update the tree.

source

pub fn before_memory_deallocation( &mut self, alloc_id: AllocId, prov: ProvenanceExtra, size: Size, machine: &MiriMachine<'_, 'tcx> ) -> InterpResult<'tcx>

Check that this pointer has permission to deallocate this range.

source

pub fn expose_tag(&mut self, _tag: BorTag)

source

pub fn release_protector( &mut self, machine: &MiriMachine<'_, 'tcx>, global: &RefCell<GlobalStateInner>, tag: BorTag, alloc_id: AllocId ) -> InterpResult<'tcx>

A tag just lost its protector.

This emits a special kind of access that is only applied to initialized locations, as a protection against other tags not having been made aware of the existence of this protector.

Trait Implementations§

source§

impl Clone for Tree

source§

fn clone(&self) -> Tree

Returns a copy 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 Tree

source§

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

Formats the value using the given formatter. Read more
source§

impl VisitProvenance for Tree

source§

fn visit_provenance(&self, visit: &mut VisitWith<'_>)

Auto Trait Implementations§

§

impl Freeze for Tree

§

impl RefUnwindSafe for Tree

§

impl Send for Tree

§

impl Sync for Tree

§

impl Unpin for Tree

§

impl UnwindSafe for Tree

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> 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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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