diff --git a/CHANGELOG.md b/CHANGELOG.md
index 33e8f406bd7..f07f9344fd4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,9 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C
## **Unreleased**
+### Changed
+- #2946 Remove dylib,staticlib engines in favor of a single Universal engine
+
### Fixed
- [#2942](https://github.com/wasmerio/wasmer/pull/2942) Fix clippy lints.
- [#2943](https://github.com/wasmerio/wasmer/pull/2943) Fix build error on some archs by using c_char instead of i8
diff --git a/Cargo.lock b/Cargo.lock
index f36ce7f52f4..919adaecb69 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -160,7 +160,7 @@ dependencies = [
"regex",
"rustc-hash",
"shlex",
- "which 3.1.1",
+ "which",
]
[[package]]
@@ -1881,6 +1881,7 @@ checksum = "517a3034eb2b1499714e9d1e49b2367ad567e07639b69776d35e259d9c27cca6"
dependencies = [
"bytecheck",
"hashbrown 0.12.1",
+ "indexmap",
"ptr_meta",
"rend",
"rkyv_derive",
@@ -1934,7 +1935,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
- "semver 1.0.9",
+ "semver 1.0.10",
]
[[package]]
@@ -2033,9 +2034,9 @@ dependencies = [
[[package]]
name = "semver"
-version = "1.0.9"
+version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8cb243bdfdb5936c8dc3c45762a19d12ab4550cdc753bc247637d4ec35a040fd"
+checksum = "a41d061efea015927ac527063765e73601444cdc344ba855bc7bd44578b25e1c"
[[package]]
name = "semver-parser"
@@ -2458,9 +2459,9 @@ dependencies = [
[[package]]
name = "tracing"
-version = "0.1.34"
+version = "0.1.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09"
+checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160"
dependencies = [
"cfg-if 1.0.0",
"log",
@@ -2752,6 +2753,15 @@ dependencies = [
"leb128",
]
+[[package]]
+name = "wasm-encoder"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "31f0c17267a5ffd6ae3d897589460e21db1673c84fb7016b909c9691369a75ea"
+dependencies = [
+ "leb128",
+]
+
[[package]]
name = "wasm-smith"
version = "0.4.5"
@@ -2761,7 +2771,7 @@ dependencies = [
"arbitrary",
"indexmap",
"leb128",
- "wasm-encoder",
+ "wasm-encoder 0.4.1",
]
[[package]]
@@ -2779,15 +2789,11 @@ dependencies = [
"thiserror",
"wasm-bindgen",
"wasm-bindgen-test",
- "wasmer-artifact",
"wasmer-compiler",
"wasmer-compiler-cranelift",
"wasmer-compiler-llvm",
"wasmer-compiler-singlepass",
"wasmer-derive",
- "wasmer-engine",
- "wasmer-engine-dylib",
- "wasmer-engine-universal",
"wasmer-types",
"wasmer-vm",
"wasmparser 0.83.0",
@@ -2795,16 +2801,6 @@ dependencies = [
"winapi",
]
-[[package]]
-name = "wasmer-artifact"
-version = "2.3.0"
-dependencies = [
- "enumset",
- "thiserror",
- "wasmer-compiler",
- "wasmer-types",
-]
-
[[package]]
name = "wasmer-bin-fuzz"
version = "0.0.0"
@@ -2813,11 +2809,10 @@ dependencies = [
"libfuzzer-sys",
"wasm-smith",
"wasmer",
+ "wasmer-compiler",
"wasmer-compiler-cranelift",
"wasmer-compiler-llvm",
"wasmer-compiler-singlepass",
- "wasmer-engine-dylib",
- "wasmer-engine-universal",
"wasmer-middlewares",
"wasmprinter",
]
@@ -2838,14 +2833,11 @@ dependencies = [
"thiserror",
"typetag",
"wasmer",
+ "wasmer-compiler",
"wasmer-compiler-cranelift",
"wasmer-compiler-llvm",
"wasmer-compiler-singlepass",
"wasmer-emscripten",
- "wasmer-engine",
- "wasmer-engine-dylib",
- "wasmer-engine-staticlib",
- "wasmer-engine-universal",
"wasmer-middlewares",
"wasmer-types",
"wasmer-wasi",
@@ -2862,9 +2854,8 @@ dependencies = [
"tempfile",
"thiserror",
"wasmer",
+ "wasmer-compiler",
"wasmer-compiler-singlepass",
- "wasmer-engine-dylib",
- "wasmer-engine-universal",
]
[[package]]
@@ -2889,10 +2880,6 @@ dependencies = [
"wasmer-compiler-llvm",
"wasmer-compiler-singlepass",
"wasmer-emscripten",
- "wasmer-engine",
- "wasmer-engine-dylib",
- "wasmer-engine-staticlib",
- "wasmer-engine-universal",
"wasmer-types",
"wasmer-vfs",
"wasmer-vm",
@@ -2905,16 +2892,27 @@ dependencies = [
name = "wasmer-compiler"
version = "2.3.0"
dependencies = [
+ "backtrace",
+ "cfg-if 1.0.0",
+ "enum-iterator",
"enumset",
"hashbrown 0.11.2",
+ "lazy_static",
+ "leb128",
+ "memmap2",
+ "more-asserts",
+ "region",
"rkyv",
+ "rustc-demangle",
"serde",
"serde_bytes",
"smallvec",
"target-lexicon 0.12.4",
"thiserror",
"wasmer-types",
+ "wasmer-vm",
"wasmparser 0.83.0",
+ "winapi",
]
[[package]]
@@ -2935,7 +2933,6 @@ dependencies = [
"wasmer-compiler",
"wasmer-compiler-cranelift",
"wasmer-compiler-singlepass",
- "wasmer-engine-universal-artifact",
"wasmer-types",
]
@@ -2972,7 +2969,7 @@ dependencies = [
"rayon",
"regex",
"rustc_version 0.4.0",
- "semver 1.0.9",
+ "semver 1.0.10",
"smallvec",
"target-lexicon 0.12.4",
"wasmer-compiler",
@@ -3023,114 +3020,6 @@ dependencies = [
"wasmer",
]
-[[package]]
-name = "wasmer-engine"
-version = "2.3.0"
-dependencies = [
- "backtrace",
- "enumset",
- "lazy_static",
- "memmap2",
- "more-asserts",
- "rustc-demangle",
- "serde",
- "serde_bytes",
- "target-lexicon 0.12.4",
- "thiserror",
- "wasmer-artifact",
- "wasmer-compiler",
- "wasmer-types",
- "wasmer-vm",
-]
-
-[[package]]
-name = "wasmer-engine-dummy"
-version = "2.3.0"
-dependencies = [
- "bincode",
- "enumset",
- "serde",
- "serde_bytes",
- "wasmer-artifact",
- "wasmer-compiler",
- "wasmer-engine",
- "wasmer-types",
- "wasmer-vm",
-]
-
-[[package]]
-name = "wasmer-engine-dylib"
-version = "2.3.0"
-dependencies = [
- "cfg-if 1.0.0",
- "enum-iterator",
- "enumset",
- "leb128",
- "libloading",
- "object",
- "rkyv",
- "serde",
- "tempfile",
- "tracing",
- "wasmer-artifact",
- "wasmer-compiler",
- "wasmer-engine",
- "wasmer-object",
- "wasmer-types",
- "wasmer-vm",
- "which 4.2.5",
-]
-
-[[package]]
-name = "wasmer-engine-staticlib"
-version = "2.3.0"
-dependencies = [
- "bincode",
- "cfg-if 1.0.0",
- "enumset",
- "leb128",
- "libloading",
- "serde",
- "tempfile",
- "tracing",
- "wasmer-artifact",
- "wasmer-compiler",
- "wasmer-engine",
- "wasmer-object",
- "wasmer-types",
- "wasmer-vm",
-]
-
-[[package]]
-name = "wasmer-engine-universal"
-version = "2.3.0"
-dependencies = [
- "cfg-if 1.0.0",
- "enumset",
- "leb128",
- "region",
- "rkyv",
- "wasmer-compiler",
- "wasmer-engine",
- "wasmer-engine-universal-artifact",
- "wasmer-types",
- "wasmer-vm",
- "winapi",
-]
-
-[[package]]
-name = "wasmer-engine-universal-artifact"
-version = "2.3.0"
-dependencies = [
- "enum-iterator",
- "enumset",
- "rkyv",
- "thiserror",
- "wasmer-artifact",
- "wasmer-compiler",
- "wasmer-types",
-]
-
[[package]]
name = "wasmer-integration-tests-cli"
version = "2.3.0"
@@ -3171,6 +3060,7 @@ dependencies = [
"more-asserts",
"rkyv",
"serde",
+ "serde_bytes",
"thiserror",
]
@@ -3219,7 +3109,6 @@ dependencies = [
"scopeguard",
"serde",
"thiserror",
- "wasmer-artifact",
"wasmer-types",
"winapi",
]
@@ -3340,11 +3229,6 @@ dependencies = [
"wasmer-compiler-llvm",
"wasmer-compiler-singlepass",
"wasmer-emscripten",
- "wasmer-engine",
- "wasmer-engine-dummy",
- "wasmer-engine-dylib",
- "wasmer-engine-staticlib",
- "wasmer-engine-universal",
"wasmer-middlewares",
"wasmer-types",
"wasmer-wasi",
@@ -3359,21 +3243,21 @@ checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a"
[[package]]
name = "wasmparser"
-version = "0.85.0"
+version = "0.86.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "570460c58b21e9150d2df0eaaedbb7816c34bcec009ae0dcc976e40ba81463e7"
+checksum = "4bcbfe95447da2aa7ff171857fc8427513eb57c75a729bb190e974dc695e8f5c"
dependencies = [
"indexmap",
]
[[package]]
name = "wasmprinter"
-version = "0.2.35"
+version = "0.2.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea454634a2a7888d053f7723a26a76024e4f705cf86f7b4d38d5f15b79369c31"
+checksum = "aa4cca415278da771add7c9ab7f3391f04b8d98719d2cf28a185d38d5206697e"
dependencies = [
"anyhow",
- "wasmparser 0.85.0",
+ "wasmparser 0.86.0",
]
[[package]]
@@ -3396,22 +3280,23 @@ dependencies = [
[[package]]
name = "wast"
-version = "41.0.0"
+version = "42.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f882898b8b817cc4edc16aa3692fdc087b356edc8cc0c2164f5b5181e31c3870"
+checksum = "badcb03f976f983ff0daf294da9697be659442f61e6b0942bb37a2b6cbfe9dd4"
dependencies = [
"leb128",
"memchr",
"unicode-width",
+ "wasm-encoder 0.13.0",
]
[[package]]
name = "wat"
-version = "1.0.43"
+version = "1.0.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48b3b9b3e39e66c7fd3f8be785e74444d216260f491e93369e317ed6482ff80f"
+checksum = "b92f20b742ac527066c8414bc0637352661b68cab07ef42586cefaba71c965cf"
dependencies = [
- "wast 41.0.0",
+ "wast 42.0.0",
]
[[package]]
@@ -3503,17 +3388,6 @@ dependencies = [
"libc",
]
-[[package]]
-name = "which"
-version = "4.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae"
-dependencies = [
- "either",
- "lazy_static",
- "libc",
-]
-
[[package]]
name = "winapi"
version = "0.3.9"
diff --git a/Cargo.toml b/Cargo.toml
index d086b027bb7..d3564e1d60f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,15 +11,11 @@ autoexamples = false
[dependencies]
wasmer = { version = "=2.3.0", path = "lib/api", default-features = false }
-wasmer-compiler = { version = "=2.3.0", path = "lib/compiler" }
+wasmer-compiler = { version = "=2.3.0", path = "lib/compiler", features = ["universal_engine"] }
wasmer-compiler-cranelift = { version = "=2.3.0", path = "lib/compiler-cranelift", optional = true }
wasmer-compiler-singlepass = { version = "=2.3.0", path = "lib/compiler-singlepass", optional = true }
wasmer-compiler-llvm = { version = "=2.3.0", path = "lib/compiler-llvm", optional = true }
wasmer-emscripten = { version = "=2.3.0", path = "lib/emscripten", optional = true }
-wasmer-engine = { version = "=2.3.0", path = "lib/engine" }
-wasmer-engine-universal = { version = "=2.3.0", path = "lib/engine-universal", optional = true }
-wasmer-engine-dylib = { version = "=2.3.0", path = "lib/engine-dylib", optional = true }
-wasmer-engine-staticlib = { version = "=2.3.0", path = "lib/engine-staticlib", optional = true }
wasmer-wasi = { version = "=2.3.0", path = "lib/wasi", optional = true }
wasmer-wast = { version = "=2.3.0", path = "tests/lib/wast", optional = true }
wasi-test-generator = { version = "=2.3.0", path = "tests/wasi-wast", optional = true }
@@ -41,10 +37,6 @@ members = [
"lib/compiler-llvm",
"lib/derive",
"lib/emscripten",
- "lib/engine",
- "lib/engine-universal",
- "lib/engine-dylib",
- "lib/engine-staticlib",
"lib/object",
"lib/vfs",
"lib/vnet",
@@ -76,7 +68,6 @@ anyhow = "1.0"
criterion = "0.3"
lazy_static = "1.4"
serial_test = "0.5"
-wasmer-engine-dummy = { path = "tests/lib/engine-dummy" }
compiler-test-derive = { path = "tests/lib/compiler-test-derive" }
tempfile = "3.1"
# For logging tests using the `RUST_LOG=debug` when testing
@@ -90,27 +81,14 @@ tracing-subscriber = { version = "0.3", default-features = false, features = ["e
default = [
"wat",
"wast",
- "universal",
- "dylib",
- "staticlib",
"cache",
"wasi",
+ "engine",
"emscripten",
"middlewares",
]
-engine = []
-universal = [
- "wasmer-engine-universal",
- "engine",
-]
-dylib = [
- "wasmer-engine-dylib",
- "engine",
-]
-staticlib = [
- "wasmer-engine-staticlib",
- "engine",
-]
+engine = ["universal"]
+universal = []
cache = ["wasmer-cache"]
wast = ["wasmer-wast"]
wasi = ["wasmer-wasi"]
@@ -119,9 +97,6 @@ wat = ["wasmer/wat"]
compiler = [
"wasmer/compiler",
"wasmer-compiler/translator",
- "wasmer-engine-universal/compiler",
- "wasmer-engine-dylib/compiler",
- "wasmer-engine-staticlib/compiler",
]
singlepass = [
"wasmer-compiler-singlepass",
@@ -148,12 +123,7 @@ test-llvm = [
"llvm",
]
-test-dylib = [
- "dylib",
- "test-generator/test-dylib",
-]
test-universal = [
- "universal",
"test-generator/test-universal",
]
@@ -178,11 +148,6 @@ name = "engine-universal"
path = "examples/engine_universal.rs"
required-features = ["cranelift"]
-[[example]]
-name = "engine-dylib"
-path = "examples/engine_dylib.rs"
-required-features = ["cranelift"]
-
[[example]]
name = "engine-headless"
path = "examples/engine_headless.rs"
diff --git a/Makefile b/Makefile
index 4642989bf07..d7678a313f5 100644
--- a/Makefile
+++ b/Makefile
@@ -13,29 +13,20 @@ SHELL=/usr/bin/env bash
# | Compiler ⨯ Engine ⨯ Platform ⨯ Architecture ⨯ libc |
# |------------|-----------|----------|--------------|-------|
# | Cranelift | Universal | Linux | amd64 | glibc |
-# | LLVM | Dylib | Darwin | aarch64 | musl |
-# | Singlepass | Staticlib | Windows | | |
+# | LLVM | | Darwin | aarch64 | musl |
+# | Singlepass | | Windows | | |
# |------------|-----------|----------|--------------|-------|
#
# Here is what works and what doesn't:
#
# * Cranelift with the Universal engine works everywhere,
#
-# * Cranelift with the Dylib engine works on Linux+Darwin/`amd64`, but
-# it doesn't work on */`aarch64` or Windows/*.
-#
# * LLVM with the Universal engine works on Linux+Darwin/`amd64`,
# but it doesn't work on */`aarch64` or Windows/*.
#
-# * LLVM with the Dylib engine works on
-# Linux+Darwin/`amd64`+`aarch64`, but it doesn't work on Windows/*.
-#
# * Singlepass with the Universal engine works on Linux+Darwin/`amd64`, but
# it doesn't work on */`aarch64` or Windows/*.
#
-# * Singlepass with the Dylib engine doesn't work because it doesn't
-# know how to output object files for the moment.
-#
# * Windows isn't tested on `aarch64`, that's why we consider it's not
# working, but it might possibly be.
@@ -217,18 +208,6 @@ compilers_engines :=
ifeq ($(ENABLE_CRANELIFT), 1)
compilers_engines += cranelift-universal
-
- ifneq (, $(filter 1, $(IS_WINDOWS) $(IS_DARWIN) $(IS_LINUX)))
- ifeq ($(IS_AMD64), 1)
- ifneq ($(LIBC), musl)
- compilers_engines += cranelift-dylib
- endif
- else ifeq ($(IS_AARCH64), 1)
- ifneq ($(LIBC), musl)
- compilers_engines += cranelift-dylib
- endif
- endif
- endif
endif
##
@@ -239,10 +218,8 @@ ifeq ($(ENABLE_LLVM), 1)
ifneq (, $(filter 1, $(IS_WINDOWS) $(IS_DARWIN) $(IS_LINUX)))
ifeq ($(IS_AMD64), 1)
compilers_engines += llvm-universal
- compilers_engines += llvm-dylib
else ifeq ($(IS_AARCH64), 1)
compilers_engines += llvm-universal
- compilers_engines += llvm-dylib
endif
endif
endif
@@ -284,7 +261,7 @@ capi_compilers_engines_exclude :=
# LLVM for the moment because it causes the linker to fail since LLVM is not statically linked.
# TODO: Reenable LLVM in C-API
capi_compiler_features := --features $(subst $(space),$(comma),$(filter-out llvm, $(compilers)))
-capi_compilers_engines_exclude += llvm-universal llvm-dylib
+capi_compilers_engines_exclude += llvm-universal
# We exclude singlepass-universal because it doesn't support multivalue (required in wasm-c-api tests)
capi_compilers_engines_exclude += singlepass-universal
@@ -382,7 +359,7 @@ check-wasmer-wasm:
check-capi: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) check $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml \
- --no-default-features --features wat,universal,dylib,staticlib,wasi,middlewares $(capi_compiler_features)
+ --no-default-features --features wat,universal,wasi,middlewares $(capi_compiler_features)
build-wasmer:
$(CARGO_BINARY) build $(CARGO_TARGET) --release --manifest-path lib/cli/Cargo.toml $(compiler_features) --bin wasmer
@@ -444,82 +421,50 @@ build-docs-capi: capi-setup
# when generating the documentation, we rename it to its
# crate's name. Then we restore the lib's name.
sed "$(SEDI)" -e 's/name = "wasmer" # ##lib.name##/name = "wasmer_c_api" # ##lib.name##/' lib/c-api/Cargo.toml
- RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) doc $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,universal,staticlib,dylib,cranelift,wasi
+ RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) doc $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,universal,cranelift,wasi
sed "$(SEDI)" -e 's/name = "wasmer_c_api" # ##lib.name##/name = "wasmer" # ##lib.name##/' lib/c-api/Cargo.toml
build-capi: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features wat,universal,dylib,staticlib,wasi,middlewares $(capi_compiler_features)
+ --no-default-features --features wat,universal,wasi,middlewares $(capi_compiler_features)
build-capi-singlepass: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features wat,universal,dylib,staticlib,singlepass,wasi,middlewares
+ --no-default-features --features wat,universal,singlepass,wasi,middlewares
build-capi-singlepass-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features wat,universal,singlepass,wasi,middlewares
-build-capi-singlepass-dylib: capi-setup
- RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features wat,dylib,singlepass,wasi,middlewares
-
-build-capi-singlepass-staticlib: capi-setup
- RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features wat,staticlib,singlepass,wasi,middlewares
-
build-capi-cranelift: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features wat,universal,dylib,staticlib,cranelift,wasi,middlewares
+ --no-default-features --features wat,universal,cranelift,wasi,middlewares
build-capi-cranelift-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features wat,universal,cranelift,wasi,middlewares
-build-capi-cranelift-dylib: capi-setup
- RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features wat,dylib,cranelift,wasi,middlewares
-
-build-capi-cranelift-staticlib: capi-setup
- RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features wat,dylib,staticlib,cranelift,wasi,middlewares
-
build-capi-llvm: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features wat,universal,dylib,staticlib,llvm,wasi,middlewares
+ --no-default-features --features wat,universal,llvm,wasi,middlewares
build-capi-llvm-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features wat,universal,llvm,wasi,middlewares
-build-capi-llvm-dylib: capi-setup
- RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features wat,dylib,llvm,wasi,middlewares
-
-build-capi-llvm-staticlib: capi-setup
- RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features wat,staticlib,llvm,wasi,middlewares
-
# Headless (we include the minimal to be able to run)
build-capi-headless-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features universal,wasi
-build-capi-headless-dylib: capi-setup
- RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features dylib,wasi
-
-build-capi-headless-staticlib: capi-setup
- RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features staticlib,wasi
-
build-capi-headless-all: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features universal,dylib,staticlib,wasi
+ --no-default-features --features universal,wasi
build-capi-headless-ios: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo lipo --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features dylib,wasi
+ --no-default-features --features wasi
#####
#
@@ -554,21 +499,12 @@ test-js-wasi:
test-compilers-compat: $(foreach compiler,$(compilers),test-$(compiler))
-test-singlepass-dylib:
- $(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) -- singlepass::dylib
-
test-singlepass-universal:
$(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) -- singlepass::universal
-test-cranelift-dylib:
- $(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) -- cranelift::dylib
-
test-cranelift-universal:
$(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) -- cranelift::universal
-test-llvm-dylib:
- $(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) -- llvm::dylib
-
test-llvm-universal:
$(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) -- llvm::universal
@@ -584,7 +520,7 @@ test-capi: build-capi package-capi $(foreach compiler_engine,$(capi_compilers_en
test-capi-crate-%:
WASMER_CAPI_CONFIG=$(shell echo $@ | sed -e s/test-capi-crate-//) $(CARGO_BINARY) test $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
- --no-default-features --features wat,universal,dylib,staticlib,wasi,middlewares $(capi_compiler_features) -- --nocapture
+ --no-default-features --features wat,universal,wasi,middlewares $(capi_compiler_features) -- --nocapture
test-capi-integration-%:
# Test the Wasmer C API tests for C
@@ -710,7 +646,7 @@ endif
DESTDIR ?= /usr/local
-install: install-wasmer install-capi-headers install-capi-lib install-capi-staticlib install-pkgconfig install-misc
+install: install-wasmer install-capi-headers install-capi-lib install-pkgconfig install-misc
install-wasmer:
install -Dm755 target/release/wasmer $(DESTDIR)/bin/wasmer
@@ -729,9 +665,6 @@ install-capi-lib:
ln -sf "libwasmer.so.$$pkgver" "$(DESTDIR)/lib/libwasmer.so.$$majorver" && \
ln -sf "libwasmer.so.$$pkgver" "$(DESTDIR)/lib/libwasmer.so"
-install-capi-staticlib:
- install -Dm644 target/release/libwasmer.a "$(DESTDIR)/lib/libwasmer.a"
-
install-misc:
install -Dm644 LICENSE "$(DESTDIR)"/share/licenses/wasmer/LICENSE
diff --git a/benches/static_and_dynamic_functions.rs b/benches/static_and_dynamic_functions.rs
index f798d9a3e57..bc61ab3c4e8 100644
--- a/benches/static_and_dynamic_functions.rs
+++ b/benches/static_and_dynamic_functions.rs
@@ -149,21 +149,24 @@ pub fn run_basic_dynamic_function(store: &Store, compiler_name: &str, c: &mut Cr
fn run_static_benchmarks(_c: &mut Criterion) {
#[cfg(feature = "llvm")]
{
- let store = Store::new(&Universal::new(wasmer_compiler_llvm::LLVM::new()).engine());
+ let store =
+ Store::new_with_engine(&Universal::new(wasmer_compiler_llvm::LLVM::new()).engine());
run_basic_static_function(&store, "llvm", c);
}
#[cfg(feature = "cranelift")]
{
- let store =
- Store::new(&Universal::new(wasmer_compiler_cranelift::Cranelift::new()).engine());
+ let store = Store::new_with_engine(
+ &Universal::new(wasmer_compiler_cranelift::Cranelift::new()).engine(),
+ );
run_basic_static_function(&store, "cranelift", c);
}
#[cfg(feature = "singlepass")]
{
- let store =
- Store::new(&Universal::new(wasmer_compiler_singlepass::Singlepass::new()).engine());
+ let store = Store::new_with_engine(
+ &Universal::new(wasmer_compiler_singlepass::Singlepass::new()).engine(),
+ );
run_basic_static_function(&store, "singlepass", c);
}
}
@@ -171,21 +174,24 @@ fn run_static_benchmarks(_c: &mut Criterion) {
fn run_dynamic_benchmarks(_c: &mut Criterion) {
#[cfg(feature = "llvm")]
{
- let store = Store::new(&Universal::new(wasmer_compiler_llvm::LLVM::new()).engine());
+ let store =
+ Store::new_with_engine(&Universal::new(wasmer_compiler_llvm::LLVM::new()).engine());
run_basic_dynamic_function(&store, "llvm", c);
}
#[cfg(feature = "cranelift")]
{
- let store =
- Store::new(&Universal::new(wasmer_compiler_cranelift::Cranelift::new()).engine());
+ let store = Store::new_with_engine(
+ &Universal::new(wasmer_compiler_cranelift::Cranelift::new()).engine(),
+ );
run_basic_dynamic_function(&store, "cranelift", c);
}
#[cfg(feature = "singlepass")]
{
- let store =
- Store::new(&Universal::new(wasmer_compiler_singlepass::Singlepass::new()).engine());
+ let store = Store::new_with_engine(
+ &Universal::new(wasmer_compiler_singlepass::Singlepass::new()).engine(),
+ );
run_basic_dynamic_function(&store, "singlepass", c);
}
}
diff --git a/docs/deps_dedup.dot b/docs/deps_dedup.dot
index a9231d309fd..d86c4ef4bd2 100644
--- a/docs/deps_dedup.dot
+++ b/docs/deps_dedup.dot
@@ -5,7 +5,6 @@ digraph dependencies {
n1 [label="wasmer-compiler", color=orange];
n5 [label="wasmer-engine", color=orange];
n6 [label="wasmer-engine-universal", color=orange];
- n7 [label="wasmer-engine-dylib", color=orange];
n8 [label="wasmer-types", color=orange];
n9 [label="wasmer-vm", color=orange];
n10 [label="wasmer-c-api", color=orange];
@@ -29,7 +28,6 @@ digraph dependencies {
color=brown;
n6 [label="wasmer-engine-universal", color=orange];
- n7 [label="wasmer-engine-dylib", color=orange];
}
{
diff --git a/docs/deps_dedup.svg b/docs/deps_dedup.svg
index 1280e3d0faf..e05f2b17e12 100644
--- a/docs/deps_dedup.svg
+++ b/docs/deps_dedup.svg
@@ -42,18 +42,6 @@
-
-
-n7
-
-wasmer-engine-dylib
-
-
-
-n0->n7
-
-
-
n2
diff --git a/docs/migration_to_3.0.0.md b/docs/migration_to_3.0.0.md
index 481a123e068..310c214dc11 100644
--- a/docs/migration_to_3.0.0.md
+++ b/docs/migration_to_3.0.0.md
@@ -12,12 +12,14 @@ and provide examples to make migrating to the new API as simple as possible.
- [Project structure](#project-structure)
- [Differences](#differences)
- [Managing imports](#managing-imports)
+ - [Engines](#engines)
## Rationale for changes in 3.0.0
This version introduces the following changes to make the Wasmer API more ergonomic and safe:
1. `ImportsObject` and the traits `Resolver`, `NamedResolver`, etc have been removed and replaced with a single simple type `Imports`. This reduces the complexity of setting up an `Instance`. The helper macro `imports!` can still be used.
+2. The `Engine`s API has been simplified, Instead of the `wasmer` user choosing and setting up an engine explicitly, everything now uses the universal engine. All functionalites of the `staticlib`,`dylib` Engines should be available unless explicitly stated as unsupported.
## How to use Wasmer 3.0.0
@@ -76,11 +78,44 @@ imports2.extend(&imports);
// }
```
+### Engines
+
+#### Before
+
+In Wasmer 2.0, you had to explicitly define the Engine you want to use:
+
+```rust
+let wasm_bytes = wat2wasm(
+ "..".as_bytes(),
+)?;
+
+let compiler_config = Cranelift::default();
+let engine = Universal::new(compiler_config).engine();
+let store = Store::new(&engine);
+let module = Module::new(&store, wasm_bytes)?;
+let instance = Instance::new(&module, &imports! {})?;
+```
+
+#### After
+
+In Wasmer 3.0, there's only the universal engine. The user can ignore the engine details when using the API:
+
+
+```rust
+let wasm_bytes = wat2wasm(
+ "..".as_bytes(),
+)?;
+
+let compiler_config = Cranelift::default();
+let store = Store::new(&compiler_config);
+let module = Module::new(&store, wasm_bytes)?;
+let instance = Instance::new(&module, &imports! {})?;
+```
+
[examples]: https://docs.wasmer.io/integrations/examples
[wasmer]: https://crates.io/crates/wasmer
[wasmer-wasi]: https://crates.io/crates/wasmer-wasi
[wasmer-emscripten]: https://crates.io/crates/wasmer-emscripten
-[wasmer-engine]: https://crates.io/crates/wasmer-engine
[wasmer-compiler]: https://crates.io/crates/wasmer-compiler
[wasmer.io]: https://wasmer.io
[wasmer-nightly]: https://github.com/wasmerio/wasmer-nightly/
diff --git a/examples/README.md b/examples/README.md
index 738a10a0a3e..83d9cedcaf4 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -236,24 +236,7 @@ example.
-2. [**Dylib engine**][engine-dylib], explains what a Dylib engine
- is, and how to set it up. The example completes itself with the
- compilation of the Wasm module, its instantiation, and finally, by
- calling an exported function.
-
- _Keywords_: native, engine, shared library, dynamic library,
- executable code.
-
-
- Execute the example
-
- ```shell
- $ cargo run --example engine-dylib --release --features "cranelift"
- ```
-
-
-
-3. [**Headless engines**][engine-headless], explains what a headless
+2. [**Headless engines**][engine-headless], explains what a headless
engine is, what problem it does solve, and what are the benefits of
it. The example completes itself with the instantiation of a
pre-compiled Wasm module, and finally, by calling an exported
@@ -376,7 +359,6 @@ example.
[hello-world]: ./hello_world.rs
[engine-universal]: ./engine_universal.rs
-[engine-dylib]: ./engine_dylib.rs
[engine-headless]: ./engine_headless.rs
[compiler-singlepass]: ./compiler_singlepass.rs
[compiler-cranelift]: ./compiler_cranelift.rs
diff --git a/examples/compiler_cranelift.rs b/examples/compiler_cranelift.rs
index 2d7e446c8e4..f19b7ce8191 100644
--- a/examples/compiler_cranelift.rs
+++ b/examples/compiler_cranelift.rs
@@ -11,8 +11,8 @@
//! Ready?
use wasmer::{imports, wat2wasm, Instance, Module, Store, Value};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
fn main() -> Result<(), Box> {
// Let's declare the Wasm module with the text representation.
@@ -33,7 +33,7 @@ fn main() -> Result<(), Box> {
let compiler = Cranelift::default();
// Create the store
- let store = Store::new(&Universal::new(compiler).engine());
+ let store = Store::new_with_engine(&Universal::new(compiler).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/compiler_llvm.rs b/examples/compiler_llvm.rs
index f062a1c0bc6..c62a1102064 100644
--- a/examples/compiler_llvm.rs
+++ b/examples/compiler_llvm.rs
@@ -11,8 +11,8 @@
//! Ready?
use wasmer::{imports, wat2wasm, Instance, Module, Store, Value};
+use wasmer_compiler::Universal;
use wasmer_compiler_llvm::LLVM;
-use wasmer_engine_universal::Universal;
fn main() -> Result<(), Box> {
// Let's declare the Wasm module with the text representation.
@@ -33,7 +33,7 @@ fn main() -> Result<(), Box> {
let compiler = LLVM::default();
// Create the store
- let store = Store::new(&Universal::new(compiler).engine());
+ let store = Store::new_with_engine(&Universal::new(compiler).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/compiler_singlepass.rs b/examples/compiler_singlepass.rs
index 845b9db302c..39d12551c0d 100644
--- a/examples/compiler_singlepass.rs
+++ b/examples/compiler_singlepass.rs
@@ -11,8 +11,8 @@
//! Ready?
use wasmer::{imports, wat2wasm, Instance, Module, Store, Value};
+use wasmer_compiler::Universal;
use wasmer_compiler_singlepass::Singlepass;
-use wasmer_engine_universal::Universal;
fn main() -> Result<(), Box> {
// Let's declare the Wasm module with the text representation.
@@ -33,7 +33,7 @@ fn main() -> Result<(), Box> {
let compiler = Singlepass::default();
// Create the store
- let store = Store::new(&Universal::new(compiler).engine());
+ let store = Store::new_with_engine(&Universal::new(compiler).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/early_exit.rs b/examples/early_exit.rs
index 40ed664d7fd..63fbd2a0a8b 100644
--- a/examples/early_exit.rs
+++ b/examples/early_exit.rs
@@ -17,8 +17,8 @@
use anyhow::bail;
use std::fmt;
use wasmer::{imports, wat2wasm, Function, Instance, Module, Store, TypedFunction};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
// First we need to create an error type that we'll use to signal the end of execution.
#[derive(Debug, Clone, Copy)]
@@ -55,7 +55,7 @@ fn main() -> anyhow::Result<()> {
// Note that we don't need to specify the engine/compiler if we want to use
// the default provided by Wasmer.
// You can use `Store::default()` for that.
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/engine_cross_compilation.rs b/examples/engine_cross_compilation.rs
index 618d24d68ff..467cb3facd5 100644
--- a/examples/engine_cross_compilation.rs
+++ b/examples/engine_cross_compilation.rs
@@ -20,9 +20,9 @@
use std::str::FromStr;
use wasmer::{wat2wasm, Module, RuntimeError, Store};
+use wasmer_compiler::Universal;
use wasmer_compiler::{CpuFeature, Target, Triple};
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_dylib::Dylib;
fn main() -> Result<(), Box> {
// Let's declare the Wasm module with the text representation.
@@ -67,13 +67,10 @@ fn main() -> Result<(), Box> {
// Define the engine that will drive everything.
//
- // In this case, the engine is `wasmer_engine_dylib` which means
- // that a shared object is going to be generated.
- //
// That's where we specify the target for the compiler.
//
- // Use the Dylib engine.
- let engine = Dylib::new(compiler_config)
+ // Use the Universal engine.
+ let engine = Universal::new(compiler_config)
// Here we go.
// Pass the target to the engine! The engine will share
// this information with the compiler.
@@ -82,7 +79,7 @@ fn main() -> Result<(), Box> {
.engine();
// Create a store, that holds the engine.
- let store = Store::new(&engine);
+ let store = Store::new_with_engine(&engine);
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/engine_dylib.rs b/examples/engine_dylib.rs
index 4381ea08723..53be3ee62f2 100644
--- a/examples/engine_dylib.rs
+++ b/examples/engine_dylib.rs
@@ -20,67 +20,71 @@
use wasmer::{imports, wat2wasm, Instance, Module, Store, Value};
use wasmer_compiler_cranelift::Cranelift;
+/*
use wasmer_engine_dylib::Dylib;
+*/
fn main() -> Result<(), Box> {
- // Let's declare the Wasm module with the text representation.
- let wasm_bytes = wat2wasm(
- r#"
-(module
- (type $sum_t (func (param i32 i32) (result i32)))
- (func $sum_f (type $sum_t) (param $x i32) (param $y i32) (result i32)
- local.get $x
- local.get $y
- i32.add)
- (export "sum" (func $sum_f)))
-"#
- .as_bytes(),
- )?;
+ /*
+ // Let's declare the Wasm module with the text representation.
+ let wasm_bytes = wat2wasm(
+ r#"
+ (module
+ (type $sum_t (func (param i32 i32) (result i32)))
+ (func $sum_f (type $sum_t) (param $x i32) (param $y i32) (result i32)
+ local.get $x
+ local.get $y
+ i32.add)
+ (export "sum" (func $sum_f)))
+ "#
+ .as_bytes(),
+ )?;
- // Define a compiler configuration.
- //
- // In this situation, the compiler is
- // `wasmer_compiler_cranelift`. The compiler is responsible to
- // compile the Wasm module into executable code.
- let compiler_config = Cranelift::default();
+ // Define a compiler configuration.
+ //
+ // In this situation, the compiler is
+ // `wasmer_compiler_cranelift`. The compiler is responsible to
+ // compile the Wasm module into executable code.
+ let compiler_config = Cranelift::default();
- println!("Creating Dylib engine...");
- // Define the engine that will drive everything.
- //
- // In this case, the engine is `wasmer_engine_dylib` which means
- // that a shared object is going to be generated.
- let engine = Dylib::new(compiler_config).engine();
+ println!("Creating Dylib engine...");
+ // Define the engine that will drive everything.
+ //
+ // In this case, the engine is `wasmer_engine_dylib` which means
+ // that a shared object is going to be generated.
+ let engine = Dylib::new(compiler_config).engine();
- // Create a store, that holds the engine.
- let store = Store::new(&engine);
+ // Create a store, that holds the engine.
+ let store = Store::new_with_engine(&engine);
- println!("Compiling module...");
- // Here we go.
- //
- // Let's compile the Wasm module. It is at this step that the Wasm
- // text is transformed into Wasm bytes (if necessary), and then
- // compiled to executable code by the compiler, which is then
- // stored into a shared object by the engine.
- let module = Module::new(&store, wasm_bytes)?;
+ println!("Compiling module...");
+ // Here we go.
+ //
+ // Let's compile the Wasm module. It is at this step that the Wasm
+ // text is transformed into Wasm bytes (if necessary), and then
+ // compiled to executable code by the compiler, which is then
+ // stored into a shared object by the engine.
+ let module = Module::new(&store, wasm_bytes)?;
- // Congrats, the Wasm module is compiled! Now let's execute it for
- // the sake of having a complete example.
+ // Congrats, the Wasm module is compiled! Now let's execute it for
+ // the sake of having a complete example.
- // Create an import object. Since our Wasm module didn't declare
- // any imports, it's an empty object.
- let import_object = imports! {};
+ // Create an import object. Since our Wasm module didn't declare
+ // any imports, it's an empty object.
+ let import_object = imports! {};
- println!("Instantiating module...");
- // And here we go again. Let's instantiate the Wasm module.
- let instance = Instance::new(&module, &import_object)?;
+ println!("Instantiating module...");
+ // And here we go again. Let's instantiate the Wasm module.
+ let instance = Instance::new(&module, &import_object)?;
- println!("Calling `sum` function...");
- // The Wasm module exports a function called `sum`.
- let sum = instance.exports.get_function("sum")?;
- let results = sum.call(&[Value::I32(1), Value::I32(2)])?;
+ println!("Calling `sum` function...");
+ // The Wasm module exports a function called `sum`.
+ let sum = instance.exports.get_function("sum")?;
+ let results = sum.call(&[Value::I32(1), Value::I32(2)])?;
- println!("Results: {:?}", results);
- assert_eq!(results.to_vec(), vec![Value::I32(3)]);
+ println!("Results: {:?}", results);
+ assert_eq!(results.to_vec(), vec![Value::I32(3)]);
+ */
Ok(())
}
diff --git a/examples/engine_headless.rs b/examples/engine_headless.rs
index 41f8b3fcded..3c0af060e68 100644
--- a/examples/engine_headless.rs
+++ b/examples/engine_headless.rs
@@ -8,10 +8,9 @@
//! What problem does it solve, and what does it mean?
//!
//! Once a Wasm module is compiled into executable code and stored
-//! somewhere (e.g. in memory with the Universal engine, or in a
-//! shared object file with the Dylib engine), the module can be
-//! instantiated and executed. But imagine for a second the following
-//! scenario:
+//! somewhere (e.g. in memory with the Universal engine), the module
+//! can be instantiated and executed. But imagine for a second the
+//! following scenario:
//!
//! * Modules are compiled ahead of time, to be instantiated later
//! on.
@@ -52,8 +51,8 @@ use wasmer::Instance;
use wasmer::Module;
use wasmer::Store;
use wasmer::Value;
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_dylib::Dylib;
fn main() -> Result<(), Box> {
// First step, let's compile the Wasm module and serialize it.
@@ -80,19 +79,12 @@ fn main() -> Result<(), Box> {
// compile the Wasm module into executable code.
let compiler_config = Cranelift::default();
- println!("Creating Dylib engine...");
+ println!("Creating univesral engine...");
// Define the engine that will drive everything.
- //
- // In this case, the engine is `wasmer_engine_dylib` which
- // means that a shared object is going to be generated. So
- // when we are going to serialize the compiled Wasm module, we
- // are going to store it in a file with the `.so` extension
- // for example (or `.dylib`, or `.dll` depending of the
- // platform).
- let engine = Dylib::new(compiler_config).engine();
+ let engine = Universal::new(compiler_config).engine();
// Create a store, that holds the engine.
- let store = Store::new(&engine);
+ let store = Store::new_with_engine(&engine);
println!("Compiling module...");
// Let's compile the Wasm module.
@@ -110,10 +102,10 @@ fn main() -> Result<(), Box> {
// Second step, deserialize the compiled Wasm module, and execute
// it, for example with Wasmer without a compiler.
{
- println!("Creating headless Dylib engine...");
- // We create a headless Dylib engine.
- let engine = Dylib::headless().engine();
- let store = Store::new(&engine);
+ println!("Creating headless Universal engine...");
+ // We create a headless Universal engine.
+ let engine = Universal::headless().engine();
+ let store = Store::new_with_engine(&engine);
println!("Deserializing module...");
// Here we go.
diff --git a/examples/engine_universal.rs b/examples/engine_universal.rs
index 0d51244f9ec..530449c0df2 100644
--- a/examples/engine_universal.rs
+++ b/examples/engine_universal.rs
@@ -1,6 +1,6 @@
//! Defining an engine in Wasmer is one of the fundamental steps.
//!
-//! This example illustrates how to use the `wasmer_engine_universal`,
+//! This example illustrates how to use the `wasmer_compiler`,
//! aka the Universal engine. An engine applies roughly 2 steps:
//!
//! 1. It compiles the Wasm module bytes to executable code, through
@@ -19,8 +19,8 @@
//! Ready?
use wasmer::{imports, wat2wasm, Instance, Module, Store, Value};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
fn main() -> Result<(), Box> {
// Let's declare the Wasm module with the text representation.
@@ -47,12 +47,12 @@ fn main() -> Result<(), Box> {
println!("Creating Universal engine...");
// Define the engine that will drive everything.
//
- // In this case, the engine is `wasmer_engine_universal` which roughly
+ // In this case, the engine is `wasmer_compiler` which roughly
// means that the executable code will live in memory.
let engine = Universal::new(compiler_config).engine();
// Create a store, that holds the engine.
- let store = Store::new(&engine);
+ let store = Store::new_with_engine(&engine);
println!("Compiling module...");
// Here we go.
diff --git a/examples/errors.rs b/examples/errors.rs
index d145fd776e1..a9b2d93ed65 100644
--- a/examples/errors.rs
+++ b/examples/errors.rs
@@ -14,8 +14,8 @@
//! Ready?
use wasmer::{imports, wat2wasm, Instance, Module, Store};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
fn main() -> Result<(), Box> {
// Let's declare the Wasm module with the text representation.
@@ -39,7 +39,7 @@ fn main() -> Result<(), Box> {
// Note that we don't need to specify the engine/compiler if we want to use
// the default provided by Wasmer.
// You can use `Store::default()` for that.
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/exports_function.rs b/examples/exports_function.rs
index f720b804367..bf873061799 100644
--- a/examples/exports_function.rs
+++ b/examples/exports_function.rs
@@ -18,8 +18,8 @@
//! Ready?
use wasmer::{imports, wat2wasm, Instance, Module, Store, Value};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
fn main() -> Result<(), Box> {
// Let's declare the Wasm module with the text representation.
@@ -40,7 +40,7 @@ fn main() -> Result<(), Box> {
// Note that we don't need to specify the engine/compiler if we want to use
// the default provided by Wasmer.
// You can use `Store::default()` for that.
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/exports_global.rs b/examples/exports_global.rs
index 80aad13302a..3aaa1035783 100644
--- a/examples/exports_global.rs
+++ b/examples/exports_global.rs
@@ -16,8 +16,8 @@
//! Ready?
use wasmer::{imports, wat2wasm, Instance, Module, Mutability, Store, Type, Value};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
fn main() -> Result<(), Box> {
// Let's declare the Wasm module with the text representation.
@@ -38,7 +38,7 @@ fn main() -> Result<(), Box> {
// Note that we don't need to specify the engine/compiler if we want to use
// the default provided by Wasmer.
// You can use `Store::default()` for that.
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/exports_memory.rs b/examples/exports_memory.rs
index a3ef6c8f5bd..8103c95ac09 100644
--- a/examples/exports_memory.rs
+++ b/examples/exports_memory.rs
@@ -12,8 +12,8 @@
//! Ready?
use wasmer::{imports, wat2wasm, Instance, Module, Store, WasmPtr};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
fn main() -> Result<(), Box> {
// Let's declare the Wasm module with the text representation.
@@ -37,7 +37,7 @@ fn main() -> Result<(), Box> {
// Note that we don't need to specify the engine/compiler if we want to use
// the default provided by Wasmer.
// You can use `Store::default()` for that.
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/features.rs b/examples/features.rs
index 3812bf8b3d6..f60d24f17d1 100644
--- a/examples/features.rs
+++ b/examples/features.rs
@@ -11,8 +11,8 @@
//! Ready?
use wasmer::{imports, wat2wasm, Features, Instance, Module, Store, Value};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
fn main() -> anyhow::Result<()> {
// Let's declare the Wasm module with the text representation.
@@ -39,7 +39,7 @@ fn main() -> anyhow::Result<()> {
let engine = Universal::new(compiler).features(features);
// Now, let's define the store, and compile the module.
- let store = Store::new(&engine.engine());
+ let store = Store::new_with_engine(&engine.engine());
let module = Module::new(&store, wasm_bytes)?;
// Finally, let's instantiate the module, and execute something
diff --git a/examples/hello_world.rs b/examples/hello_world.rs
index e0cc73e4aeb..dba2fff8be5 100644
--- a/examples/hello_world.rs
+++ b/examples/hello_world.rs
@@ -7,8 +7,8 @@
//! ```
use wasmer::{imports, wat2wasm, Function, Instance, Module, Store, TypedFunction};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
fn main() -> anyhow::Result<()> {
// First we create a simple Wasm program to use with Wasmer.
@@ -44,7 +44,7 @@ fn main() -> anyhow::Result<()> {
// However for the purposes of showing what's happening, we create a compiler
// (`Cranelift`) and pass it to an engine (`Universal`). We then pass the engine to
// the store and are now ready to compile and run WebAssembly!
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
// We then use our store and Wasm bytes to compile a `Module`.
// A `Module` is a compiled WebAssembly module that isn't ready to execute yet.
diff --git a/examples/imports_exports.rs b/examples/imports_exports.rs
index a832ed8b8d3..2cde8af885b 100644
--- a/examples/imports_exports.rs
+++ b/examples/imports_exports.rs
@@ -19,8 +19,8 @@ use wasmer::{
imports, wat2wasm, Function, FunctionType, Global, Instance, Memory, Module, Store, Table,
Type, Value,
};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
fn main() -> Result<(), Box> {
// Let's declare the Wasm module.
@@ -44,7 +44,7 @@ fn main() -> Result<(), Box> {
// Note that we don't need to specify the engine/compiler if we want to use
// the default provided by Wasmer.
// You can use `Store::default()` for that.
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/imports_function.rs b/examples/imports_function.rs
index 767e0bdd57c..919debec005 100644
--- a/examples/imports_function.rs
+++ b/examples/imports_function.rs
@@ -18,8 +18,8 @@
//! Ready?
use wasmer::{imports, wat2wasm, Function, FunctionType, Instance, Module, Store, Type, Value};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
fn main() -> Result<(), Box> {
// Let's declare the Wasm module with the text representation.
@@ -42,7 +42,7 @@ fn main() -> Result<(), Box> {
// Note that we don't need to specify the engine/compiler if we want to use
// the default provided by Wasmer.
// You can use `Store::default()` for that.
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/imports_function_env.rs b/examples/imports_function_env.rs
index 0cb4b8ffec5..b1b534e033f 100644
--- a/examples/imports_function_env.rs
+++ b/examples/imports_function_env.rs
@@ -21,8 +21,8 @@
use std::sync::{Arc, Mutex};
use wasmer::{imports, wat2wasm, Function, Instance, Module, Store, WasmerEnv};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
fn main() -> Result<(), Box> {
// Let's declare the Wasm module with the text representation.
@@ -49,7 +49,7 @@ fn main() -> Result<(), Box> {
// Note that we don't need to specify the engine/compiler if we want to use
// the default provided by Wasmer.
// You can use `Store::default()` for that.
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/imports_global.rs b/examples/imports_global.rs
index 6da88c1d8ce..af91acf83e0 100644
--- a/examples/imports_global.rs
+++ b/examples/imports_global.rs
@@ -16,8 +16,8 @@
//! Ready?
use wasmer::{imports, wat2wasm, Global, Instance, Module, Store, Value};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
fn main() -> Result<(), Box> {
// Let's declare the Wasm module with the text representation.
@@ -38,7 +38,7 @@ fn main() -> Result<(), Box> {
// Note that we don't need to specify the engine/compiler if we want to use
// the default provided by Wasmer.
// You can use `Store::default()` for that.
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/instance.rs b/examples/instance.rs
index 1d0b16f945e..66404032e9b 100644
--- a/examples/instance.rs
+++ b/examples/instance.rs
@@ -15,8 +15,8 @@
//! Ready?
use wasmer::{imports, wat2wasm, Instance, Module, Store};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
fn main() -> Result<(), Box> {
// Let's declare the Wasm module.
@@ -39,7 +39,7 @@ fn main() -> Result<(), Box> {
// Note that we don't need to specify the engine/compiler if we want to use
// the default provided by Wasmer.
// You can use `Store::default()` for that.
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/memory.rs b/examples/memory.rs
index 5598271ed59..b664a6660e6 100644
--- a/examples/memory.rs
+++ b/examples/memory.rs
@@ -16,8 +16,8 @@
use std::mem;
use wasmer::{imports, wat2wasm, Bytes, Instance, Module, Pages, Store, TypedFunction};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
// this example is a work in progress:
// TODO: clean it up and comment it https://github.com/wasmerio/wasmer/issues/1749
@@ -57,7 +57,7 @@ fn main() -> anyhow::Result<()> {
// Note that we don't need to specify the engine/compiler if we want to use
// the default provided by Wasmer.
// You can use `Store::default()` for that.
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/metering.rs b/examples/metering.rs
index 8e715c1f7f1..27d7248409f 100644
--- a/examples/metering.rs
+++ b/examples/metering.rs
@@ -19,8 +19,8 @@ use std::sync::Arc;
use wasmer::wasmparser::Operator;
use wasmer::CompilerConfig;
use wasmer::{imports, wat2wasm, Instance, Module, Store};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
use wasmer_middlewares::{
metering::{get_remaining_points, set_remaining_points, MeteringPoints},
Metering,
@@ -70,7 +70,7 @@ fn main() -> anyhow::Result<()> {
//
// We use our previously create compiler configuration
// with the Universal engine.
- let store = Store::new(&Universal::new(compiler_config).engine());
+ let store = Store::new_with_engine(&Universal::new(compiler_config).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/platform_ios_headless.rs b/examples/platform_ios_headless.rs
index 8a6eb8028c9..c7b67adfdd6 100644
--- a/examples/platform_ios_headless.rs
+++ b/examples/platform_ios_headless.rs
@@ -17,49 +17,53 @@ use std::str::FromStr;
use wasmer::{wat2wasm, Module, RuntimeError, Store};
use wasmer_compiler::{CpuFeature, Target, Triple};
use wasmer_compiler_cranelift::Cranelift;
+/*
use wasmer_engine_dylib::Dylib;
+*/
fn main() -> Result<(), Box> {
- // Let's declare the Wasm module with the text representation.
- let wasm_bytes = wat2wasm(
- r#"
-(module
-(type $sum_t (func (param i32 i32) (result i32)))
-(func $sum_f (type $sum_t) (param $x i32) (param $y i32) (result i32)
-local.get $x
-local.get $y
-i32.add)
-(export "sum" (func $sum_f)))
-"#
- .as_bytes(),
- )?;
+ /*
+ // Let's declare the Wasm module with the text representation.
+ let wasm_bytes = wat2wasm(
+ r#"
+ (module
+ (type $sum_t (func (param i32 i32) (result i32)))
+ (func $sum_f (type $sum_t) (param $x i32) (param $y i32) (result i32)
+ local.get $x
+ local.get $y
+ i32.add)
+ (export "sum" (func $sum_f)))
+ "#
+ .as_bytes(),
+ )?;
- // Create a compiler for iOS
- let compiler_config = Cranelift::default();
- // Change it to `x86_64-apple-ios` if you want to target the iOS simulator
- let triple = Triple::from_str("aarch64-apple-ios")
- .map_err(|error| RuntimeError::new(error.to_string()))?;
+ // Create a compiler for iOS
+ let compiler_config = Cranelift::default();
+ // Change it to `x86_64-apple-ios` if you want to target the iOS simulator
+ let triple = Triple::from_str("aarch64-apple-ios")
+ .map_err(|error| RuntimeError::new(error.to_string()))?;
- // Let's build the target.
- let mut cpu_feature = CpuFeature::set();
- cpu_feature.insert(CpuFeature::from_str("sse2")?);
- let target = Target::new(triple, cpu_feature);
- println!("Chosen target: {:?}", target);
+ // Let's build the target.
+ let mut cpu_feature = CpuFeature::set();
+ cpu_feature.insert(CpuFeature::from_str("sse2")?);
+ let target = Target::new(triple, cpu_feature);
+ println!("Chosen target: {:?}", target);
- println!("Creating Dylib engine...");
- let engine = Dylib::new(compiler_config).target(target).engine();
+ println!("Creating Dylib engine...");
+ let engine = Dylib::new(compiler_config).target(target).engine();
- // Create a store, that holds the engine.
- let store = Store::new(&engine);
+ // Create a store, that holds the engine.
+ let store = Store::new_with_engine(&engine);
- println!("Compiling module...");
- // Let's compile the Wasm module.
- let module = Module::new(&store, wasm_bytes)?;
- // Here we go. Let's serialize the compiled Wasm module in a
- // file.
- println!("Serializing module...");
- let dylib_file = Path::new("./sum.dylib");
- module.serialize_to_file(dylib_file)?;
+ println!("Compiling module...");
+ // Let's compile the Wasm module.
+ let module = Module::new(&store, wasm_bytes)?;
+ // Here we go. Let's serialize the compiled Wasm module in a
+ // file.
+ println!("Serializing module...");
+ let dylib_file = Path::new("./sum.dylib");
+ module.serialize_to_file(dylib_file)?;
+ */
Ok(())
}
diff --git a/examples/table.rs b/examples/table.rs
index c0bf78b4298..edad9957a9a 100644
--- a/examples/table.rs
+++ b/examples/table.rs
@@ -1,8 +1,8 @@
use wasmer::{
imports, wat2wasm, Function, Instance, Module, Store, TableType, Type, TypedFunction, Value,
};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
/// A function we'll call through a table.
fn host_callback(arg1: i32, arg2: i32) -> i32 {
@@ -51,7 +51,7 @@ fn main() -> anyhow::Result<()> {
)?;
// We set up our store with an engine and a compiler.
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
// Then compile our Wasm.
let module = Module::new(&store, wasm_bytes)?;
let import_object = imports! {};
diff --git a/examples/tunables_limit_memory.rs b/examples/tunables_limit_memory.rs
index 28d31450b5f..3e43cd9f7d5 100644
--- a/examples/tunables_limit_memory.rs
+++ b/examples/tunables_limit_memory.rs
@@ -7,8 +7,8 @@ use wasmer::{
wat2wasm, BaseTunables, Instance, Memory, MemoryType, Module, Pages, Store, TableType, Target,
Tunables,
};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
/// A custom tunables that allows you to set a memory limit.
///
diff --git a/examples/wasi.rs b/examples/wasi.rs
index 3d24c5af60b..2b80cf7fc11 100644
--- a/examples/wasi.rs
+++ b/examples/wasi.rs
@@ -16,8 +16,8 @@
//! Ready?
use wasmer::{Instance, Module, Store};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
use wasmer_wasi::WasiState;
fn main() -> Result<(), Box> {
@@ -32,7 +32,7 @@ fn main() -> Result<(), Box> {
// Note that we don't need to specify the engine/compiler if we want to use
// the default provided by Wasmer.
// You can use `Store::default()` for that.
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/examples/wasi_pipes.rs b/examples/wasi_pipes.rs
index fa4cad6973b..c4efec10a84 100644
--- a/examples/wasi_pipes.rs
+++ b/examples/wasi_pipes.rs
@@ -13,8 +13,8 @@
use std::io::{Read, Write};
use wasmer::{Instance, Module, Store};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_universal::Universal;
use wasmer_wasi::{Pipe, WasiState};
fn main() -> Result<(), Box> {
@@ -29,7 +29,7 @@ fn main() -> Result<(), Box> {
// Note that we don't need to specify the engine/compiler if we want to use
// the default provided by Wasmer.
// You can use `Store::default()` for that.
- let store = Store::new(&Universal::new(Cranelift::default()).engine());
+ let store = Store::new_with_engine(&Universal::new(Cranelift::default()).engine());
println!("Compiling module...");
// Let's compile the Wasm module.
diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml
index e28680e2a09..7b2ce822057 100644
--- a/fuzz/Cargo.toml
+++ b/fuzz/Cargo.toml
@@ -16,8 +16,7 @@ wasmer = { path = "../lib/api" }
wasmer-compiler-cranelift = { path = "../lib/compiler-cranelift", optional = true }
wasmer-compiler-llvm = { path = "../lib/compiler-llvm", optional = true }
wasmer-compiler-singlepass = { path = "../lib/compiler-singlepass", optional = true }
-wasmer-engine-universal = { path = "../lib/engine-universal", optional = true }
-wasmer-engine-dylib = { path = "../lib/engine-dylib", optional = true }
+wasmer-compiler = { path = "../lib/compiler", optional = true }
wasmer-middlewares = { path = "../lib/middlewares" }
wasmprinter = "0.2"
@@ -25,8 +24,7 @@ wasmprinter = "0.2"
cranelift = [ "wasmer-compiler-cranelift" ]
llvm = [ "wasmer-compiler-llvm" ]
singlepass = [ "wasmer-compiler-singlepass" ]
-universal = [ "wasmer-engine-universal" ]
-dylib = [ "wasmer-engine-dylib" ]
+universal = [ "wasmer-compiler" ]
[[bin]]
name = "equivalence_universal"
@@ -53,12 +51,7 @@ name = "metering"
path = "fuzz_targets/metering.rs"
required-features = ["universal", "cranelift"]
-[[bin]]
-name = "dylib_cranelift"
-path = "fuzz_targets/dylib_cranelift.rs"
-required-features = ["dylib", "cranelift"]
-
[[bin]]
name = "deterministic"
path = "fuzz_targets/deterministic.rs"
-required-features = ["universal", "dylib", "cranelift", "llvm", "singlepass"]
\ No newline at end of file
+required-features = ["universal", "cranelift", "llvm", "singlepass"]
diff --git a/fuzz/fuzz_targets/deterministic.rs b/fuzz/fuzz_targets/deterministic.rs
index b613d5449d5..ef550804599 100644
--- a/fuzz/fuzz_targets/deterministic.rs
+++ b/fuzz/fuzz_targets/deterministic.rs
@@ -3,11 +3,10 @@
use libfuzzer_sys::{arbitrary, arbitrary::Arbitrary, fuzz_target};
use wasm_smith::{Config, ConfiguredModule};
use wasmer::{CompilerConfig, Engine, Module, Store};
+use wasmer_compiler::Universal;
use wasmer_compiler_cranelift::Cranelift;
use wasmer_compiler_llvm::LLVM;
use wasmer_compiler_singlepass::Singlepass;
-use wasmer_engine_dylib::Dylib;
-use wasmer_engine_universal::Universal;
#[derive(Arbitrary, Debug, Default, Copy, Clone)]
struct NoImportsConfig;
@@ -25,7 +24,7 @@ impl Config for NoImportsConfig {
}
fn compile_and_compare(name: &str, engine: impl Engine, wasm: &[u8]) {
- let store = Store::new(&engine);
+ let store = Store::new_with_engine(&engine);
// compile for first time
let module = Module::new(&store, wasm).unwrap();
@@ -51,11 +50,6 @@ fuzz_target!(|module: ConfiguredModule| {
Universal::new(compiler.clone()).engine(),
&wasm_bytes,
);
- //compile_and_compare(
- // "dylib-cranelift",
- // Dylib::new(compiler).engine(),
- // &wasm_bytes,
- //);
let mut compiler = LLVM::default();
compiler.canonicalize_nans(true);
@@ -65,7 +59,6 @@ fuzz_target!(|module: ConfiguredModule| {
Universal::new(compiler.clone()).engine(),
&wasm_bytes,
);
- //compile_and_compare("dylib-llvm", Dylib::new(compiler).engine(), &wasm_bytes);
let compiler = Singlepass::default();
compile_and_compare(
@@ -73,9 +66,4 @@ fuzz_target!(|module: ConfiguredModule| {
Universal::new(compiler.clone()).engine(),
&wasm_bytes,
);
- //compile_and_compare(
- // "dylib-singlepass",
- // Dylib::new(compiler).engine(),
- // &wasm_bytes,
- //);
});
diff --git a/fuzz/fuzz_targets/dylib_cranelift.rs b/fuzz/fuzz_targets/dylib_cranelift.rs
deleted file mode 100644
index 66be05383d5..00000000000
--- a/fuzz/fuzz_targets/dylib_cranelift.rs
+++ /dev/null
@@ -1,64 +0,0 @@
-#![no_main]
-
-use libfuzzer_sys::{arbitrary, arbitrary::Arbitrary, fuzz_target};
-use wasm_smith::{Config, ConfiguredModule};
-use wasmer::{imports, Instance, Module, Store};
-use wasmer_compiler_cranelift::Cranelift;
-use wasmer_engine_dylib::Dylib;
-
-#[derive(Arbitrary, Debug, Default, Copy, Clone)]
-struct NoImportsConfig;
-impl Config for NoImportsConfig {
- fn max_imports(&self) -> usize {
- 0
- }
- fn max_memory_pages(&self) -> u32 {
- // https://github.com/wasmerio/wasmer/issues/2187
- 65535
- }
- fn allow_start_export(&self) -> bool {
- false
- }
-}
-#[derive(Arbitrary)]
-struct WasmSmithModule(ConfiguredModule);
-impl std::fmt::Debug for WasmSmithModule {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- f.write_str(&wasmprinter::print_bytes(self.0.to_bytes()).unwrap())
- }
-}
-
-fuzz_target!(|module: WasmSmithModule| {
- let serialized = {
- let wasm_bytes = module.0.to_bytes();
-
- if let Ok(path) = std::env::var("DUMP_TESTCASE") {
- use std::fs::File;
- use std::io::Write;
- let mut file = File::create(path).unwrap();
- file.write_all(&wasm_bytes).unwrap();
- return;
- }
-
- let compiler = Cranelift::default();
- let store = Store::new(&Dylib::new(compiler).engine());
- let module = Module::new(&store, &wasm_bytes).unwrap();
- module.serialize().unwrap()
- };
-
- let engine = Dylib::headless().engine();
- let store = Store::new(&engine);
- let module = unsafe { Module::deserialize(&store, serialized.as_slice()) }.unwrap();
- match Instance::new(&module, &imports! {}) {
- Ok(_) => {}
- Err(e) => {
- let error_message = format!("{}", e);
- if error_message.starts_with("RuntimeError: ")
- && error_message.contains("out of bounds")
- {
- return;
- }
- panic!("{}", e);
- }
- }
-});
diff --git a/fuzz/fuzz_targets/equivalence_universal.rs b/fuzz/fuzz_targets/equivalence_universal.rs
index bb4e4877f63..414f78adab2 100644
--- a/fuzz/fuzz_targets/equivalence_universal.rs
+++ b/fuzz/fuzz_targets/equivalence_universal.rs
@@ -5,13 +5,13 @@ use anyhow::Result;
use libfuzzer_sys::{arbitrary, arbitrary::Arbitrary, fuzz_target};
use wasm_smith::{Config, ConfiguredModule};
use wasmer::{imports, CompilerConfig, Instance, Module, Store, Val};
+use wasmer_compiler::Universal;
#[cfg(feature = "cranelift")]
use wasmer_compiler_cranelift::Cranelift;
#[cfg(feature = "llvm")]
use wasmer_compiler_llvm::LLVM;
#[cfg(feature = "singlepass")]
use wasmer_compiler_singlepass::Singlepass;
-use wasmer_engine_universal::Universal;
#[derive(Arbitrary, Debug, Default, Copy, Clone)]
struct ExportedFunctionConfig;
@@ -48,7 +48,7 @@ impl std::fmt::Debug for WasmSmithModule {
#[cfg(feature = "singlepass")]
fn maybe_instantiate_singlepass(wasm_bytes: &[u8]) -> Result