Refactor SimpleJITTrapSink/FaerieTrapSink into NullTrapSink.

This publishes it for use outside of simpljie/faerie as well.
This commit is contained in:
Dan Gohman
2018-04-17 11:22:11 -07:00
parent 1f43ec09f3
commit 58380f38e8
5 changed files with 18 additions and 20 deletions

View File

@@ -123,3 +123,11 @@ impl<'a> CodeSink for MemoryCodeSink<'a> {
self.traps.trap(ofs, srcloc, code);
}
}
/// A `TrapSink` implementation that does nothing, which is convenient when
/// compiling code that does not rely on trapping semantics.
pub struct NullTrapSink {}
impl TrapSink for NullTrapSink {
fn trap(&mut self, _offset: CodeOffset, _srcloc: SourceLoc, _code: TrapCode) {}
}

View File

@@ -6,7 +6,7 @@
mod memorysink;
mod relaxation;
pub use self::memorysink::{MemoryCodeSink, RelocSink, TrapSink};
pub use self::memorysink::{MemoryCodeSink, RelocSink, TrapSink, NullTrapSink};
pub use self::relaxation::relax_branches;
pub use regalloc::RegDiversions;