miri::alloc_addresses

Struct GlobalStateInner

Source
pub struct GlobalStateInner {
    int_to_ptr_map: Vec<(u64, AllocId)>,
    base_addr: FxHashMap<AllocId, u64>,
    prepared_alloc_bytes: FxHashMap<AllocId, MiriAllocBytes>,
    reuse: ReusePool,
    exposed: FxHashSet<AllocId>,
    next_base_addr: u64,
    provenance_mode: ProvenanceMode,
}

Fields§

§int_to_ptr_map: Vec<(u64, AllocId)>

This is used as a map between the address of each allocation and its AllocId. It is always sorted by address. We cannot use a HashMap since we can be given an address that is offset from the base address, and we need to find the AllocId it belongs to. This is not the full inverse of base_addr; dead allocations have been removed.

§base_addr: FxHashMap<AllocId, u64>

The base address for each allocation. We cannot put that into AllocExtra because function pointers also have a base address, and they do not have an AllocExtra. This is the inverse of int_to_ptr_map.

§prepared_alloc_bytes: FxHashMap<AllocId, MiriAllocBytes>

Temporarily store prepared memory space for global allocations the first time their memory address is required. This is used to ensure that the memory is allocated before Miri assigns it an internal address, which is important for matching the internal address to the machine address so FFI can read from pointers.

§reuse: ReusePool

A pool of addresses we can reuse for future allocations.

§exposed: FxHashSet<AllocId>

Whether an allocation has been exposed or not. This cannot be put into AllocExtra for the same reason as base_addr.

§next_base_addr: u64

This is used as a memory address when a new pointer is casted to an integer. It is always larger than any address that was previously made part of a block.

§provenance_mode: ProvenanceMode

The provenance to use for int2ptr casts

Implementations§

Source§

impl GlobalStateInner

Source

pub fn new(config: &MiriConfig, stack_addr: u64) -> Self

Source

pub fn remove_unreachable_allocs(&mut self, allocs: &LiveAllocs<'_, '_>)

Trait Implementations§

Source§

impl Debug for GlobalStateInner

Source§

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

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

impl VisitProvenance for GlobalStateInner

Source§

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

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

Source§

type Output = T

Should always be Self
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.
§

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

§

fn vzip(self) -> V

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 176 bytes