Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Deterministic #1

Merged
merged 1 commit into from
Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ check: check-bench
# as default, and test a minimal set of features with only one backend
# at a time.
cargo check --manifest-path lib/runtime/Cargo.toml
# Check some of the cases where deterministic execution could matter
cargo check --manifest-path lib/runtime/Cargo.toml --features "deterministic-execution"
cargo check --manifest-path lib/runtime/Cargo.toml --no-default-features \
--features=default-backend-singlepass,deterministic-execution
cargo check --manifest-path lib/runtime/Cargo.toml --no-default-features \
--features=default-backend-llvm,deterministic-execution
cargo check --release --manifest-path lib/runtime/Cargo.toml

$(RUNTIME_CHECK) \
Expand Down
39 changes: 16 additions & 23 deletions lib/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,21 +211,13 @@ pub fn default_compiler() -> impl Compiler {
not(feature = "docs"),
any(
feature = "default-backend-cranelift",
feature = "default-backend-singlepass",
feature = "deterministic-execution"
feature = "default-backend-singlepass"
)
),
all(
not(feature = "docs"),
feature = "default-backend-cranelift",
any(
feature = "default-backend-singlepass",
feature = "deterministic-execution"
)
),
all(
feature = "default-backend-singlepass",
feature = "deterministic-execution"
feature = "default-backend-singlepass"
)
))]
compile_error!(
Expand All @@ -235,13 +227,7 @@ pub fn default_compiler() -> impl Compiler {
#[cfg(all(feature = "default-backend-llvm", not(feature = "docs")))]
use wasmer_llvm_backend::LLVMCompiler as DefaultCompiler;

#[cfg(all(
any(
feature = "default-backend-singlepass",
all(feature = "deterministic-execution", feature = "singlepass")
),
not(feature = "docs")
))]
#[cfg(all(feature = "default-backend-singlepass", not(feature = "docs")))]
use wasmer_singlepass_backend::SinglePassCompiler as DefaultCompiler;

#[cfg(any(feature = "default-backend-cranelift", feature = "docs"))]
Expand All @@ -260,19 +246,26 @@ pub fn compiler_for_backend(backend: Backend) -> Option<Box<dyn Compiler>> {
#[cfg(feature = "cranelift")]
Backend::Cranelift => Some(Box::new(wasmer_clif_backend::CraneliftCompiler::new())),

#[cfg(any(feature = "singlepass", feature = "deterministic-execution"))]
#[cfg(any(feature = "singlepass"))]
Backend::Singlepass => Some(Box::new(
wasmer_singlepass_backend::SinglePassCompiler::new(),
)),

#[cfg(feature = "llvm")]
Backend::LLVM => Some(Box::new(wasmer_llvm_backend::LLVMCompiler::new())),

#[cfg(not(all(
feature = "llvm",
any(feature = "singlepass", feature = "deterministic-execution"),
feature = "cranelift",
)))]
Backend::Auto => {
#[cfg(feature = "default-backend-singlepass")]
return Some(Box::new(
wasmer_singlepass_backend::SinglePassCompiler::new(),
));
#[cfg(feature = "default-backend-cranelift")]
return Some(Box::new(wasmer_clif_backend::CraneliftCompiler::new()));
#[cfg(feature = "default-backend-llvm")]
return Some(Box::new(wasmer_llvm_backend::LLVMCompiler::new()));
}

#[cfg(not(all(feature = "llvm", feature = "singlepass", feature = "cranelift")))]
_ => None,
}
}
Expand Down