Trait miri::shims::ffi_support::EvalContextExt
source · pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> {
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: &PlaceTy<'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: &PlaceTy<'tcx, Provenance>,
args: &[OpTy<'tcx, Provenance>]
) -> InterpResult<'tcx, bool> { ... }
}
Provided Methods§
sourcefn scalar_to_carg(
k: Scalar<Provenance>,
arg_type: Ty<'tcx>,
cx: &impl HasDataLayout
) -> InterpResult<'tcx, CArg>
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
.
sourcefn call_external_c_and_store_return<'a>(
&mut self,
link_name: Symbol,
dest: &PlaceTy<'tcx, Provenance>,
ptr: CodePtr,
libffi_args: Vec<Arg<'a>>
) -> InterpResult<'tcx, ()>
fn call_external_c_and_store_return<'a>(
&mut self,
link_name: Symbol,
dest: &PlaceTy<'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.
sourcefn get_func_ptr_explicitly_from_lib(
&mut self,
link_name: Symbol
) -> Option<CodePtr>
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.
sourcefn call_external_c_fct(
&mut self,
link_name: Symbol,
dest: &PlaceTy<'tcx, Provenance>,
args: &[OpTy<'tcx, Provenance>]
) -> InterpResult<'tcx, bool>
fn call_external_c_fct(
&mut self,
link_name: Symbol,
dest: &PlaceTy<'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.