diff --git a/lib/runtime-core/src/backend.rs b/lib/runtime-core/src/backend.rs index d1fce60fc..ed8733bde 100644 --- a/lib/runtime-core/src/backend.rs +++ b/lib/runtime-core/src/backend.rs @@ -9,7 +9,7 @@ use crate::{ use crate::{ cache::{Artifact, Error as CacheError}, - codegen::BkptMap, + codegen::BreakpointMap, module::ModuleInfo, sys::Memory, }; @@ -90,7 +90,7 @@ pub trait RunnableModule: Send + Sync { None } - fn get_breakpoints(&self) -> Option { + fn get_breakpoints(&self) -> Option { None } diff --git a/lib/runtime-core/src/codegen.rs b/lib/runtime-core/src/codegen.rs index 20f84ef6e..508d48f92 100644 --- a/lib/runtime-core/src/codegen.rs +++ b/lib/runtime-core/src/codegen.rs @@ -17,8 +17,8 @@ use std::sync::{Arc, RwLock}; use wasmparser::{self, WasmDecoder}; use wasmparser::{Operator, Type as WpType}; -pub type BkptHandler = Box Result<(), Box> + Send + Sync + 'static>; -pub type BkptMap = Arc>; +pub type BreakpointHandler = Box Result<(), Box> + Send + Sync + 'static>; +pub type BreakpointMap = Arc>; #[derive(Debug)] pub enum Event<'a, 'b> { @@ -30,7 +30,7 @@ pub enum Event<'a, 'b> { pub enum InternalEvent { FunctionBegin(u32), FunctionEnd, - Breakpoint(BkptHandler), + Breakpoint(BreakpointHandler), SetInternal(u32), GetInternal(u32), } @@ -47,7 +47,7 @@ impl fmt::Debug for InternalEvent { } } -pub struct BkptInfo<'a> { +pub struct BreakpointInfo<'a> { pub fault: Option<&'a dyn Any>, } diff --git a/lib/runtime-core/src/fault.rs b/lib/runtime-core/src/fault.rs index 86b65f6ed..119aeae04 100644 --- a/lib/runtime-core/src/fault.rs +++ b/lib/runtime-core/src/fault.rs @@ -8,7 +8,7 @@ mod raw { } } -use crate::codegen::{BkptInfo, BkptMap}; +use crate::codegen::{BreakpointInfo, BreakpointMap}; use crate::state::x64::{build_instance_image, read_stack, X64Register, GPR, XMM}; use crate::vm; use libc::{mmap, mprotect, siginfo_t, MAP_ANON, MAP_PRIVATE, PROT_NONE, PROT_READ, PROT_WRITE}; @@ -34,7 +34,7 @@ type SetJmpBuffer = [i32; SETJMP_BUFFER_LEN]; struct UnwindInfo { jmpbuf: SetJmpBuffer, // in - breakpoints: Option, + breakpoints: Option, payload: Option>, // out } @@ -88,7 +88,7 @@ pub unsafe fn clear_wasm_interrupt() { pub unsafe fn catch_unsafe_unwind R>( f: F, - breakpoints: Option, + breakpoints: Option, ) -> Result> { let unwind = UNWIND.with(|x| x.get()); let old = (*unwind).take(); @@ -120,7 +120,7 @@ pub unsafe fn begin_unsafe_unwind(e: Box) -> ! { raw::longjmp(&mut inner.jmpbuf as *mut SetJmpBuffer as *mut _, 0xffff); } -unsafe fn with_breakpoint_map) -> R>(f: F) -> R { +unsafe fn with_breakpoint_map) -> R>(f: F) -> R { let unwind = UNWIND.with(|x| x.get()); let inner = (*unwind) .as_mut() @@ -183,7 +183,7 @@ extern "C" fn signal_trap_handler( // breakpoint let out: Option>> = with_breakpoint_map(|bkpt_map| { bkpt_map.and_then(|x| x.get(&(fault.ip as usize))).map(|x| { - x(BkptInfo { + x(BreakpointInfo { fault: Some(&fault), }) }) diff --git a/lib/runtime-core/src/state.rs b/lib/runtime-core/src/state.rs index 841e3deee..ba3ea0def 100644 --- a/lib/runtime-core/src/state.rs +++ b/lib/runtime-core/src/state.rs @@ -360,7 +360,7 @@ impl InstanceImage { pub mod x64 { use super::*; use crate::fault::{catch_unsafe_unwind, run_on_alternative_stack}; - use crate::codegen::BkptMap; + use crate::codegen::BreakpointMap; use crate::structures::TypedIndex; use crate::types::LocalGlobalIndex; use crate::vm::Ctx; @@ -382,7 +382,7 @@ pub mod x64 { code_base: usize, image: InstanceImage, vmctx: &mut Ctx, - breakpoints: Option, + breakpoints: Option, ) -> Result> { let mut stack: Vec = vec![0; 1048576 * 8 / 8]; // 8MB stack let mut stack_offset: usize = stack.len(); diff --git a/lib/singlepass-backend/src/codegen_x64.rs b/lib/singlepass-backend/src/codegen_x64.rs index 1163575fb..0f69c5299 100644 --- a/lib/singlepass-backend/src/codegen_x64.rs +++ b/lib/singlepass-backend/src/codegen_x64.rs @@ -148,7 +148,7 @@ pub struct X64FunctionCode { breakpoints: Option< HashMap< AssemblyOffset, - Box Result<(), Box> + Send + Sync + 'static>, + Box Result<(), Box> + Send + Sync + 'static>, >, >, returns: SmallVec<[WpType; 1]>, @@ -178,7 +178,7 @@ pub struct X64ExecutionContext { function_pointers: Vec, function_offsets: Vec, signatures: Arc>, - breakpoints: BkptMap, + breakpoints: BreakpointMap, func_import_count: usize, msm: ModuleStateMap, } @@ -216,7 +216,7 @@ impl RunnableModule for X64ExecutionContext { Some(self.msm.clone()) } - fn get_breakpoints(&self) -> Option { + fn get_breakpoints(&self) -> Option { Some(self.breakpoints.clone()) } diff --git a/lib/singlepass-backend/src/protect_unix.rs b/lib/singlepass-backend/src/protect_unix.rs index bf8274beb..2129f0e5b 100644 --- a/lib/singlepass-backend/src/protect_unix.rs +++ b/lib/singlepass-backend/src/protect_unix.rs @@ -14,7 +14,7 @@ use std::cell::Cell; use wasmer_runtime_core::fault::{ begin_unsafe_unwind, catch_unsafe_unwind, ensure_sighandler, }; -use wasmer_runtime_core::codegen::BkptMap; +use wasmer_runtime_core::codegen::BreakpointMap; use wasmer_runtime_core::typed_func::WasmTrapInfo; thread_local! { @@ -32,7 +32,7 @@ pub enum CallProtError { pub fn call_protected( f: impl FnOnce() -> T, - breakpoints: Option, + breakpoints: Option, ) -> Result { ensure_sighandler(); unsafe {