(func: &Function, store: &mut Store, params: &[WasmValue])
| 12 | pub fn call(&self, store: &mut Store, params: &[WasmValue]) -> Result<Vec<WasmValue>> { |
| 13 | #[inline] |
| 14 | fn call_inner(func: &Function, store: &mut Store, params: &[WasmValue]) -> Result<Vec<WasmValue>> { |
| 15 | let func_instance = store.state.get_func(func.addr); |
| 16 | let wasm_func = match func_instance { |
| 17 | FunctionInstance::Host(host_func) => { |
| 18 | return host_func.clone().call(FuncContext { store, module_addr: func.module_addr }, params); |
| 19 | } |
| 20 | FunctionInstance::Wasm(wasm_func) => wasm_func, |
| 21 | }; |
| 22 | |
| 23 | // Reset stack, push args, allocate locals, create entry frame. |
| 24 | store.call_stack.clear(); |
| 25 | store.value_stack.clear(); |
| 26 | store.value_stack.extend_from_wasmvalues(params)?; |
| 27 | let locals_base = store.value_stack.enter_locals(&wasm_func.func.params, &wasm_func.func.locals)?; |
| 28 | let callframe = CallFrame::new(func.addr, locals_base, wasm_func.func.locals); |
| 29 | |
| 30 | // Execute until completion and then collect result values from the stack. |
| 31 | InterpreterRuntime::exec(store, callframe, 0)?; |
| 32 | collect_call_results(&mut store.value_stack, &func.ty) |
| 33 | } |
| 34 | |
| 35 | self.item.validate_store(store)?; |
| 36 | validate_call_params(&self.ty, params)?; |
nothing calls this directly
no test coverage detected