Make cranelift optional and enable singlepass by default on aarch64.

This commit is contained in:
losfair
2019-11-21 23:31:10 +08:00
parent df43759a67
commit 5f26fcd633
4 changed files with 21 additions and 8 deletions

View File

@@ -24,7 +24,7 @@ byteorder = "1.3"
errno = "0.2"
structopt = "0.3"
wabt = "0.9.1"
wasmer-clif-backend = { path = "lib/clif-backend" }
wasmer-clif-backend = { path = "lib/clif-backend", optional = true }
wasmer-singlepass-backend = { path = "lib/singlepass-backend", optional = true }
wasmer-middleware-common = { path = "lib/middleware-common" }
wasmer-runtime = { path = "lib/runtime" }
@@ -73,7 +73,7 @@ serde = { version = "1", features = ["derive"] } # used by the plugin example
typetag = "0.1" # used by the plugin example
[features]
default = ["fast-tests", "wasi", "backend-cranelift"]
default = ["fast-tests", "wasi"]
"loader-kernel" = ["wasmer-kernel-loader"]
debug = ["wasmer-runtime-core/debug"]
trace = ["wasmer-runtime-core/trace"]

View File

@@ -17,7 +17,7 @@ FROM wasmer-build-env AS wasmer-build
WORKDIR /home/circleci/wasmer
COPY . /home/circleci/wasmer
RUN sudo chmod -R 777 .
RUN cargo build --release
RUN cargo build --release --features backend-cranelift
FROM debian:stretch AS wasmer
WORKDIR /root/

View File

@@ -102,7 +102,7 @@ llvm: spectests-llvm emtests-llvm wasitests-llvm
# All tests
capi:
cargo build --release
cargo build --release --features backend-cranelift
cargo build -p wasmer-runtime-c-api --release
test-capi: capi
@@ -151,7 +151,7 @@ lint:
precommit: lint test
debug:
cargo build --release --features backend-singlepass,debug,trace
cargo build --release --features backend-cranelift,backend-singlepass,debug,trace
install:
cargo install --path .
@@ -220,13 +220,13 @@ check: check-bench
# Release
release:
cargo build --release --features backend-singlepass,backend-llvm,loader-kernel
cargo build --release --features backend-cranelift,backend-singlepass,backend-llvm,loader-kernel
# Only one backend (cranelift)
release-clif:
# If you are on macOS, you will need mingw-w64 for cross compiling to Windows
# brew install mingw-w64
cargo build --release
cargo build --release --features backend-cranelift
release-singlepass:
cargo build --release --features backend-singlepass

View File

@@ -21,6 +21,7 @@ use std::collections::HashMap;
use structopt::{clap, StructOpt};
use wasmer::*;
#[cfg(feature = "backend-cranelift")]
use wasmer_clif_backend::CraneliftCompiler;
#[cfg(feature = "backend-llvm")]
use wasmer_llvm_backend::{LLVMCompiler, LLVMOptions};
@@ -144,7 +145,8 @@ struct Run {
#[structopt(parse(from_os_str))]
path: PathBuf,
// Disable the cache
/// Name of the backend to use. (x86_64)
#[cfg(target_arch = "x86_64")]
#[structopt(
long = "backend",
default_value = "cranelift",
@@ -153,6 +155,16 @@ struct Run {
)]
backend: Backend,
/// Name of the backend to use. (aarch64)
#[cfg(target_arch = "aarch64")]
#[structopt(
long = "backend",
default_value = "singlepass",
case_insensitive = true,
possible_values = Backend::variants(),
)]
backend: Backend,
/// Invoke a specified function
#[structopt(long = "invoke", short = "i")]
invoke: Option<String>,
@@ -893,6 +905,7 @@ fn get_compiler_by_backend(backend: Backend, _opts: &Run) -> Option<Box<dyn Comp
}
#[cfg(not(feature = "backend-singlepass"))]
Backend::Singlepass => return None,
#[cfg(feature = "backend-cranelift")]
Backend::Cranelift => Box::new(CraneliftCompiler::new()),
#[cfg(feature = "backend-llvm")]
Backend::LLVM => Box::new(LLVMCompiler::new()),