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
impl<'tcx> Tree
sourcepub fn give_pointer_debug_name(
&mut self,
tag: BorTag,
nth_parent: u8,
name: &str
) -> InterpResult<'tcx>
pub fn give_pointer_debug_name( &mut self, tag: BorTag, nth_parent: u8, name: &str ) -> InterpResult<'tcx>
Debug helper: assign name to tag.
sourcepub fn is_allocation_of(&self, tag: BorTag) -> bool
pub fn is_allocation_of(&self, tag: BorTag) -> bool
Debug helper: determines if the tree contains a tag.
source§impl<'tcx> Tree
impl<'tcx> Tree
sourcepub fn print_tree(
&self,
protected_tags: &FxHashMap<BorTag, ProtectorKind>,
show_unnamed: bool
) -> InterpResult<'tcx>
pub fn print_tree( &self, protected_tags: &FxHashMap<BorTag, ProtectorKind>, show_unnamed: bool ) -> InterpResult<'tcx>
Display the contents of the tree.
source§impl<'tcx> Tree
impl<'tcx> Tree
sourcepub fn new_child(
&mut self,
parent_tag: BorTag,
new_tag: BorTag,
default_initial_perm: Permission,
reborrow_range: AllocRange,
span: Span
) -> InterpResult<'tcx>
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
sourcepub fn dealloc(
&mut self,
tag: BorTag,
access_range: AllocRange,
global: &RefCell<GlobalStateInner>,
alloc_id: AllocId,
span: Span
) -> InterpResult<'tcx>
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
sourcepub 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>
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<'tcx> Tree
impl<'tcx> Tree
sourcepub fn new_allocation(
id: AllocId,
size: Size,
state: &mut GlobalStateInner,
_kind: MemoryKind,
machine: &MiriMachine<'_, 'tcx>
) -> Self
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
sourcepub fn before_memory_access(
&mut self,
access_kind: AccessKind,
alloc_id: AllocId,
prov: ProvenanceExtra,
range: AllocRange,
machine: &MiriMachine<'_, 'tcx>
) -> InterpResult<'tcx>
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.
sourcepub fn before_memory_deallocation(
&mut self,
alloc_id: AllocId,
prov: ProvenanceExtra,
size: Size,
machine: &MiriMachine<'_, 'tcx>
) -> InterpResult<'tcx>
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.
pub fn expose_tag(&mut self, _tag: BorTag)
sourcepub fn release_protector(
&mut self,
machine: &MiriMachine<'_, 'tcx>,
global: &RefCell<GlobalStateInner>,
tag: BorTag,
alloc_id: AllocId
) -> InterpResult<'tcx>
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.