/// Construct a new VMCallerCheckedAnyfunc for the given function
/// (imported or defined in this module) and store into the given
/// location. Used during lazy initialization.
///
/// Note that our current lazy-init scheme actually calls this every
/// time the anyfunc pointer is fetched; this turns out to be better
/// than tracking state related to whether it's been initialized
/// before, because resetting that state on (re)instantiation is
/// very expensive if there are many anyfuncs.
Construct a new VMCallerCheckedAnyfunc for the given function
(imported or defined in this module) and store into the given
location. Used during lazy initialization.

Note that our current lazy-init scheme actually calls this every
time the anyfunc pointer is fetched; this turns out to be better
than tracking state related to whether it's been initialized
before, because resetting that state on (re)instantiation is
very expensive if there are many anyfuncs.
Construct a new VMCallerCheckedAnyfunc for the given function ( imported or defined in this module ) and store into the given location . Used during lazy initialization . Note that our current lazy - init scheme actually calls this every time the anyfunc pointer is fetched ; this turns out to be better than tracking state related to whether it ' s been initialized before because resetting that state on ( re ) instantiation is very expensive if there are many anyfuncs .
fn construct_anyfunc(&mut self, index: FuncIndex, into: *mut VMCallerCheckedAnyfunc) {
        let sig = self.module().functions[index];
        let type_index = self.runtime_info.signature(sig);
        let (func_ptr, vmctx) = if let Some(def_index) = self.module().defined_func_index(index) {
            (
                (self.runtime_info.image_base()
                    + self.runtime_info.function_info(def_index).start as usize)
                    as *mut _,
                self.vmctx_ptr(),
            )
        } else {
            let import = self.imported_function(index);
            (import.body.as_ptr(), import.vmctx)
        };
        // Safety: we have a `&mut self`, so we have exclusive access
        // to this Instance.
        unsafe {
            *into = VMCallerCheckedAnyfunc {
                vmctx,
                type_index,
                func_ptr: NonNull::new(func_ptr).expect("Non-null function pointer"),
            };
        }
    }
fn construct_anyfunc ( & mut self , index : FuncIndex , into : * mut VMCallerCheckedAnyfunc ) { let sig = self . module ( ) . functions [ index ] ; let type_index = self . runtime_info . signature ( sig ) ; let ( func_ptr , vmctx ) = if let Some ( def_index ) = self . module ( ) . defined_func_index ( index ) { ( ( self . runtime_info . image_base ( ) + self . runtime_info . function_info ( def_index ) . start as usize ) as * mut _ , self . vmctx_ptr ( ) , ) } else { let import = self . imported_function ( index ) ; ( import . body . as_ptr ( ) , import . vmctx ) } ; // Safety: we have a `&mut self`, so we have exclusive access // to this Instance. unsafe { * into = VMCallerCheckedAnyfunc { vmctx , type_index , func_ptr : NonNull :: new ( func_ptr ) . expect ( " " ) , } ; } }
Construct a new VMCallerCheckedAnyfunc for the given function
(imported or defined in this module) and store into the given
location.
Construct a new VMCallerCheckedAnyfunc for the given function ( imported or defined in this module ) and store into the given location .
&mut self
index
FuncIndex
into
*mut VMCallerCheckedAnyfunc