diff --git a/.circleci/config.yml b/.circleci/config.yml
index 3490bf6b539..67309e90320 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -21,7 +21,8 @@ jobs:
- checkout
- restore_cache:
keys:
- - v6-lint-{{ arch }}-{{ checksum "Cargo.lock" }}
+ - v8-lint-{{ arch }}-{{ checksum "Cargo.lock" }}
+ - v8-lint-{{ arch }}
- <<: *run_install_dependencies
- run:
name: Install lint deps
@@ -40,7 +41,7 @@ jobs:
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
- key: v6-test-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}
+ key: v8-lint-{{ arch }}-{{ checksum "Cargo.lock" }}
test:
docker:
@@ -50,14 +51,17 @@ jobs:
- checkout
- restore_cache:
keys:
- - v6-test-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}
+ - v8-test-cargo-cache-linux-stable-{{ arch }}-{{ checksum "Cargo.lock" }}
+ - v8-test-cargo-cache-linux-stable-{{ arch }}
- <<: *run_install_dependencies
- run:
name: Tests
command: make test
- run:
name: Emscripten Tests
- command: make test-emscripten
+ command: |
+ make test-emscripten-clif
+ make test-emscripten-llvm
- run:
name: Integration Tests
command: make integration-tests
@@ -67,7 +71,7 @@ jobs:
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
- key: v6-test-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}
+ key: v8-test-cargo-cache-linux-stable-{{ arch }}-{{ checksum "Cargo.lock" }}
test-macos:
macos:
@@ -76,7 +80,8 @@ jobs:
- checkout
- restore_cache:
keys:
- - v6-cargo-cache-darwin-{{ arch }}-{{ checksum "Cargo.lock" }}
+ - v8-cargo-cache-darwin-stable-{{ arch }}-{{ checksum "Cargo.lock" }}
+ - v8-cargo-cache-darwin-stable-{{ arch }}
- run:
name: Install crate dependencies
command: |
@@ -112,7 +117,8 @@ jobs:
# We increase the ulimit for fixing cargo unclosed files in mac
ulimit -n 8000
sudo sysctl -w kern.maxfiles=655360 kern.maxfilesperproc=327680
- make test-emscripten
+ make test-emscripten-clif
+ make test-emscripten-llvm
- run:
name: Integration Tests
command: |
@@ -129,7 +135,7 @@ jobs:
- target/release/.fingerprint
- target/release/build
- target/release/deps
- key: v6-cargo-cache-darwin-{{ arch }}-{{ checksum "Cargo.lock" }}
+ key: v8-cargo-cache-darwin-stable-{{ arch }}-{{ checksum "Cargo.lock" }}
test-and-build:
docker:
@@ -138,13 +144,16 @@ jobs:
- checkout
- restore_cache:
keys:
- - v6-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}
+ - v8-cargo-cache-linux-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
+ - v8-cargo-cache-linux-nightly-{{ arch }}
- run:
name: Install dependencies
command: |
sudo apt-get install -y cmake
curl -O https://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
tar xf clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
+ # Use rust nightly (for singlepass, for now)
+ - run: rustup default nightly-2019-04-11
- run:
name: Tests
command: |
@@ -154,7 +163,8 @@ jobs:
name: Emscripten Tests
command: |
export LLVM_SYS_70_PREFIX="`pwd`/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/"
- make test-emscripten
+ make test-emscripten-clif
+ make test-emscripten-llvm
- run:
name: Release Build
command: |
@@ -183,7 +193,7 @@ jobs:
- target/release/.fingerprint
- target/release/build
- target/release/deps
- key: v6-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}
+ key: v8-cargo-cache-linux-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
test-and-build-macos:
macos:
@@ -192,7 +202,8 @@ jobs:
- checkout
- restore_cache:
keys:
- - v6-cargo-cache-darwin-{{ arch }}-{{ checksum "Cargo.lock" }}
+ - v8-cargo-cache-darwin-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
+ - v8-cargo-cache-darwin-nightly-{{ arch }}
- run:
name: Install crate dependencies
command: |
@@ -209,6 +220,8 @@ jobs:
curl https://sh.rustup.rs -sSf | sh -s -- -y
export PATH="$HOME/.cargo/bin:$PATH"
cargo --version
+ # Use rust nightly (for singlepass, for now)
+ - run: rustup default nightly-2019-04-11
- run:
name: Tests
command: |
@@ -228,7 +241,8 @@ jobs:
# We increase the ulimit for fixing cargo unclosed files in mac
ulimit -n 8000
sudo sysctl -w kern.maxfiles=655360 kern.maxfilesperproc=327680
- make test-emscripten
+ make test-emscripten-clif
+ make test-emscripten-singlepass
- run:
name: Release Build
command: |
@@ -253,7 +267,7 @@ jobs:
- target/release/.fingerprint
- target/release/build
- target/release/deps
- key: v6-cargo-cache-darwin-{{ arch }}-{{ checksum "Cargo.lock" }}
+ key: v8-cargo-cache-darwin-nightly-{ arch }}-{{ checksum "Cargo.lock" }}
test-rust-nightly:
docker:
@@ -262,27 +276,28 @@ jobs:
- checkout
- restore_cache:
keys:
- - v6-test-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}-nightly
+ - v8-cargo-cache-linux-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
+ - v8-cargo-cache-linux-nightly-{{ arch }}
- run:
name: Install dependencies
command: |
sudo apt-get install -y cmake
curl -O https://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
tar xf clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
- - run: rustup default nightly-2019-02-27
+ - run: rustup default nightly-2019-04-11
- run: |
export LLVM_SYS_70_PREFIX="`pwd`/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/"
make test
- make test-nightly
+ make test-singlepass
make test-emscripten-clif
- make test-emscripten-nightly
+ make test-emscripten-singlepass
- save_cache:
paths:
- /usr/local/cargo/registry
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
- key: v6-test-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}-nightly
+ key: v8-cargo-cache-linux-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}-nightly
publish-github-release:
docker:
diff --git a/Cargo.lock b/Cargo.lock
index a82cca2b353..fec3babbb58 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2230,12 +2230,12 @@ dependencies = [
"structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.2.0",
- "wasmer-dynasm-backend 0.1.0",
"wasmer-emscripten 0.2.1",
"wasmer-llvm-backend 0.1.0",
"wasmer-runtime 0.2.1",
"wasmer-runtime-abi 0.2.1",
"wasmer-runtime-core 0.2.1",
+ "wasmer-singlepass-backend 0.1.0",
"wasmer-wasi 0.2.1",
]
@@ -2263,22 +2263,6 @@ dependencies = [
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
-[[package]]
-name = "wasmer-dynasm-backend"
-version = "0.1.0"
-dependencies = [
- "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "dynasm 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "dynasmrt 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
- "nix 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "wasmer-runtime-core 0.2.1",
- "wasmparser 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
[[package]]
name = "wasmer-emscripten"
version = "0.2.1"
@@ -2291,9 +2275,9 @@ dependencies = [
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.2.0",
- "wasmer-dynasm-backend 0.1.0",
"wasmer-llvm-backend 0.1.0",
"wasmer-runtime-core 0.2.1",
+ "wasmer-singlepass-backend 0.1.0",
]
[[package]]
@@ -2327,9 +2311,9 @@ dependencies = [
"tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.2.0",
- "wasmer-dynasm-backend 0.1.0",
"wasmer-llvm-backend 0.1.0",
"wasmer-runtime-core 0.2.1",
+ "wasmer-singlepass-backend 0.1.0",
]
[[package]]
@@ -2382,15 +2366,31 @@ dependencies = [
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
+[[package]]
+name = "wasmer-singlepass-backend"
+version = "0.1.0"
+dependencies = [
+ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "dynasm 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "dynasmrt 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
+ "nix 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "wasmer-runtime-core 0.2.1",
+ "wasmparser 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
[[package]]
name = "wasmer-spectests"
version = "0.2.0"
dependencies = [
"wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.2.0",
- "wasmer-dynasm-backend 0.1.0",
"wasmer-llvm-backend 0.1.0",
"wasmer-runtime-core 0.2.1",
+ "wasmer-singlepass-backend 0.1.0",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
index 244581f8d97..a82a52ef1d9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,7 +24,7 @@ structopt = "0.2.11"
wabt = "0.7.2"
hashbrown = "0.1.8"
wasmer-clif-backend = { path = "lib/clif-backend" }
-wasmer-dynasm-backend = { path = "lib/dynasm-backend", optional = true }
+wasmer-singlepass-backend = { path = "lib/singlepass-backend", optional = true }
wasmer-runtime = { path = "lib/runtime" }
wasmer-runtime-abi = { path = "lib/runtime-abi", optional = true }
wasmer-runtime-core = { path = "lib/runtime-core" }
@@ -33,18 +33,18 @@ wasmer-llvm-backend = { path = "lib/llvm-backend", optional = true }
wasmer-wasi = { path = "lib/wasi", optional = true }
[workspace]
-members = ["lib/clif-backend", "lib/dynasm-backend", "lib/runtime", "lib/runtime-abi", "lib/runtime-core", "lib/emscripten", "lib/spectests", "lib/win-exception-handler", "lib/runtime-c-api", "lib/llvm-backend", "lib/wasi"]
+members = ["lib/clif-backend", "lib/singlepass-backend", "lib/runtime", "lib/runtime-abi", "lib/runtime-core", "lib/emscripten", "lib/spectests", "lib/win-exception-handler", "lib/runtime-c-api", "lib/llvm-backend", "lib/wasi"]
[build-dependencies]
wabt = "0.7.2"
glob = "0.2.11"
[features]
-default = ["fast-tests", "wasi"]
+default = ["fast-tests", "wasi", "singlepass", "llvm"]
debug = ["wasmer-clif-backend/debug", "wasmer-runtime-core/debug"]
# This feature will allow cargo test to run much faster
fast-tests = []
-llvm = ["wasmer-llvm-backend", "wasmer-runtime/llvm"]
-dynasm = ["wasmer-dynasm-backend", "wasmer-runtime/dynasm"]
+llvm = ["wasmer-llvm-backend"]
+singlepass = ["wasmer-singlepass-backend"]
wasi = ["wasmer-wasi"]
vfs = ["wasmer-runtime-abi"]
diff --git a/Makefile b/Makefile
index 383d4ccf4ab..2b87dd7e7de 100644
--- a/Makefile
+++ b/Makefile
@@ -34,34 +34,33 @@ precommit: lint test
test:
# We use one thread so the emscripten stdouts doesn't collide
- cargo test --all --exclude wasmer-runtime-c-api --exclude wasmer-emscripten --exclude wasmer-spectests --exclude wasmer-dynasm-backend -- $(runargs)
+ cargo test --all --exclude wasmer-runtime-c-api --exclude wasmer-emscripten --exclude wasmer-spectests --exclude wasmer-singlepass-backend -- $(runargs)
# cargo test --all --exclude wasmer-emscripten -- --test-threads=1 $(runargs)
cargo test --manifest-path lib/spectests/Cargo.toml --features clif
cargo test --manifest-path lib/spectests/Cargo.toml --features llvm
cargo build -p wasmer-runtime-c-api
cargo test -p wasmer-runtime-c-api -- --nocapture
-test-nightly:
- cargo test --manifest-path lib/spectests/Cargo.toml --features dynasm
+test-singlepass:
+ cargo test --manifest-path lib/spectests/Cargo.toml --features singlepass
-test-emscripten:
- cargo test --manifest-path lib/emscripten/Cargo.toml --features clif -- --test-threads=1 $(runargs)
+test-emscripten-llvm:
cargo test --manifest-path lib/emscripten/Cargo.toml --features llvm -- --test-threads=1 $(runargs)
test-emscripten-clif:
cargo test --manifest-path lib/emscripten/Cargo.toml --features clif -- --test-threads=1 $(runargs)
-test-emscripten-nightly:
- cargo test --manifest-path lib/emscripten/Cargo.toml --features dynasm -- --test-threads=1 $(runargs)
+test-emscripten-singlepass:
+ cargo test --manifest-path lib/emscripten/Cargo.toml --features singlepass -- --test-threads=1 $(runargs)
-dynasm-debug-release:
- cargo +nightly build --features "dynasm debug" --release
+singlepass-debug-release:
+ cargo +nightly build --features "singlepass debug" --release
-dynasm-release:
- cargo +nightly build --features "dynasm" --release
+singlepass-release:
+ cargo +nightly build --features "singlepass" --release
-dynasm-build:
- cargo +nightly build --features "dynasm debug"
+singlepass-build:
+ cargo +nightly build --features "singlepass debug"
release:
# If you are in OS-X, you will need mingw-w64 for cross compiling to windows
diff --git a/lib/README.md b/lib/README.md
index b8a99dd6d68..83a3355886c 100644
--- a/lib/README.md
+++ b/lib/README.md
@@ -34,6 +34,6 @@ to tune the codegen properties (compile speed, performance, etc) to best fit the
Currently, we support multiple backends for compiling WebAssembly to machine code:
-- [dynasm-backend](./dynasm-backend/): Dynasm backend - super fast compilation, slower runtime speed
+- [singlepass-backend](./singlepass-backend/): Single pass backend - super fast compilation, slower runtime speed
- [clif-backend](./clif-backend/): Cranelift backend - slower compilation, normal runtime speed
- [llvm-backend](./llvm-backend/): LLVM backend - slow compilation, native runtime speed
diff --git a/lib/emscripten/Cargo.toml b/lib/emscripten/Cargo.toml
index 5c59db3506d..8b19340b0a7 100644
--- a/lib/emscripten/Cargo.toml
+++ b/lib/emscripten/Cargo.toml
@@ -15,7 +15,7 @@ libc = "0.2.49"
byteorder = "1"
time = "0.1.41"
wasmer-clif-backend = { path = "../clif-backend", version = "0.2.0" }
-wasmer-dynasm-backend = { path = "../dynasm-backend", version = "0.1.0", optional = true }
+wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.1.0", optional = true }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.1.0", optional = true }
[target.'cfg(windows)'.dependencies]
@@ -30,5 +30,5 @@ glob = "0.2.11"
[features]
clif = []
llvm = ["wasmer-llvm-backend"]
-dynasm = ["wasmer-dynasm-backend"]
+singlepass = ["wasmer-singlepass-backend"]
debug = ["wasmer-clif-backend/debug", "wasmer-runtime-core/debug"]
diff --git a/lib/emscripten/src/utils.rs b/lib/emscripten/src/utils.rs
index 725f0ba9408..e1cf13ef516 100644
--- a/lib/emscripten/src/utils.rs
+++ b/lib/emscripten/src/utils.rs
@@ -186,13 +186,13 @@ mod tests {
LLVMCompiler::new()
}
- #[cfg(feature = "dynasm")]
+ #[cfg(feature = "singlepass")]
fn get_compiler() -> impl Compiler {
- use wasmer_dynasm_backend::SinglePassCompiler;
+ use wasmer_singlepass_backend::SinglePassCompiler;
SinglePassCompiler::new()
}
- #[cfg(not(any(feature = "llvm", feature = "clif", feature = "dynasm")))]
+ #[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))]
fn get_compiler() -> impl Compiler {
panic!("compiler not specified, activate a compiler via features");
use wasmer_clif_backend::CraneliftCompiler;
diff --git a/lib/emscripten/tests/emtests/_common.rs b/lib/emscripten/tests/emtests/_common.rs
index ca5f6028265..18664e4eac7 100644
--- a/lib/emscripten/tests/emtests/_common.rs
+++ b/lib/emscripten/tests/emtests/_common.rs
@@ -20,13 +20,13 @@ macro_rules! assert_emscripten_output {
LLVMCompiler::new()
}
- #[cfg(feature = "dynasm")]
+ #[cfg(feature = "singlepass")]
fn get_compiler() -> impl Compiler {
- use wasmer_dynasm_backend::SinglePassCompiler;
+ use wasmer_singlepass_backend::SinglePassCompiler;
SinglePassCompiler::new()
}
- #[cfg(not(any(feature = "llvm", feature = "clif", feature = "dynasm")))]
+ #[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))]
fn get_compiler() -> impl Compiler {
panic!("compiler not specified, activate a compiler via features");
use wasmer_clif_backend::CraneliftCompiler;
diff --git a/lib/runtime-core/src/backend.rs b/lib/runtime-core/src/backend.rs
index 1e528651d92..1044a7ee56a 100644
--- a/lib/runtime-core/src/backend.rs
+++ b/lib/runtime-core/src/backend.rs
@@ -25,7 +25,7 @@ pub use crate::sig_registry::SigRegistry;
#[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq)]
pub enum Backend {
Cranelift,
- Dynasm,
+ Singlepass,
LLVM,
}
diff --git a/lib/runtime/Cargo.toml b/lib/runtime/Cargo.toml
index c137922f063..f34798bf550 100644
--- a/lib/runtime/Cargo.toml
+++ b/lib/runtime/Cargo.toml
@@ -9,7 +9,7 @@ edition = "2018"
readme = "README.md"
[dependencies]
-wasmer-dynasm-backend = { path = "../dynasm-backend", optional = true }
+wasmer-singlepass-backend = { path = "../singlepass-backend", optional = true }
lazy_static = "1.2.0"
memmap = "0.7.0"
@@ -37,7 +37,7 @@ default-compiler = ["wasmer-clif-backend"]
cache = ["default-compiler"]
debug = ["wasmer-clif-backend/debug", "wasmer-runtime-core/debug"]
llvm = ["wasmer-llvm-backend"]
-dynasm = ["wasmer-dynasm-backend"]
+singlepass = ["wasmer-singlepass-backend"]
[[bench]]
name = "nginx"
diff --git a/lib/runtime/src/lib.rs b/lib/runtime/src/lib.rs
index a45faddc1c7..1836bb206be 100644
--- a/lib/runtime/src/lib.rs
+++ b/lib/runtime/src/lib.rs
@@ -141,6 +141,16 @@ pub fn compile_with_config(
wasmer_runtime_core::compile_with_config(&wasm[..], default_compiler(), compiler_config)
}
+/// The same as `compile_with_config` but takes a `Compiler` for the purpose of
+/// changing the backend.
+pub fn compile_with_config_with(
+ wasm: &[u8],
+ compiler_config: CompilerConfig,
+ compiler: &dyn Compiler,
+) -> error::CompileResult