Skip to content

Commit

Permalink
Merge pull request #4 from wasmerio/wasi
Browse files Browse the repository at this point in the history
Wasi support
  • Loading branch information
syrusakbary authored Apr 30, 2020
2 parents b82163a + 8417b3b commit d88fb95
Show file tree
Hide file tree
Showing 16 changed files with 550 additions and 520 deletions.
115 changes: 115 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ wasmer-compiler-cranelift = { path = "lib/compiler-cranelift", optional = true }
wasmer-compiler-singlepass = { path = "lib/compiler-singlepass", optional = true }
wasmer-compiler-llvm = { path = "lib/compiler-llvm", optional = true }
wasmer-jit = { path = "lib/jit" }
wasmer-wast = { path = "tests/lib/wast", optional = true}
wasmer-wasi = { path = "lib/wasi", optional = true }
wasmer-wast = { path = "tests/lib/wast", optional = true }
atty = "0.2"
anyhow = "1.0.28"
structopt = { version = "0.3", features = ["suggestions"] }
Expand All @@ -53,8 +54,12 @@ wasmer-wast = { path = "tests/lib/wast" }
# Don't add the backend features in default, please add them on the Makefile
# since we might want to autoconfigure them depending on the availability on the host.
# default = ["wasi"]
default = ["wast", "compiler-cranelift"]
default = ["wast", "wasi", "compiler-cranelift"]
wast = ["wasmer-wast"]
wasi = ["wasmer-wasi"]
experimental-io-devices = [
# "wasmer-wasi-experimental-io-devices"
]
compiler-singlepass = [
"test-utils/compiler-singlepass",
"wasmer/compiler-singlepass",
Expand All @@ -70,5 +75,3 @@ compiler-llvm = [
"wasmer/compiler-llvm",
"wasmer-compiler-llvm",
]
# wasi = ["wasmer-wasi"]
# experimental-io-devices = ["wasmer-wasi-experimental-io-devices"]
1 change: 1 addition & 0 deletions lib/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub use crate::types::{
MemoryType, Mutability, TableType, Val, ValType,
};

pub use wasm_common::{ValueType, WasmExternType, WasmTypeList};
pub use wasmer_compiler::CompilerConfig;
pub use wasmer_jit::{
DeserializeError, InstantiationError, LinkError, RuntimeError, SerializeError,
Expand Down
8 changes: 7 additions & 1 deletion lib/jit/src/trap/error.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use super::frame_info::{FrameInfo, GlobalFrameInfo, FRAME_INFO};
use backtrace::Backtrace;
use std::error::Error;
use std::fmt;
use std::sync::Arc;
use wasmer_runtime::{Trap, TrapCode};
use wasmer_runtime::{raise_user_trap, Trap, TrapCode};

/// A struct representing an aborted instruction execution, with a message
/// indicating the cause.
Expand Down Expand Up @@ -60,6 +61,11 @@ impl RuntimeError {
}
}

/// Raises a custom user Error
pub fn raise(error: Box<dyn Error + Send + Sync>) -> ! {
unsafe { raise_user_trap(error) }
}

fn new_wasm(
info: &GlobalFrameInfo,
trap_pc: Option<usize>,
Expand Down
Loading

0 comments on commit d88fb95

Please sign in to comment.