clean up implementation

This commit is contained in:
Mark McCaskey
2019-03-27 14:01:27 -07:00
parent f9a29445ca
commit 09068c1a74
11 changed files with 109 additions and 58 deletions

View File

@ -5,9 +5,10 @@ use crate::{
structures::TypedIndex,
types::{LocalOrImport, MemoryIndex},
};
use hashbrown::HashMap;
use std::{ffi::c_void, mem, ptr};
use hashbrown::HashMap;
/// The context of the currently running WebAssembly instance.
///
///
@ -25,8 +26,6 @@ pub struct Ctx {
pub data: *mut c_void,
pub data_finalizer: Option<extern "C" fn(data: *mut c_void)>,
pub maybe_symbol_map: Option<HashMap<u32, String>>,
}
/// The internal context of the currently running WebAssembly instance.
@ -70,7 +69,6 @@ impl Ctx {
local_backing: &mut LocalBacking,
import_backing: &mut ImportBacking,
module: &ModuleInner,
maybe_symbol_map: Option<HashMap<u32, String>>,
) -> Self {
Self {
internal: InternalCtx {
@ -93,7 +91,6 @@ impl Ctx {
data: ptr::null_mut(),
data_finalizer: None,
maybe_symbol_map,
}
}
@ -126,7 +123,6 @@ impl Ctx {
data,
data_finalizer: Some(data_finalizer),
maybe_symbol_map: None,
}
}
@ -162,6 +158,10 @@ impl Ctx {
},
}
}
pub unsafe fn borrow_symbol_map(&self) -> &Option<HashMap<u32, String>> {
&(*self.module).info.em_symbol_map
}
}
#[doc(hidden)]