wasm/execution/runtime_structure/
function_instances.rs1use alloc::vec::Vec;
2
3use crate::{
4 core::{decoding::reader::span::Span, structure::modules::indices::TypeIdx},
5 FuncType, Hostcode, ModuleAddr, ValType,
6};
7
8#[derive(Debug)]
9pub enum FuncInst {
11 WasmFunc(WasmFuncInst),
12 HostFunc(HostFuncInst),
13}
14
15#[derive(Debug)]
16pub struct WasmFuncInst {
17 pub function_type: FuncType,
18 pub _ty: TypeIdx,
19 pub locals: Vec<ValType>,
20 pub code_expr: Span,
21 pub stp: usize,
23
24 pub module_addr: ModuleAddr,
27}
28
29#[derive(Debug)]
30pub struct HostFuncInst {
31 pub function_type: FuncType,
32 pub hostcode: Hostcode,
33}
34
35impl FuncInst {
36 pub fn ty(&self) -> &FuncType {
37 match self {
38 FuncInst::WasmFunc(wasm_func_inst) => &wasm_func_inst.function_type,
39 FuncInst::HostFunc(host_func_inst) => &host_func_inst.function_type,
40 }
41 }
42}