Remove UserTrapper trait

This commit is contained in:
Lachlan Sneff
2019-04-18 10:00:15 -07:00
parent ccad8874e9
commit 4dd64ed72e
8 changed files with 14 additions and 58 deletions

View File

@ -4,7 +4,7 @@ use crate::trampoline::Trampolines;
use libc::c_void;
use std::{any::Any, cell::Cell, ptr::NonNull, sync::Arc};
use wasmer_runtime_core::{
backend::{RunnableModule, UserTrapper},
backend::RunnableModule,
module::ModuleInfo,
typed_func::{Wasm, WasmTrapInfo},
types::{LocalFuncIndex, SigIndex},
@ -27,15 +27,6 @@ thread_local! {
pub static TRAP_EARLY_DATA: Cell<Option<Box<dyn Any>>> = Cell::new(None);
}
pub struct Trapper;
impl UserTrapper for Trapper {
unsafe fn do_early_trap(&self, data: Box<dyn Any>) -> ! {
TRAP_EARLY_DATA.with(|cell| cell.set(Some(data)));
trigger_trap()
}
}
pub struct Caller {
handler_data: HandlerData,
trampolines: Arc<Trampolines>,
@ -101,8 +92,9 @@ impl RunnableModule for Caller {
})
}
fn get_early_trapper(&self) -> Box<dyn UserTrapper> {
Box::new(Trapper)
unsafe fn do_early_trap(&self, data: Box<dyn Any>) -> ! {
TRAP_EARLY_DATA.with(|cell| cell.set(Some(data)));
trigger_trap()
}
}