From 8264aec8fe9035d48c2978d6f0841b496790a1da Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Mon, 25 Jul 2022 12:47:54 +0300 Subject: [PATCH] Remove Universal mentions from cargo features --- CHANGELOG.md | 2 +- Makefile | 30 +++++++++---------- lib/api/Cargo.toml | 12 ++++---- lib/api/README.md | 8 +---- lib/api/src/lib.rs | 30 +++++-------------- lib/api/src/sys/store.rs | 2 +- lib/c-api/Cargo.toml | 6 ++-- lib/c-api/build.rs | 2 +- lib/c-api/src/wasm_c_api/engine.rs | 22 +++++++------- lib/c-api/src/wasm_c_api/mod.rs | 1 + lib/c-api/src/wasm_c_api/unstable/engine.rs | 4 +-- lib/cli-compiler/Cargo.toml | 7 ++--- lib/cli-compiler/README.md | 4 +-- lib/cli/Cargo.toml | 4 +++ lib/cli/src/store.rs | 5 ++++ lib/compiler/src/engine/artifact.rs | 2 +- .../src/engine/{engine.rs => inner.rs} | 0 lib/compiler/src/engine/mod.rs | 4 +-- lib/object/README.md | 3 +- lib/vm/README.md | 7 ++--- 20 files changed, 69 insertions(+), 86 deletions(-) rename lib/compiler/src/engine/{engine.rs => inner.rs} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4803f5678db..da70b2c8982 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C - [#2946](https://github.com/wasmerio/wasmer/pull/2946) Remove dylib,staticlib engines in favor of a single Universal engine - [#2949](https://github.com/wasmerio/wasmer/pull/2949) Switch back to using custom LLVM builds on CI - #2892 Renamed `get_native_function` to `get_typed_function`, marked former as deprecated. -- [#2869](https://github.com/wasmerio/wasmer/pull/2869) Removed Artifact, Engine traits. Renamed UniversalArtifact to Artifact, and UniversalEngine to Engine. +- [#3029](https://github.com/wasmerio/wasmer/pull/3029) Removed Artifact, Engine traits. Renamed UniversalArtifact to Artifact, and UniversalEngine to Engine. ### Fixed - [#2963](https://github.com/wasmerio/wasmer/pull/2963) Remove accidental dependency on libwayland and libxcb in ClI diff --git a/Makefile b/Makefile index 7161f529a32..34a7b0e184b 100644 --- a/Makefile +++ b/Makefile @@ -355,11 +355,11 @@ check-wasmer: $(CARGO_BINARY) check $(CARGO_TARGET) --manifest-path lib/cli/Cargo.toml $(compiler_features) --bin wasmer check-wasmer-wasm: - $(CARGO_BINARY) check --manifest-path lib/cli-compiler/Cargo.toml --target wasm32-wasi --features singlepass,cranelift,universal --bin wasmer-compiler + $(CARGO_BINARY) check --manifest-path lib/cli-compiler/Cargo.toml --target wasm32-wasi --features singlepass,cranelift --bin wasmer-compiler check-capi: capi-setup RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) check $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml \ - --no-default-features --features wat,universal,wasi,middlewares $(capi_compiler_features) + --no-default-features --features wat,compilation,wasi,middlewares $(capi_compiler_features) build-wasmer: $(CARGO_BINARY) build $(CARGO_TARGET) --release --manifest-path lib/cli/Cargo.toml $(compiler_features) --bin wasmer @@ -371,7 +371,7 @@ bench: $(CARGO_BINARY) bench $(CARGO_TARGET) $(compiler_features) build-wasmer-wasm: - $(CARGO_BINARY) build --release --manifest-path lib/cli-compiler/Cargo.toml --target wasm32-wasi --features singlepass,cranelift,universal --bin wasmer-compiler + $(CARGO_BINARY) build --release --manifest-path lib/cli-compiler/Cargo.toml --target wasm32-wasi --features singlepass,cranelift --bin wasmer-compiler # For best results ensure the release profile looks like the following # in Cargo.toml: @@ -421,46 +421,46 @@ 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,cranelift,wasi + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) doc $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,compilation,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,wasi,middlewares $(capi_compiler_features) + --no-default-features --features wat,compilation,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,singlepass,wasi,middlewares + --no-default-features --features wat,compilation,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 + --no-default-features --features wat,compilation,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,cranelift,wasi,middlewares + --no-default-features --features wat,compilation,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 + --no-default-features --features wat,compilation,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,llvm,wasi,middlewares + --no-default-features --features wat,compilation,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 + --no-default-features --features wat,compilation,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 + --no-default-features --features compilation,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,wasi + --no-default-features --features compilation,wasi build-capi-headless-ios: capi-setup RUSTFLAGS="${RUSTFLAGS}" cargo lipo --manifest-path lib/c-api/Cargo.toml --release \ @@ -520,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,wasi,middlewares $(capi_compiler_features) -- --nocapture + --no-default-features --features wat,compilation,wasi,middlewares $(capi_compiler_features) -- --nocapture test-capi-integration-%: # Test the Wasmer C API tests for C @@ -713,4 +713,4 @@ install-local: package test-minimal-versions: rm -f Cargo.lock - cargo +nightly build --tests -Z minimal-versions --all-features \ No newline at end of file + cargo +nightly build --tests -Z minimal-versions --all-features diff --git a/lib/api/Cargo.toml b/lib/api/Cargo.toml index fa39fbd2454..5845d2563e9 100644 --- a/lib/api/Cargo.toml +++ b/lib/api/Cargo.toml @@ -89,7 +89,7 @@ core = ["hashbrown"] # Features for `sys`. sys = [] -sys-default = ["sys", "wat", "default-cranelift", "default-universal"] +sys-default = ["sys", "wat", "default-cranelift", "default-engine_compilation"] # - Compilers. compiler = [ "sys", @@ -104,16 +104,16 @@ default-cranelift = ["default-compiler", "cranelift"] default-llvm = ["default-compiler", "llvm"] # - Engines. engine = ["sys"] -universal = [ +engine_compilation = [ "engine", "wasmer-compiler/engine_compilation" ] default-engine = [] -default-universal = [ +default-engine_compilation = [ "default-engine", - "universal", + "engine_compilation", ] # - Deprecated features. -jit = ["universal"] +jit = ["engine_compilation"] # Features for `js`. js = ["wasm-bindgen", "js-sys"] @@ -124,4 +124,4 @@ wasm-types-polyfill = ["js", "wasmparser"] js-serializable-module = [] [package.metadata.docs.rs] -features = ["compiler", "core", "cranelift", "default-compiler", "default-engine", "engine", "jit", "native", "singlepass", "sys", "sys-default", "universal"] +features = ["compiler", "core", "cranelift", "default-compiler", "default-engine", "engine", "jit", "native", "singlepass", "sys", "sys-default", "engine_compilation"] diff --git a/lib/api/README.md b/lib/api/README.md index 51b209344ad..46a016fb8ab 100644 --- a/lib/api/README.md +++ b/lib/api/README.md @@ -45,12 +45,7 @@ fn main() -> anyhow::Result<()> { Wasmer is not only fast, but also designed to be *highly customizable*: -* **Pluggable engines** — An engine is responsible to drive the - compilation process and to store the generated executable code - somewhere, either: - * in-memory (with [`wasmer-engine-universal`]), - -* **Pluggable compilers** — A compiler is used by an engine to +* **Pluggable compilers** — A compiler is used by the engine to transform WebAssembly into executable code: * [`wasmer-compiler-singlepass`] provides a fast compilation-time but an unoptimized runtime speed, @@ -94,7 +89,6 @@ more](https://wasmerio.github.io/wasmer/crates/doc/wasmer/). Made with ❤️ by the Wasmer team, for the community -[`wasmer-engine-universal`]: https://github.com/wasmerio/wasmer/tree/master/lib/engine-universal [`wasmer-compiler-singlepass`]: https://github.com/wasmerio/wasmer/tree/master/lib/compiler-singlepass [`wasmer-compiler-cranelift`]: https://github.com/wasmerio/wasmer/tree/master/lib/compiler-cranelift [`wasmer-compiler-llvm`]: https://github.com/wasmerio/wasmer/tree/master/lib/compiler-llvm diff --git a/lib/api/src/lib.rs b/lib/api/src/lib.rs index 6a4686033ff..300362667dc 100644 --- a/lib/api/src/lib.rs +++ b/lib/api/src/lib.rs @@ -73,12 +73,7 @@ //! //! Wasmer is not only fast, but also designed to be *highly customizable*: //! -//! * **Pluggable engines** — An engine is responsible to drive the -//! compilation process and to store the generated executable code -//! somewhere, either: -//! * in-memory (with [`wasmer-engine-universal`]), -//! -//! * **Pluggable compilers** — A compiler is used by an engine to +//! * **Pluggable compilers** — A compiler is used by the engine to //! transform WebAssembly into executable code: //! * [`wasmer-compiler-singlepass`] provides a fast compilation-time //! but an unoptimized runtime speed, @@ -243,15 +238,15 @@ //! - [`wasmer-wasi`] for running Wasm modules compiled to the WASI ABI. //! //! The Wasmer project has two major abstractions: -//! 1. [Engines][wasmer-engine], +//! 1. [Engine][wasmer-compiler], //! 2. [Compilers][wasmer-compiler]. //! //! These two abstractions have multiple options that can be enabled //! with features. //! -//! ## Engines +//! ## Engine //! -//! An engine is a system that uses a compiler to make a WebAssembly +//! The engine is a system that uses a compiler to make a WebAssembly //! module executable. //! //! ## Compilers @@ -311,10 +306,10 @@ #![cfg_attr(feature = "wat", doc = "(enabled),")] #![cfg_attr(not(feature = "wat"), doc = "(disabled),")] //! enables `wasmer` to parse the WebAssembly text format, -//! - `universal` -#![cfg_attr(feature = "universal", doc = "(enabled),")] -#![cfg_attr(not(feature = "universal"), doc = "(disabled),")] -//! enables [the Universal engine][`wasmer-engine-universal`]. +//! - `compilation` +#![cfg_attr(feature = "compilation", doc = "(enabled),")] +#![cfg_attr(not(feature = "compilation"), doc = "(disabled),")] +//! enables compilation with the wasmer engine. //! //! The features that set defaults come in sets that are mutually exclusive. //! @@ -331,13 +326,6 @@ #![cfg_attr(feature = "default-singlepass", doc = "(enabled),")] #![cfg_attr(not(feature = "default-singlepass"), doc = "(disabled),")] //! set Wasmer's Singlepass compiler as the default. -//! -//! The next set is the default engine set: -//! - `default-universal` -#![cfg_attr(feature = "default-universal", doc = "(enabled),")] -#![cfg_attr(not(feature = "default-universal"), doc = "(disabled),")] -//! set the Universal engine as the default. -//! #![cfg_attr( feature = "js", doc = "## Features for the `js` feature group (enabled)" @@ -414,8 +402,6 @@ //! [`wasmer-cache`]: https://docs.rs/wasmer-cache/ //! [wasmer-compiler]: https://docs.rs/wasmer-compiler/ //! [`wasmer-emscripten`]: https://docs.rs/wasmer-emscripten/ -//! [wasmer-engine]: https://docs.rs/wasmer-engine/ -//! [`wasmer-engine-universal`]: https://docs.rs/wasmer-engine-universal/ //! [`wasmer-compiler-singlepass`]: https://docs.rs/wasmer-compiler-singlepass/ //! [`wasmer-compiler-llvm`]: https://docs.rs/wasmer-compiler-llvm/ //! [`wasmer-compiler-cranelift`]: https://docs.rs/wasmer-compiler-cranelift/ diff --git a/lib/api/src/sys/store.rs b/lib/api/src/sys/store.rs index 5b3f0159d17..924459ae2b7 100644 --- a/lib/api/src/sys/store.rs +++ b/lib/api/src/sys/store.rs @@ -141,7 +141,7 @@ impl Default for Store { #[allow(unreachable_code, unused_mut)] fn get_engine(mut config: impl CompilerConfig + 'static) -> Engine { cfg_if::cfg_if! { - if #[cfg(feature = "default-universal")] { + if #[cfg(feature = "engine_compilation")] { wasmer_compiler::Backend::new(config) .engine() } else { diff --git a/lib/c-api/Cargo.toml b/lib/c-api/Cargo.toml index d09fd9b93c6..aebcab09deb 100644 --- a/lib/c-api/Cargo.toml +++ b/lib/c-api/Cargo.toml @@ -48,7 +48,7 @@ inline-c = "0.1.5" default = [ "wat", "cranelift", - "universal", + "compilation", "wasi", "middlewares", ] @@ -58,7 +58,7 @@ middlewares = [ "compiler", "wasmer-middlewares", ] -universal = [ +compilation = [ "wasmer-compiler/engine_compilation", "compiler", ] @@ -79,7 +79,7 @@ llvm = [ ] # Deprecated features. -jit = ["universal"] +jit = ["compilation"] # TODO: Port this feature. #emscripten = ["wasmer-emscripten"] diff --git a/lib/c-api/build.rs b/lib/c-api/build.rs index 329c360bc98..0a8c744a6ef 100644 --- a/lib/c-api/build.rs +++ b/lib/c-api/build.rs @@ -140,7 +140,7 @@ fn build_wasm_c_api_headers(crate_dir: &str, out_dir: &str) { pre_header = PRE_HEADER ); - map_feature_as_c_define!("universal", UNIVERSAL_FEATURE_AS_C_DEFINE, pre_header); + map_feature_as_c_define!("compilation", UNIVERSAL_FEATURE_AS_C_DEFINE, pre_header); map_feature_as_c_define!("compiler", COMPILER_FEATURE_AS_C_DEFINE, pre_header); map_feature_as_c_define!("wasi", WASI_FEATURE_AS_C_DEFINE, pre_header); map_feature_as_c_define!("middlewares", MIDDLEWARES_FEATURE_AS_C_DEFINE, pre_header); diff --git a/lib/c-api/src/wasm_c_api/engine.rs b/lib/c-api/src/wasm_c_api/engine.rs index 72d26ceb878..66afa2dec24 100644 --- a/lib/c-api/src/wasm_c_api/engine.rs +++ b/lib/c-api/src/wasm_c_api/engine.rs @@ -12,7 +12,7 @@ use super::unstable::target_lexicon::wasmer_target_t; use crate::error::update_last_error; use cfg_if::cfg_if; use std::sync::Arc; -#[cfg(feature = "universal")] +#[cfg(feature = "compilation")] use wasmer_compiler::{Backend, Engine}; /// Kind of compilers that can be used by the engines. @@ -69,7 +69,7 @@ pub enum wasmer_engine_t { impl Default for wasmer_engine_t { fn default() -> Self { cfg_if! { - if #[cfg(feature = "universal")] { + if #[cfg(feature = "compilation")] { Self::UNIVERSAL } else { compile_error!("Please enable one of the engines") @@ -268,7 +268,7 @@ pub struct wasm_engine_t { #[cfg(feature = "compiler")] use wasmer_api::CompilerConfig; -#[cfg(all(feature = "compiler", any(feature = "universal", feature = "dylib")))] +#[cfg(all(feature = "compiler", any(feature = "compilation", feature = "dylib")))] fn get_default_compiler_config() -> Box { cfg_if! { if #[cfg(feature = "cranelift")] { @@ -284,7 +284,7 @@ fn get_default_compiler_config() -> Box { } cfg_if! { - if #[cfg(all(feature = "universal", feature = "compiler"))] { + if #[cfg(all(feature = "compilation", feature = "compiler"))] { /// Creates a new Universal engine with the default compiler. /// /// # Example @@ -298,7 +298,7 @@ cfg_if! { let engine: Arc = Arc::new(Backend::new(compiler_config).engine()); Box::new(wasm_engine_t { inner: engine }) } - } else if #[cfg(feature = "universal")] { + } else if #[cfg(feature = "compilation")] { /// Creates a new headless Universal engine. /// /// # Example @@ -321,7 +321,7 @@ cfg_if! { /// cbindgen:ignore #[no_mangle] pub extern "C" fn wasm_engine_new() -> Box { - unimplemented!("No engine attached; You might want to recompile `wasmer_c_api` with for example `--feature universal`"); + unimplemented!("No engine attached; You might want to recompile `wasmer_c_api` with for example `--feature compilation`"); } } } @@ -418,9 +418,9 @@ pub extern "C" fn wasm_engine_new_with_config( compiler_config.canonicalize_nans(true); } - #[cfg(not(feature = "universal"))] - return return_with_error("Wasmer has not been compiled with the `universal` feature."); - #[cfg(feature = "universal")] + #[cfg(not(feature = "compilation"))] + return return_with_error("Wasmer has not been compiled with the `compilation` feature."); + #[cfg(feature = "compilation")] let inner: Arc = { let mut builder = Backend::new(compiler_config); @@ -439,7 +439,7 @@ pub extern "C" fn wasm_engine_new_with_config( } else { let inner: Arc = cfg_if! { - if #[cfg(feature = "universal")] { + if #[cfg(feature = "compilation")] { let mut builder = Backend::headless(); if let Some(target) = config.target { @@ -452,7 +452,7 @@ pub extern "C" fn wasm_engine_new_with_config( Arc::new(builder.engine()) } else { - return return_with_error("Wasmer has not been compiled with the `universal` feature."); + return return_with_error("Wasmer has not been compiled with the `compilation` feature."); } }; Some(Box::new(wasm_engine_t { inner })) diff --git a/lib/c-api/src/wasm_c_api/mod.rs b/lib/c-api/src/wasm_c_api/mod.rs index 5ec333e320a..d04bfe66e25 100644 --- a/lib/c-api/src/wasm_c_api/mod.rs +++ b/lib/c-api/src/wasm_c_api/mod.rs @@ -62,6 +62,7 @@ mod macros; /// ``` /// /// To configure the engine, see the [`wasm_config_new`][engine::wasm_config_new]. +#[cfg(feature = "compilation")] pub mod engine; /// cbindgen:ignore diff --git a/lib/c-api/src/wasm_c_api/unstable/engine.rs b/lib/c-api/src/wasm_c_api/unstable/engine.rs index e1ea2324c8c..ec61e56a355 100644 --- a/lib/c-api/src/wasm_c_api/unstable/engine.rs +++ b/lib/c-api/src/wasm_c_api/unstable/engine.rs @@ -161,7 +161,7 @@ pub extern "C" fn wasmer_is_headless() -> bool { /// compiled library. #[no_mangle] pub extern "C" fn wasmer_is_engine_available(engine: wasmer_engine_t) -> bool { - matches!(engine, wasmer_engine_t::UNIVERSAL if cfg!(feature = "universal")) + matches!(engine, wasmer_engine_t::UNIVERSAL if cfg!(feature = "compilation")) } #[cfg(test)] @@ -234,7 +234,7 @@ mod tests { fn test_wasmer_is_engine_available() { set_var( "UNIVERSAL", - if cfg!(feature = "universal") { + if cfg!(feature = "compilation") { "1" } else { "0" diff --git a/lib/cli-compiler/Cargo.toml b/lib/cli-compiler/Cargo.toml index 680b50e372c..85252f94d96 100644 --- a/lib/cli-compiler/Cargo.toml +++ b/lib/cli-compiler/Cargo.toml @@ -48,11 +48,8 @@ unix_mode = "0.1.3" [features] # Don't add the compiler features in default, please add them on the Makefile # since we might want to autoconfigure them depending on the availability on the host. -default = [ - "universal", -] +default = [] engine = [] -universal = [] compiler = [ "wasmer-compiler/translator", ] @@ -66,4 +63,4 @@ cranelift = [ ] debug = ["fern", "log"] disable-all-logging = [] -jit = ["universal"] +jit = [] diff --git a/lib/cli-compiler/README.md b/lib/cli-compiler/README.md index 512321d19bf..a1aacb1614c 100644 --- a/lib/cli-compiler/README.md +++ b/lib/cli-compiler/README.md @@ -6,13 +6,11 @@ This crate is the Wasmer Compiler only CLI. ## Features The Compiler only Wasmer supports the following features: -* `universal` (default): support for the [Universal engine]. * `wasi` (default): support for [WASI]. * `experimental-io-devices`: support for experimental IO devices in WASI. * `emscripten` (default): support for [Emscripten]. * `singlepass`: support for the [Singlepass compiler]. -[Universal engine]: https://github.com/wasmerio/wasmer/tree/master/lib/engine-universal/ [WASI]: https://github.com/wasmerio/wasmer/tree/master/lib/wasi/ [Emscripten]: https://github.com/wasmerio/wasmer/tree/master/lib/emscripten/ [Singlepass compiler]: https://github.com/wasmerio/wasmer/tree/master/lib/compiler-singlepass/ @@ -30,5 +28,5 @@ wasmer-compiler -V Compile a WebAssembly file: ```bash -wasmer-compiler compile myfile.wasm -o myfile.wasmu --singlepass --universal +wasmer-compiler compile myfile.wasm -o myfile.wasmu --singlepass ``` diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index ecf45c929b7..8294e4056c3 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -64,6 +64,7 @@ default = [ "cache", "wasi", "emscripten", + "compilation", ] cache = ["wasmer-cache"] cache-blake3-pure = ["wasmer-cache/blake3-pure"] @@ -74,6 +75,9 @@ wat = ["wasmer/wat"] compiler = [ "wasmer-compiler/translator", ] +compilation = [ + "wasmer-compiler/engine_compilation", +] experimental-io-devices = [ "wasmer-wasi-experimental-io-devices", "wasi" diff --git a/lib/cli/src/store.rs b/lib/cli/src/store.rs index 6bfa5227a7c..70a76a90bc6 100644 --- a/lib/cli/src/store.rs +++ b/lib/cli/src/store.rs @@ -14,6 +14,8 @@ use structopt::StructOpt; use wasmer::*; #[cfg(feature = "compiler")] use wasmer_compiler::CompilerConfig; +#[cfg(feature = "compilation")] +use wasmer_compiler::Engine; #[derive(Debug, Clone, StructOpt, Default)] /// The compiler options @@ -108,6 +110,7 @@ impl CompilerOptions { Ok((store, compiler_type)) } + #[cfg(feature = "compilation")] fn get_engine( &self, target: Target, @@ -317,6 +320,7 @@ impl StoreOptions { Ok((store, compiler_type)) } + #[cfg(feature = "compilation")] fn get_engine_with_compiler( &self, target: Target, @@ -331,6 +335,7 @@ impl StoreOptions { // If we don't have a compiler, but we have an engine #[cfg(not(feature = "compiler"))] impl StoreOptions { + #[cfg(feature = "compilation")] fn get_engine_headless(&self) -> Result> { let engine: Arc = Arc::new(wasmer_compiler::Backend::headless().engine()); Ok(engine) diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 928affe5ff8..1409ecde6f5 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -1,7 +1,7 @@ //! Define `Artifact`, based on `ArtifactBuild` //! to allow compiling and instantiating to be done as separate steps. -use crate::engine::engine::{Engine, EngineInner}; +use crate::engine::inner::{Engine, EngineInner}; use crate::engine::link::link_module; use crate::ArtifactBuild; use crate::ArtifactCreate; diff --git a/lib/compiler/src/engine/engine.rs b/lib/compiler/src/engine/inner.rs similarity index 100% rename from lib/compiler/src/engine/engine.rs rename to lib/compiler/src/engine/inner.rs diff --git a/lib/compiler/src/engine/mod.rs b/lib/compiler/src/engine/mod.rs index 20b6a9c5353..d78d521d6cb 100644 --- a/lib/compiler/src/engine/mod.rs +++ b/lib/compiler/src/engine/mod.rs @@ -12,7 +12,7 @@ mod backend; #[cfg(feature = "translator")] mod code_memory; #[cfg(feature = "translator")] -mod engine; +mod inner; #[cfg(feature = "translator")] mod link; #[cfg(feature = "translator")] @@ -30,6 +30,6 @@ pub use self::backend::Backend; #[cfg(feature = "translator")] pub use self::code_memory::CodeMemory; #[cfg(feature = "translator")] -pub use self::engine::Engine; +pub use self::inner::Engine; #[cfg(feature = "translator")] pub use self::link::link_module; diff --git a/lib/object/README.md b/lib/object/README.md index 99e9c86204d..aee56b3b269 100644 --- a/lib/object/README.md +++ b/lib/object/README.md @@ -3,8 +3,7 @@ The Wasmer Native Object crate aims at cross-generating native objects for various platforms. -This crate is the foundation of [the `wasmer-engine-dylib` -crate](../engine-dylib/). Given a compilation result, i.e. the result +Given a compilation result, i.e. the result of `wasmer_compiler::Compiler::compile_module`, this crate exposes functions to create an `Object` file for a given target. It is a useful thin layer on top of [the `object` diff --git a/lib/vm/README.md b/lib/vm/README.md index f534f97cd93..e15c595799b 100644 --- a/lib/vm/README.md +++ b/lib/vm/README.md @@ -1,14 +1,13 @@ # `wasmer-vm` [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/master/LICENSE) -This crate contains the Wasmer VM runtime library, supporting the Wasm ABI used by any [`wasmer-engine`] implementation. +This crate contains the Wasmer VM runtime library, supporting the Wasm ABI used by wasmer. The Wasmer runtime is modular by design, and provides several libraries where each of them provides a specific set of features. This `wasmer-vm` library contains the low-level foundation for the runtime itself. -It provides all the APIs the -[`wasmer-engine`](https://crates.io/crates/wasmer-engine) needs to operate, +It provides all the APIs wasmer needs to operate, from the `instance`, to `memory`, `probestack`, signature registry, `trap`, `table`, `VMContext`, `libcalls` etc. @@ -17,7 +16,7 @@ directly. The `wasmer` crate provides types that embed types from `wasmer-vm` with a higher-level API. -[`wasmer-engine`]: https://crates.io/crates/wasmer-engine +[`wasmer`]: https://crates.io/crates/wasmer ### Acknowledgments