Use Arc instead of Rc

This commit is contained in:
Syrus
2019-12-20 20:33:50 -08:00
parent 097353d0d4
commit c4d70a6b75
12 changed files with 16 additions and 35 deletions

View File

@ -20,7 +20,6 @@ use std::{
sync::{Arc, RwLock},
usize,
};
use std::{cell::RefCell, rc::Rc};
use wasmer_runtime_core::{
backend::{
sys::{Memory, Protect},
@ -368,7 +367,7 @@ impl RunnableModule for X64ExecutionContext {
user_error: *mut Option<Box<dyn Any + Send>>,
num_params_plus_one: Option<NonNull<c_void>>,
) -> bool {
let rm: &Box<dyn RunnableModule> = &(&*(*ctx).module).runnable_module.borrow();
let rm: &Box<dyn RunnableModule> = &(&*(*ctx).module).runnable_module;
let args =
slice::from_raw_parts(args, num_params_plus_one.unwrap().as_ptr() as usize - 1);
@ -918,11 +917,10 @@ impl ModuleCodeGenerator<X64FunctionCode, X64ExecutionContext, CodegenError>
msm: cache_image.msm,
};
Ok(ModuleInner {
runnable_module: Rc::new(RefCell::new(Box::new(ec))),
runnable_module: Arc::new(Box::new(ec)),
cache_gen: Box::new(SinglepassCache {
buffer: Arc::from(memory.as_slice().to_vec().into_boxed_slice()),
}),
info,
})
}