Implement wasm trap handlers. (#27)

* Implement wasm trap handlers.

This adds signal handlers based on SpiderMonkey's signal-handler code.
The functionality for looking up the trap code and wasm bytecode offset
isn't yet implemented, but this is a start.

I considered rewriting this code in Rust, but decided against it for now
as C++ allows us to talk to the relevant OS APIs more directly.

Fixes #15.

* Compile with -std=c++11.

* Refactor InstallState initialization.

* Compile with -fPIC.

* Factor out the code for calling a wasm function with a given index.

* Fix unclear wording in a comment.
This commit is contained in:
Dan Gohman
2018-11-27 06:05:58 -08:00
committed by GitHub
parent 8e1e75f1f4
commit 35627cf37f
9 changed files with 1132 additions and 19 deletions

View File

@@ -36,13 +36,19 @@ extern crate wasmtime_environ;
#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc;
#[macro_use]
extern crate lazy_static;
extern crate libc;
mod execute;
mod instance;
mod memory;
mod signalhandlers;
mod traphandlers;
pub use execute::{compile_and_link_module, execute, finish_instantiation};
pub use instance::Instance;
pub use traphandlers::{call_wasm, LookupCodeSegment, RecordTrap, Unwind};
#[cfg(not(feature = "std"))]
mod std {