1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use crate::{store::MaybeInstanceOwned, vmcontext::VMGlobalDefinition};
use std::{cell::UnsafeCell, ptr::NonNull};
use wasmer_types::GlobalType;
pub struct VMGlobal {
ty: GlobalType,
vm_global_definition: MaybeInstanceOwned<VMGlobalDefinition>,
}
impl VMGlobal {
pub fn new(global_type: GlobalType) -> Self {
Self {
ty: global_type,
vm_global_definition: MaybeInstanceOwned::Host(Box::new(UnsafeCell::new(
VMGlobalDefinition::new(),
))),
}
}
pub fn ty(&self) -> &GlobalType {
&self.ty
}
pub fn vmglobal(&self) -> NonNull<VMGlobalDefinition> {
self.vm_global_definition.as_ptr()
}
}