mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-09 22:28:21 +00:00
Make globals non leaking
This commit is contained in:
@@ -113,15 +113,10 @@ impl Global {
|
||||
Self::from_type(store, GlobalType::new(val.ty(), Mutability::Var), val).unwrap()
|
||||
}
|
||||
|
||||
pub fn from_type(store: &Store, ty: GlobalType, val: Val) -> Result<Global, RuntimeError> {
|
||||
fn from_type(store: &Store, ty: GlobalType, val: Val) -> Result<Global, RuntimeError> {
|
||||
if !val.comes_from_same_store(store) {
|
||||
return Err(RuntimeError::new("cross-`Store` globals are not supported"));
|
||||
}
|
||||
if val.ty() != ty.ty.clone() {
|
||||
return Err(RuntimeError::new(
|
||||
"value provided does not match the type of this global",
|
||||
));
|
||||
}
|
||||
let mut definition = VMGlobalDefinition::new();
|
||||
unsafe {
|
||||
match val {
|
||||
|
||||
Reference in New Issue
Block a user