fn translate_load_builtin_function_address(
        &mut self,
        pos: &mut FuncCursor<'_>,
        callee_func_idx: BuiltinFunctionIndex,
    ) -> (ir::Value, ir::Value) {
        // We use an indirect call so that we don't have to patch the code at runtime.
        let pointer_type = self.pointer_type();
        let vmctx = self.vmctx(&mut pos.func);
        let base = pos.ins().global_value(pointer_type, vmctx);

        let mut mem_flags = ir::MemFlags::trusted();
        mem_flags.set_readonly();

        // Load the base of the array of builtin functions
        let array_offset = i32::try_from(self.offsets.vmctx_builtin_functions()).unwrap();
        let array_addr = pos.ins().load(pointer_type, mem_flags, base, array_offset);

        // Load the callee address.
        let body_offset = i32::try_from(callee_func_idx.index() * pointer_type.bytes()).unwrap();
        let func_addr = pos
            .ins()
            .load(pointer_type, mem_flags, array_addr, body_offset);

        (base, func_addr)
    }
/// Translates load of builtin function and returns a pair of values `vmctx`
/// and address of the loaded function.
Translates load of builtin function and returns a pair of values `vmctx`
and address of the loaded function.
Translates load of builtin function and returns a pair of values ` vmctx ` and address of the loaded function .
fn translate_load_builtin_function_address(
        &mut self,
        pos: &mut FuncCursor<'_>,
        callee_func_idx: BuiltinFunctionIndex,
    ) -> (ir::Value, ir::Value) {
        // We use an indirect call so that we don't have to patch the code at runtime.
        let pointer_type = self.pointer_type();
        let vmctx = self.vmctx(&mut pos.func);
        let base = pos.ins().global_value(pointer_type, vmctx);
        let mut mem_flags = ir::MemFlags::trusted();
        mem_flags.set_readonly();
        // Load the base of the array of builtin functions
        let array_offset = i32::try_from(self.offsets.vmctx_builtin_functions()).unwrap();
        let array_addr = pos.ins().load(pointer_type, mem_flags, base, array_offset);
        // Load the callee address.
        let body_offset = i32::try_from(callee_func_idx.index() * pointer_type.bytes()).unwrap();
        let func_addr = pos
            .ins()
            .load(pointer_type, mem_flags, array_addr, body_offset);
        (base, func_addr)
    }
fn translate_load_builtin_function_address ( & mut self , pos : & mut FuncCursor < ' _ > , callee_func_idx : BuiltinFunctionIndex , ) -> ( ir :: Value , ir :: Value ) { // We use an indirect call so that we don't have to patch the code at runtime. let pointer_type = self . pointer_type ( ) ; let vmctx = self . vmctx ( & mut pos . func ) ; let base = pos . ins ( ) . global_value ( pointer_type , vmctx ) ; let mut mem_flags = ir :: MemFlags :: trusted ( ) ; mem_flags . set_readonly ( ) ; // Load the base of the array of builtin functions let array_offset = i32 :: try_from ( self . offsets . vmctx_builtin_functions ( ) ) . unwrap ( ) ; let array_addr = pos . ins ( ) . load ( pointer_type , mem_flags , base , array_offset ) ; // Load the callee address. let body_offset = i32 :: try_from ( callee_func_idx . index ( ) * pointer_type . bytes ( ) ) . unwrap ( ) ; let func_addr = pos . ins ( ) . load ( pointer_type , mem_flags , array_addr , body_offset ) ; ( base , func_addr ) }
Translates load of builtin function and returns a pair of values `vmctx`
and address of the loaded function.
Translates load of builtin function and returns a pair of values ` vmctx ` and address of the loaded function .
&mut self
pos
&mut FuncCursor<'_>
callee_func_idx
BuiltinFunctionIndex
&mut self
pos
&mut FuncCursor<'_>
callee_func_idx
BuiltinFunctionIndex