mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-12 13:55:33 +00:00
Update some internal fields from Rc to Arc
This commit is contained in:
parent
5fbae86d97
commit
801339acee
@ -4,11 +4,12 @@ use crate::{
|
||||
types::{GlobalDescriptor, Type, Value},
|
||||
vm,
|
||||
};
|
||||
use std::{cell::RefCell, fmt, rc::Rc};
|
||||
use std::sync::Arc;
|
||||
use std::{cell::RefCell, fmt};
|
||||
|
||||
pub struct Global {
|
||||
desc: GlobalDescriptor,
|
||||
storage: Rc<RefCell<vm::LocalGlobal>>,
|
||||
storage: Arc<RefCell<vm::LocalGlobal>>,
|
||||
}
|
||||
|
||||
impl Global {
|
||||
@ -56,7 +57,7 @@ impl Global {
|
||||
|
||||
Self {
|
||||
desc,
|
||||
storage: Rc::new(RefCell::new(local_global)),
|
||||
storage: Arc::new(RefCell::new(local_global)),
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,7 +121,7 @@ impl Clone for Global {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
desc: self.desc,
|
||||
storage: Rc::clone(&self.storage),
|
||||
storage: Arc::clone(&self.storage),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
use crate::export::Export;
|
||||
use std::collections::VecDeque;
|
||||
use std::collections::{hash_map::Entry, HashMap};
|
||||
use std::sync::Arc;
|
||||
use std::{
|
||||
cell::{Ref, RefCell},
|
||||
ffi::c_void,
|
||||
rc::Rc,
|
||||
};
|
||||
|
||||
pub trait LikeNamespace {
|
||||
@ -45,8 +45,8 @@ impl IsExport for Export {
|
||||
/// }
|
||||
/// ```
|
||||
pub struct ImportObject {
|
||||
map: Rc<RefCell<HashMap<String, Box<dyn LikeNamespace>>>>,
|
||||
pub(crate) state_creator: Option<Rc<dyn Fn() -> (*mut c_void, fn(*mut c_void))>>,
|
||||
map: Arc<RefCell<HashMap<String, Box<dyn LikeNamespace>>>>,
|
||||
pub(crate) state_creator: Option<Arc<dyn Fn() -> (*mut c_void, fn(*mut c_void))>>,
|
||||
pub allow_missing_functions: bool,
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ impl ImportObject {
|
||||
/// Create a new `ImportObject`.
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
map: Rc::new(RefCell::new(HashMap::new())),
|
||||
map: Arc::new(RefCell::new(HashMap::new())),
|
||||
state_creator: None,
|
||||
allow_missing_functions: false,
|
||||
}
|
||||
@ -65,8 +65,8 @@ impl ImportObject {
|
||||
F: Fn() -> (*mut c_void, fn(*mut c_void)) + 'static,
|
||||
{
|
||||
Self {
|
||||
map: Rc::new(RefCell::new(HashMap::new())),
|
||||
state_creator: Some(Rc::new(state_creator)),
|
||||
map: Arc::new(RefCell::new(HashMap::new())),
|
||||
state_creator: Some(Arc::new(state_creator)),
|
||||
allow_missing_functions: false,
|
||||
}
|
||||
}
|
||||
@ -117,7 +117,7 @@ impl ImportObject {
|
||||
|
||||
pub fn clone_ref(&self) -> Self {
|
||||
Self {
|
||||
map: Rc::clone(&self.map),
|
||||
map: Arc::clone(&self.map),
|
||||
state_creator: self.state_creator.clone(),
|
||||
allow_missing_functions: false,
|
||||
}
|
||||
|
@ -8,10 +8,10 @@ use crate::{
|
||||
units::Pages,
|
||||
vm,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use std::{
|
||||
cell::{Cell, RefCell},
|
||||
fmt, mem,
|
||||
rc::Rc,
|
||||
};
|
||||
|
||||
pub use self::atomic::Atomic;
|
||||
@ -211,7 +211,7 @@ enum UnsharedMemoryStorage {
|
||||
}
|
||||
|
||||
pub struct UnsharedMemory {
|
||||
internal: Rc<UnsharedMemoryInternal>,
|
||||
internal: Arc<UnsharedMemoryInternal>,
|
||||
}
|
||||
|
||||
struct UnsharedMemoryInternal {
|
||||
@ -238,7 +238,7 @@ impl UnsharedMemory {
|
||||
};
|
||||
|
||||
Ok(UnsharedMemory {
|
||||
internal: Rc::new(UnsharedMemoryInternal {
|
||||
internal: Arc::new(UnsharedMemoryInternal {
|
||||
storage: RefCell::new(storage),
|
||||
local: Cell::new(local),
|
||||
}),
|
||||
@ -279,7 +279,7 @@ impl UnsharedMemory {
|
||||
impl Clone for UnsharedMemory {
|
||||
fn clone(&self) -> Self {
|
||||
UnsharedMemory {
|
||||
internal: Rc::clone(&self.internal),
|
||||
internal: Arc::clone(&self.internal),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,8 @@ use crate::{
|
||||
types::{ElementType, TableDescriptor},
|
||||
vm,
|
||||
};
|
||||
use std::{cell::RefCell, fmt, ptr, rc::Rc};
|
||||
use std::sync::Arc;
|
||||
use std::{cell::RefCell, fmt, ptr};
|
||||
|
||||
mod anyfunc;
|
||||
|
||||
@ -25,7 +26,7 @@ pub enum TableStorage {
|
||||
|
||||
pub struct Table {
|
||||
desc: TableDescriptor,
|
||||
storage: Rc<RefCell<(TableStorage, vm::LocalTable)>>,
|
||||
storage: Arc<RefCell<(TableStorage, vm::LocalTable)>>,
|
||||
}
|
||||
|
||||
impl Table {
|
||||
@ -71,7 +72,7 @@ impl Table {
|
||||
|
||||
Ok(Self {
|
||||
desc,
|
||||
storage: Rc::new(RefCell::new((storage, local))),
|
||||
storage: Arc::new(RefCell::new((storage, local))),
|
||||
})
|
||||
}
|
||||
|
||||
@ -136,7 +137,7 @@ impl Clone for Table {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
desc: self.desc,
|
||||
storage: Rc::clone(&self.storage),
|
||||
storage: Arc::clone(&self.storage),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user