close to working

This commit is contained in:
Lachlan Sneff
2019-02-19 09:58:01 -08:00
parent e381bbd07b
commit 3c7dc200fa
10 changed files with 239 additions and 206 deletions

View File

@ -40,11 +40,11 @@ impl UserTrapper for Trapper {
pub struct Caller {
func_export_set: HashSet<FuncIndex>,
handler_data: HandlerData,
trampolines: Trampolines,
trampolines: Arc<Trampolines>,
}
impl Caller {
pub fn new(module: &ModuleInfo, handler_data: HandlerData, trampolines: Trampolines) -> Self {
pub fn new(module: &ModuleInfo, handler_data: HandlerData, trampolines: Arc<Trampolines>) -> Self {
let mut func_export_set = HashSet::new();
for export_index in module.exports.values() {
if let ExportIndex::Func(func_index) = export_index {
@ -187,15 +187,16 @@ fn get_func_from_index(
unsafe impl Send for HandlerData {}
unsafe impl Sync for HandlerData {}
#[derive(Clone)]
pub struct HandlerData {
pub trap_data: TrapSink,
pub trap_data: Arc<TrapSink>,
exec_buffer_ptr: *const c_void,
exec_buffer_size: usize,
}
impl HandlerData {
pub fn new(
trap_data: TrapSink,
trap_data: Arc<TrapSink>,
exec_buffer_ptr: *const c_void,
exec_buffer_size: usize,
) -> Self {