Skip to content

Commit

Permalink
runtime: removing default-Backend-X feature. staying with the short…
Browse files Browse the repository at this point in the history
…er versions of `llvm/cranelift/singlepass`.
  • Loading branch information
YaronWittenstein committed Aug 22, 2019
1 parent 4fcf61f commit da28f91
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/runtime-c-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ version = "0.6.0"
[features]
default = ["cranelift-backend"]
debug = ["wasmer-runtime/debug"]
cranelift-backend = ["wasmer-runtime/cranelift", "wasmer-runtime/default-backend-cranelift"]
cranelift-backend = ["wasmer-runtime/cranelift"]
llvm-backend = ["wasmer-runtime/llvm"]
singlepass-backend = ["wasmer-runtime/singlepass"]

Expand Down
5 changes: 1 addition & 4 deletions lib/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,12 @@ path = "../llvm-backend"
optional = true

[features]
default = ["cranelift", "default-backend-cranelift"]
default = ["cranelift"]
cranelift = ["wasmer-clif-backend"]
cache = ["cranelift"]
debug = ["wasmer-clif-backend/debug", "wasmer-runtime-core/debug"]
llvm = ["wasmer-llvm-backend"]
singlepass = ["wasmer-singlepass-backend"]
default-backend-singlepass = ["singlepass"]
default-backend-llvm = ["llvm"]
default-backend-cranelift = ["cranelift"]

[[bench]]
name = "nginx"
Expand Down
23 changes: 7 additions & 16 deletions lib/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
//! let value = add_one.call(42)?;
//!
//! assert_eq!(value, 43);
//!
//!
//! Ok(())
//! }
//! ```
Expand Down Expand Up @@ -188,29 +188,20 @@ pub fn instantiate(wasm: &[u8], import_object: &ImportObject) -> error::Result<I
/// Get a single instance of the default compiler to use.
pub fn default_compiler() -> impl Compiler {
#[cfg(any(
all(
feature = "default-backend-llvm",
any(
feature = "default-backend-cranelift",
feature = "default-backend-singlepass"
)
),
all(
feature = "default-backend-cranelift",
feature = "default-backend-singlepass"
)
all(feature = "llvm", any(feature = "cranelift", feature = "singlepass")),
all(feature = "cranelift", feature = "singlepass")
))]
compile_error!(
"The `default-backend-X` features are mutually exclusive. Please choose just one"
"`cranelift / llvm / singlepass` features are mutually exclusive. Please choose just one"
);

#[cfg(feature = "default-backend-llvm")]
#[cfg(feature = "llvm")]
use wasmer_llvm_backend::LLVMCompiler as DefaultCompiler;

#[cfg(feature = "default-backend-singlepass")]
#[cfg(feature = "singlepass")]
use wasmer_singlepass_backend::SinglePassCompiler as DefaultCompiler;

#[cfg(feature = "default-backend-cranelift")]
#[cfg(feature = "cranelift")]
use wasmer_clif_backend::CraneliftCompiler as DefaultCompiler;

DefaultCompiler::new()
Expand Down

0 comments on commit da28f91

Please sign in to comment.