Various cleanups.

This commit is contained in:
losfair 2019-04-28 12:48:01 +08:00
parent 2262c8a6da
commit 6beb76c3ae
4 changed files with 5 additions and 13 deletions

View File

@ -15,7 +15,7 @@ impl FunctionMiddleware for CallTrace {
) -> Result<(), Self::Error> { ) -> Result<(), Self::Error> {
match op { match op {
Event::Internal(InternalEvent::FunctionBegin(id)) => { Event::Internal(InternalEvent::FunctionBegin(id)) => {
sink.push(Event::Internal(InternalEvent::Bkpt(Box::new(move |_| { sink.push(Event::Internal(InternalEvent::Breakpoint(Box::new(move |_| {
println!("func ({})", id); println!("func ({})", id);
})))) }))))
} }

View File

@ -1,9 +1 @@
pub mod call_trace; pub mod call_trace;
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}

View File

@ -21,7 +21,7 @@ pub enum Event<'a, 'b> {
pub enum InternalEvent { pub enum InternalEvent {
FunctionBegin(u32), FunctionBegin(u32),
FunctionEnd, FunctionEnd,
Bkpt(Box<Fn(BkptInfo) + Send + Sync + 'static>), Breakpoint(Box<Fn(BkptInfo) + Send + Sync + 'static>),
SetInternal(u32), SetInternal(u32),
GetInternal(u32), GetInternal(u32),
} }
@ -120,7 +120,7 @@ impl<
impl CacheGen for Placeholder { impl CacheGen for Placeholder {
fn generate_cache(&self) -> Result<(Box<[u8]>, Memory), CacheError> { fn generate_cache(&self) -> Result<(Box<[u8]>, Memory), CacheError> {
Err(CacheError::Unknown( Err(CacheError::Unknown(
"the singlepass backend doesn't support caching yet".to_string(), "the streaming compiler API doesn't support caching yet".to_string(),
)) ))
} }
} }
@ -148,7 +148,7 @@ impl<
unsafe fn from_cache(&self, _artifact: Artifact, _: Token) -> Result<ModuleInner, CacheError> { unsafe fn from_cache(&self, _artifact: Artifact, _: Token) -> Result<ModuleInner, CacheError> {
Err(CacheError::Unknown( Err(CacheError::Unknown(
"the singlepass backend doesn't support caching yet".to_string(), "the streaming compiler API doesn't support caching yet".to_string(),
)) ))
} }
} }

View File

@ -1453,7 +1453,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
Event::Wasm(x) => x, Event::Wasm(x) => x,
Event::Internal(x) => { Event::Internal(x) => {
match x { match x {
InternalEvent::Bkpt(callback) => { InternalEvent::Breakpoint(callback) => {
a.emit_bkpt(); a.emit_bkpt();
self.breakpoints self.breakpoints
.as_mut() .as_mut()