Trait miri::shims::foreign_items::EvalContextExt
source · pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> {
// Provided methods
fn min_align(&self, size: u64, kind: MiriMemoryKind) -> Align { ... }
fn malloc(
&mut self,
size: u64,
zero_init: bool,
kind: MiriMemoryKind
) -> InterpResult<'tcx, Pointer<Option<Provenance>>> { ... }
fn free(
&mut self,
ptr: Pointer<Option<Provenance>>,
kind: MiriMemoryKind
) -> InterpResult<'tcx> { ... }
fn realloc(
&mut self,
old_ptr: Pointer<Option<Provenance>>,
new_size: u64,
kind: MiriMemoryKind
) -> InterpResult<'tcx, Pointer<Option<Provenance>>> { ... }
fn lookup_exported_symbol(
&mut self,
link_name: Symbol
) -> InterpResult<'tcx, Option<(&'mir Body<'tcx>, Instance<'tcx>)>> { ... }
fn read_byte_slice<'i>(
&'i self,
bytes: &OpTy<'tcx, Provenance>
) -> InterpResult<'tcx, &'i [u8]>
where 'mir: 'i { ... }
fn emulate_foreign_item(
&mut self,
def_id: DefId,
abi: Abi,
args: &[OpTy<'tcx, Provenance>],
dest: &PlaceTy<'tcx, Provenance>,
ret: Option<BasicBlock>,
unwind: UnwindAction
) -> InterpResult<'tcx, Option<(&'mir Body<'tcx>, Instance<'tcx>)>> { ... }
fn emulate_allocator(
&mut self,
default: impl FnOnce(&mut MiriInterpCx<'mir, 'tcx>) -> InterpResult<'tcx>
) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>> { ... }
fn emulate_foreign_item_by_name(
&mut self,
link_name: Symbol,
abi: Abi,
args: &[OpTy<'tcx, Provenance>],
dest: &PlaceTy<'tcx, Provenance>
) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>> { ... }
fn check_alloc_request(size: u64, align: u64) -> InterpResult<'tcx> { ... }
}
Provided Methods§
sourcefn min_align(&self, size: u64, kind: MiriMemoryKind) -> Align
fn min_align(&self, size: u64, kind: MiriMemoryKind) -> Align
Returns the minimum alignment for the target architecture for allocations of the given size.
fn malloc( &mut self, size: u64, zero_init: bool, kind: MiriMemoryKind ) -> InterpResult<'tcx, Pointer<Option<Provenance>>>
fn free( &mut self, ptr: Pointer<Option<Provenance>>, kind: MiriMemoryKind ) -> InterpResult<'tcx>
fn realloc( &mut self, old_ptr: Pointer<Option<Provenance>>, new_size: u64, kind: MiriMemoryKind ) -> InterpResult<'tcx, Pointer<Option<Provenance>>>
sourcefn lookup_exported_symbol(
&mut self,
link_name: Symbol
) -> InterpResult<'tcx, Option<(&'mir Body<'tcx>, Instance<'tcx>)>>
fn lookup_exported_symbol( &mut self, link_name: Symbol ) -> InterpResult<'tcx, Option<(&'mir Body<'tcx>, Instance<'tcx>)>>
Lookup the body of a function that has link_name
as the symbol name.
sourcefn read_byte_slice<'i>(
&'i self,
bytes: &OpTy<'tcx, Provenance>
) -> InterpResult<'tcx, &'i [u8]>where
'mir: 'i,
fn read_byte_slice<'i>( &'i self, bytes: &OpTy<'tcx, Provenance> ) -> InterpResult<'tcx, &'i [u8]>where 'mir: 'i,
Read bytes from a (ptr, len)
argument
sourcefn emulate_foreign_item(
&mut self,
def_id: DefId,
abi: Abi,
args: &[OpTy<'tcx, Provenance>],
dest: &PlaceTy<'tcx, Provenance>,
ret: Option<BasicBlock>,
unwind: UnwindAction
) -> InterpResult<'tcx, Option<(&'mir Body<'tcx>, Instance<'tcx>)>>
fn emulate_foreign_item( &mut self, def_id: DefId, abi: Abi, args: &[OpTy<'tcx, Provenance>], dest: &PlaceTy<'tcx, Provenance>, ret: Option<BasicBlock>, unwind: UnwindAction ) -> InterpResult<'tcx, Option<(&'mir Body<'tcx>, Instance<'tcx>)>>
Emulates calling a foreign item, failing if the item is not supported.
This function will handle goto_block
if needed.
Returns Ok(None) if the foreign item was completely handled
by this function.
Returns Ok(Some(body)) if processing the foreign item
is delegated to another function.
sourcefn emulate_allocator(
&mut self,
default: impl FnOnce(&mut MiriInterpCx<'mir, 'tcx>) -> InterpResult<'tcx>
) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>>
fn emulate_allocator( &mut self, default: impl FnOnce(&mut MiriInterpCx<'mir, 'tcx>) -> InterpResult<'tcx> ) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>>
Emulates calling the internal _rust* allocator functions
sourcefn emulate_foreign_item_by_name(
&mut self,
link_name: Symbol,
abi: Abi,
args: &[OpTy<'tcx, Provenance>],
dest: &PlaceTy<'tcx, Provenance>
) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>>
fn emulate_foreign_item_by_name( &mut self, link_name: Symbol, abi: Abi, args: &[OpTy<'tcx, Provenance>], dest: &PlaceTy<'tcx, Provenance> ) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>>
Emulates calling a foreign item using its name.
sourcefn check_alloc_request(size: u64, align: u64) -> InterpResult<'tcx>
fn check_alloc_request(size: u64, align: u64) -> InterpResult<'tcx>
Check some basic requirements for this allocation request: non-zero size, power-of-two alignment.