1use crate::global::VMGlobal;
5use crate::memory::VMMemory;
6use crate::store::InternalStoreHandle;
7use crate::table::VMTable;
8use crate::vmcontext::VMFunctionKind;
9use crate::{MaybeInstanceOwned, VMCallerCheckedAnyfunc};
10use std::any::Any;
11use wasmer_types::{FunctionType, TagKind};
12
13#[cfg_attr(feature = "artifact-size", derive(loupe::MemoryUsage))]
15pub enum VMExtern {
16 Function(InternalStoreHandle<VMFunction>),
18
19 Table(InternalStoreHandle<VMTable>),
21
22 Memory(InternalStoreHandle<VMMemory>),
24
25 Global(InternalStoreHandle<VMGlobal>),
27
28 Tag(InternalStoreHandle<VMTag>),
30}
31
32#[derive(Debug)]
34pub struct VMFunction {
35 pub anyfunc: MaybeInstanceOwned<VMCallerCheckedAnyfunc>,
38
39 pub signature: FunctionType,
41
42 pub kind: VMFunctionKind,
45
46 pub host_data: Box<dyn Any>,
48}
49
50#[derive(Debug, Clone, Eq, PartialEq)]
52pub struct VMTag {
53 pub kind: TagKind,
56 pub signature: FunctionType,
58}
59
60impl VMTag {
61 pub fn new(kind: TagKind, signature: FunctionType) -> Self {
63 Self { kind, signature }
64 }
65}