Full preemptive snapshot/resume.

This commit is contained in:
losfair
2019-06-27 15:49:43 +08:00
parent 7d0b70bddf
commit 967027003d
15 changed files with 523 additions and 223 deletions

View File

@ -9,6 +9,7 @@ use crate::{
};
use smallvec::SmallVec;
use std::any::Any;
use std::collections::HashMap;
use std::fmt;
use std::fmt::Debug;
use std::marker::PhantomData;
@ -16,6 +17,9 @@ use std::sync::{Arc, RwLock};
use wasmparser::{self, WasmDecoder};
use wasmparser::{Operator, Type as WpType};
pub type BkptHandler = Box<Fn(BkptInfo) -> Result<(), Box<dyn Any>> + Send + Sync + 'static>;
pub type BkptMap = Arc<HashMap<usize, BkptHandler>>;
#[derive(Debug)]
pub enum Event<'a, 'b> {
Internal(InternalEvent),
@ -26,7 +30,7 @@ pub enum Event<'a, 'b> {
pub enum InternalEvent {
FunctionBegin(u32),
FunctionEnd,
Breakpoint(Box<Fn(BkptInfo) + Send + Sync + 'static>),
Breakpoint(BkptHandler),
SetInternal(u32),
GetInternal(u32),
}
@ -43,8 +47,8 @@ impl fmt::Debug for InternalEvent {
}
}
pub struct BkptInfo {
pub throw: unsafe fn(Box<dyn Any>) -> !,
pub struct BkptInfo<'a> {
pub fault: Option<&'a dyn Any>,
}
pub trait ModuleCodeGenerator<FCG: FunctionCodeGenerator<E>, RM: RunnableModule, E: Debug> {