Trait miri::shims::ffi_support::EvalContextExt

source ·
pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> {
    // Provided methods
    fn scalar_to_carg(
        k: Scalar<Provenance>,
        arg_type: Ty<'tcx>,
        cx: &impl HasDataLayout
    ) -> InterpResult<'tcx, CArg> { ... }
    fn call_external_c_and_store_return<'a>(
        &mut self,
        link_name: Symbol,
        dest: &MPlaceTy<'tcx, Provenance>,
        ptr: CodePtr,
        libffi_args: Vec<Arg<'a>>
    ) -> InterpResult<'tcx, ()> { ... }
    fn get_func_ptr_explicitly_from_lib(
        &mut self,
        link_name: Symbol
    ) -> Option<CodePtr> { ... }
    fn call_external_c_fct(
        &mut self,
        link_name: Symbol,
        dest: &MPlaceTy<'tcx, Provenance>,
        args: &[OpTy<'tcx, Provenance>]
    ) -> InterpResult<'tcx, bool> { ... }
}

Provided Methods§

source

fn scalar_to_carg( k: Scalar<Provenance>, arg_type: Ty<'tcx>, cx: &impl HasDataLayout ) -> InterpResult<'tcx, CArg>

Extract the scalar value from the result of reading a scalar from the machine, and convert it to a CArg.

source

fn call_external_c_and_store_return<'a>( &mut self, link_name: Symbol, dest: &MPlaceTy<'tcx, Provenance>, ptr: CodePtr, libffi_args: Vec<Arg<'a>> ) -> InterpResult<'tcx, ()>

Call external C function and store output, depending on return type in the function signature.

source

fn get_func_ptr_explicitly_from_lib( &mut self, link_name: Symbol ) -> Option<CodePtr>

Get the pointer to the function of the specified name in the shared object file, if it exists. The function must be in the shared object file specified: we do not return pointers to functions in dependencies of the library.

source

fn call_external_c_fct( &mut self, link_name: Symbol, dest: &MPlaceTy<'tcx, Provenance>, args: &[OpTy<'tcx, Provenance>] ) -> InterpResult<'tcx, bool>

Call specified external C function, with supplied arguments. Need to convert all the arguments from their hir representations to a form compatible with C (through libffi call). Then, convert return from the C call into a corresponding form that can be stored in Miri internal memory.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for MiriInterpCx<'mir, 'tcx>