Skip to content

Commit

Permalink
Remove Universal mentions from cargo features
Browse files Browse the repository at this point in the history
  • Loading branch information
epilys committed Jul 25, 2022
1 parent b15e8c2 commit 924d2dc
Show file tree
Hide file tree
Showing 23 changed files with 91 additions and 109 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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
Expand Down
30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -713,4 +713,4 @@ install-local: package

test-minimal-versions:
rm -f Cargo.lock
cargo +nightly build --tests -Z minimal-versions --all-features
cargo +nightly build --tests -Z minimal-versions --all-features
12 changes: 6 additions & 6 deletions lib/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ core = ["hashbrown"]

# Features for `sys`.
sys = []
sys-default = ["sys", "wat", "default-universal"]
sys-default = ["sys", "wat", "default-cranelift", "default-engine_compilation"]
# - Compilers.
compiler = [
"sys",
Expand All @@ -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"]
Expand All @@ -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"]
8 changes: 1 addition & 7 deletions lib/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
30 changes: 8 additions & 22 deletions lib/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
//!
Expand All @@ -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)"
Expand Down Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion lib/api/src/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub use wasmer_compiler_cranelift::{Cranelift, CraneliftOptLevel};
#[cfg(feature = "llvm")]
pub use wasmer_compiler_llvm::{LLVMOptLevel, LLVM};

#[cfg(feature = "universal")]
#[cfg(feature = "engine_compilation")]
pub use wasmer_compiler::{Artifact, Backend, Engine};

/// Version number of this crate.
Expand Down
12 changes: 6 additions & 6 deletions lib/api/src/sys/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use wasmer_vm::StoreObjects;
/// wrap the actual context in a box.
pub(crate) struct StoreInner {
pub(crate) objects: StoreObjects,
pub(crate) engine: Arc<Engine>,
pub(crate) engine: Engine,
pub(crate) tunables: Box<dyn Tunables + Send + Sync>,
pub(crate) trap_handler: Option<Box<TrapHandlerFn<'static>>>,
}
Expand All @@ -31,7 +31,7 @@ pub(crate) struct StoreInner {
/// Spec: <https://webassembly.github.io/spec/core/exec/runtime.html#store>
pub struct Store {
pub(crate) inner: Box<StoreInner>,
engine: Arc<Engine>,
engine: Engine,
trap_handler: Arc<RwLock<Option<Box<TrapHandlerFn<'static>>>>>,
}

Expand Down Expand Up @@ -80,7 +80,7 @@ impl Store {
}

/// Returns the [`Engine`].
pub fn engine(&self) -> &Arc<Engine> {
pub fn engine(&self) -> &Engine {
&self.engine
}

Expand Down Expand Up @@ -144,7 +144,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 {
Expand Down Expand Up @@ -198,7 +198,7 @@ impl<'a> StoreRef<'a> {
}

/// Returns the [`Engine`].
pub fn engine(&self) -> &Arc<Engine> {
pub fn engine(&self) -> &Engine {
&self.inner.engine
}

Expand Down Expand Up @@ -231,7 +231,7 @@ impl<'a> StoreMut<'a> {
}

/// Returns the [`Engine`].
pub fn engine(&self) -> &Arc<Engine> {
pub fn engine(&self) -> &Engine {
&self.inner.engine
}

Expand Down
6 changes: 3 additions & 3 deletions lib/c-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ inline-c = "0.1.5"
default = [
"wat",
"cranelift",
"universal",
"compilation",
"wasi",
"middlewares",
]
Expand All @@ -58,7 +58,7 @@ middlewares = [
"compiler",
"wasmer-middlewares",
]
universal = [
compilation = [
"wasmer-compiler/engine_compilation",
"compiler",
]
Expand All @@ -79,7 +79,7 @@ llvm = [
]

# Deprecated features.
jit = ["universal"]
jit = ["compilation"]

# TODO: Port this feature.
#emscripten = ["wasmer-emscripten"]
Expand Down
2 changes: 1 addition & 1 deletion lib/c-api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 924d2dc

Please sign in to comment.