pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> {
// Provided methods
fn alloc_id_from_addr(
&self,
addr: u64,
size: i64,
only_exposed_allocations: bool,
) -> Option<AllocId> { ... }
fn addr_from_alloc_id(
&self,
alloc_id: AllocId,
memory_kind: Option<MemoryKind>,
) -> InterpResult<'tcx, u64> { ... }
fn expose_provenance(&self, provenance: Provenance) -> InterpResult<'tcx> { ... }
fn ptr_from_addr_cast(&self, addr: u64) -> InterpResult<'tcx, Pointer> { ... }
fn adjust_alloc_root_pointer(
&self,
ptr: Pointer<CtfeProvenance>,
tag: BorTag,
kind: MemoryKind,
) -> InterpResult<'tcx, Pointer<Provenance>> { ... }
fn get_global_alloc_bytes(
&self,
id: AllocId,
bytes: &[u8],
align: Align,
) -> InterpResult<'tcx, MiriAllocBytes> { ... }
fn ptr_get_alloc(
&self,
ptr: Pointer<Provenance>,
size: i64,
) -> Option<(AllocId, Size)> { ... }
fn prepare_exposed_for_native_call(&mut self) -> InterpResult<'tcx> { ... }
}
Provided Methods§
fn alloc_id_from_addr( &self, addr: u64, size: i64, only_exposed_allocations: bool, ) -> Option<AllocId>
Sourcefn addr_from_alloc_id(
&self,
alloc_id: AllocId,
memory_kind: Option<MemoryKind>,
) -> InterpResult<'tcx, u64>
fn addr_from_alloc_id( &self, alloc_id: AllocId, memory_kind: Option<MemoryKind>, ) -> InterpResult<'tcx, u64>
Returns the base address of an allocation, or an error if no base address could be found
§Panics
If memory_kind = None
and the alloc_id
is not cached, meaning that the first call to this function per alloc_id
must get the memory_kind
.
fn expose_provenance(&self, provenance: Provenance) -> InterpResult<'tcx>
fn ptr_from_addr_cast(&self, addr: u64) -> InterpResult<'tcx, Pointer>
Sourcefn adjust_alloc_root_pointer(
&self,
ptr: Pointer<CtfeProvenance>,
tag: BorTag,
kind: MemoryKind,
) -> InterpResult<'tcx, Pointer<Provenance>>
fn adjust_alloc_root_pointer( &self, ptr: Pointer<CtfeProvenance>, tag: BorTag, kind: MemoryKind, ) -> InterpResult<'tcx, Pointer<Provenance>>
Convert a relative (tcx) pointer to a Miri pointer.
fn get_global_alloc_bytes( &self, id: AllocId, bytes: &[u8], align: Align, ) -> InterpResult<'tcx, MiriAllocBytes>
Sourcefn ptr_get_alloc(
&self,
ptr: Pointer<Provenance>,
size: i64,
) -> Option<(AllocId, Size)>
fn ptr_get_alloc( &self, ptr: Pointer<Provenance>, size: i64, ) -> Option<(AllocId, Size)>
When a pointer is used for a memory access, this computes where in which allocation the access is going.
Sourcefn prepare_exposed_for_native_call(&mut self) -> InterpResult<'tcx>
fn prepare_exposed_for_native_call(&mut self) -> InterpResult<'tcx>
Prepare all exposed memory for a native call.
This overapproximates the modifications which external code might make to memory:
We set all reachable allocations as initialized, mark all reachable provenances as exposed
and overwrite them with Provenance::WILDCARD
.