pub struct GlobalStateInner {
int_to_ptr_map: Vec<(u64, AllocId)>,
base_addr: FxHashMap<AllocId, u64>,
exposed: FxHashSet<AllocId>,
provenance_mode: ProvenanceMode,
address_generation: Option<(AddressGenerator, ReusePool)>,
prepared_alloc_bytes: Option<FxHashMap<AllocId, MiriAllocBytes>>,
}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.
Note that in GenMC mode, dead allocations are not removed – and also, addresses are never
reused. This lets us use the address as a cross-execution-stable identifier for an allocation.
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.
exposed: FxHashSet<AllocId>The set of exposed allocations. This cannot be put
into AllocExtra for the same reason as base_addr.
provenance_mode: ProvenanceModeThe provenance to use for int2ptr casts
address_generation: Option<(AddressGenerator, ReusePool)>The generator for new addresses in a given range, and a pool for address reuse. This is
None if addresses are generated elsewhere (in native-lib mode or with GenMC).
prepared_alloc_bytes: Option<FxHashMap<AllocId, MiriAllocBytes>>Native-lib mode only: 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.
Implementations§
Source§impl GlobalStateInner
impl GlobalStateInner
pub fn new<'tcx>( config: &MiriConfig, stack_addr: u64, tcx: TyCtxt<'tcx>, ) -> Self
pub fn remove_unreachable_allocs(&mut self, allocs: &LiveAllocs<'_, '_>)
Trait Implementations§
Source§impl Debug for GlobalStateInner
impl Debug for GlobalStateInner
Source§impl VisitProvenance for GlobalStateInner
impl VisitProvenance for GlobalStateInner
fn visit_provenance(&self, _visit: &mut VisitWith<'_>)
Auto Trait Implementations§
impl Freeze for GlobalStateInner
impl !RefUnwindSafe for GlobalStateInner
impl !Send for GlobalStateInner
impl !Sync for GlobalStateInner
impl Unpin for GlobalStateInner
impl !UnwindSafe for GlobalStateInner
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
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: 184 bytes