fn ret(
        &mut self,
        value_ptr: u32,
        value_size: usize,
        scoped_instrumenter: &mut ScopedInstrumenter,
    ) -> Trap {
        const UREF_COUNT: &str = "uref_count";
        self.host_buffer = None;
        let mem_get = self
            .memory
            .get(value_ptr, value_size)
            .map_err(|e| Error::Interpreter(e.into()));
        match mem_get {
            Ok(buf) => {
                // Set the result field in the runtime and return the proper element of the `Error`
                // enum indicating that the reason for exiting the module was a call to ret.
                self.host_buffer = bytesrepr::deserialize(buf).ok();

                let urefs = match &self.host_buffer {
                    Some(buf) => extract_urefs(buf),
                    None => Ok(vec![]),
                };
                match urefs {
                    Ok(urefs) => {
                        scoped_instrumenter.add_property(UREF_COUNT, urefs.len());
                        Error::Ret(urefs).into()
                    }
                    Err(e) => {
                        scoped_instrumenter.add_property(UREF_COUNT, 0);
                        e.into()
                    }
                }
            }
            Err(e) => {
                scoped_instrumenter.add_property(UREF_COUNT, 0);
                e.into()
            }
        }
    }
/// Return some bytes from the memory and terminate the current `sub_call`. Note that the return
/// type is `Trap`, indicating that this function will always kill the current Wasm instance.
Return some bytes from the memory and terminate the current `sub_call`. Note that the return
type is `Trap`, indicating that this function will always kill the current Wasm instance.
Return some bytes from the memory and terminate the current ` sub_call ` . Note that the return type is ` Trap ` indicating that this function will always kill the current Wasm instance .
fn ret(
        &mut self,
        value_ptr: u32,
        value_size: usize,
        scoped_instrumenter: &mut ScopedInstrumenter,
    ) -> Trap {
        const UREF_COUNT: &str = "uref_count";
        self.host_buffer = None;
        let mem_get = self
            .memory
            .get(value_ptr, value_size)
            .map_err(|e| Error::Interpreter(e.into()));
        match mem_get {
            Ok(buf) => {
                // Set the result field in the runtime and return the proper element of the `Error`
                // enum indicating that the reason for exiting the module was a call to ret.
                self.host_buffer = bytesrepr::deserialize(buf).ok();
                let urefs = match &self.host_buffer {
                    Some(buf) => extract_urefs(buf),
                    None => Ok(vec![]),
                };
                match urefs {
                    Ok(urefs) => {
                        scoped_instrumenter.add_property(UREF_COUNT, urefs.len());
                        Error::Ret(urefs).into()
                    }
                    Err(e) => {
                        scoped_instrumenter.add_property(UREF_COUNT, 0);
                        e.into()
                    }
                }
            }
            Err(e) => {
                scoped_instrumenter.add_property(UREF_COUNT, 0);
                e.into()
            }
        }
    }
fn ret ( & mut self , value_ptr : u32 , value_size : usize , scoped_instrumenter : & mut ScopedInstrumenter , ) -> Trap { const UREF_COUNT : & str = " " ; self . host_buffer = None ; let mem_get = self . memory . get ( value_ptr , value_size ) . map_err ( | e | Error :: Interpreter ( e . into ( ) ) ) ; match mem_get { Ok ( buf ) => { // Set the result field in the runtime and return the proper element of the `Error` // enum indicating that the reason for exiting the module was a call to ret. self . host_buffer = bytesrepr :: deserialize ( buf ) . ok ( ) ; let urefs = match & self . host_buffer { Some ( buf ) => extract_urefs ( buf ) , None => Ok ( vec ! [ ] ) , } ; match urefs { Ok ( urefs ) => { scoped_instrumenter . add_property ( UREF_COUNT , urefs . len ( ) ) ; Error :: Ret ( urefs ) . into ( ) } Err ( e ) => { scoped_instrumenter . add_property ( UREF_COUNT , 0 ) ; e . into ( ) } } } Err ( e ) => { scoped_instrumenter . add_property ( UREF_COUNT , 0 ) ; e . into ( ) } } }
Return some bytes from the memory and terminate the current `sub_call`.
Return some bytes from the memory and terminate the current ` sub_call ` .
&mut self
value_ptr
u32
value_size
usize
scoped_instrumenter
&mut ScopedInstrumenter
&mut self
value_ptr
u32
value_size
usize
scoped_instrumenter
&mut ScopedInstrumenter