blob: e3c79b4880c189f4f5706d3c91dd3c1b49544039 (
plain)
use alloc::sync::Arc;
use tinywasm_types::*;
use crate::func::HostFunction;
/// A WebAssembly Function Instance
///
/// See <https://webassembly.github.io/spec/core/exec/runtime.html#function-instances>
#[derive(Clone)]
#[cfg_attr(feature = "debug", derive(Debug))]
pub(crate) struct FunctionInstance {
pub(crate) type_addr: TypeAddr,
pub(crate) kind: FunctionKind,
}
#[derive(Clone)]
#[cfg_attr(feature = "debug", derive(Debug))]
pub(crate) enum FunctionKind {
/// A host function
Host(Arc<HostFunction>),
/// A pointer to a WebAssembly function
Wasm(WasmFunctionInstance),
}
#[derive(Clone)]
#[cfg_attr(feature = "debug", derive(Debug))]
pub(crate) struct WasmFunctionInstance {
pub(crate) func: Arc<WasmFunction>,
pub(crate) owner: ModuleInstanceId,
}
|