MCPcopy Index your code
hub / github.com/explodingcamera/tinywasm / exec_call_host

Method exec_call_host

crates/tinywasm/src/interpreter/executor.rs:973–987  ·  view source on GitHub ↗
(&mut self, host_func: Rc<HostFunction>)

Source from the content-addressed store, hash-verified

971 }
972
973 fn exec_call_host(&mut self, host_func: Rc<HostFunction>) -> Result<(), Trap> {
974 let mut params = self.store.value_stack.pop_types(host_func.ty.params().iter().rev()).collect::<Vec<_>>();
975 params.reverse();
976 let res = match host_func.call(FuncContext { store: self.store, module_addr: self.module.idx() }, &params) {
977 Ok(res) => res,
978 Err(err) => {
979 cold_path();
980 return Err(Trap::HostFunction(Box::new(err)));
981 }
982 };
983
984 self.store.value_stack.extend_from_wasmvalues(&res)?;
985 self.cf.incr_instr_ptr();
986 Ok(())
987 }
988
989 fn exec_call_direct(&mut self, v: u32) -> Result<(), Trap> {
990 self.charge_call_fuel(FUEL_COST_CALL_TOTAL);

Callers 3

exec_call_directMethod · 0.80
exec_call_indirectMethod · 0.80

Calls 7

HostFunctionClass · 0.85
pop_typesMethod · 0.80
paramsMethod · 0.80
callMethod · 0.80
idxMethod · 0.80
incr_instr_ptrMethod · 0.80

Tested by

no test coverage detected