mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
Merge #597
597: fix metering benchmark r=MarkMcCaskey a=MarkMcCaskey resolves #596 Co-authored-by: Mark McCaskey <mark@wasmer.io>
This commit is contained in:
commit
f778330fed
@ -115,6 +115,8 @@ jobs:
|
|||||||
name: Check
|
name: Check
|
||||||
command: |
|
command: |
|
||||||
make check
|
make check
|
||||||
|
make compile-bench-singlepass
|
||||||
|
# TODO: add compile-bench-llvm and compile-bench-clif when they work
|
||||||
- run:
|
- run:
|
||||||
name: Release
|
name: Release
|
||||||
command: make release-fast
|
command: make release-fast
|
||||||
|
20
Cargo.toml
20
Cargo.toml
@ -73,9 +73,23 @@ trace = ["wasmer-runtime-core/trace"]
|
|||||||
extra-debug = ["wasmer-clif-backend/debug", "wasmer-runtime-core/debug"]
|
extra-debug = ["wasmer-clif-backend/debug", "wasmer-runtime-core/debug"]
|
||||||
# This feature will allow cargo test to run much faster
|
# This feature will allow cargo test to run much faster
|
||||||
fast-tests = []
|
fast-tests = []
|
||||||
backend-cranelift = ["wasmer-runtime-core/backend-cranelift", "wasmer-runtime/cranelift"]
|
backend-cranelift = [
|
||||||
backend-llvm = ["wasmer-llvm-backend", "wasmer-runtime-core/backend-llvm", "wasmer-runtime/llvm"]
|
"wasmer-runtime-core/backend-cranelift",
|
||||||
backend-singlepass = ["wasmer-singlepass-backend", "wasmer-runtime-core/backend-singlepass", "wasmer-runtime/singlepass"]
|
"wasmer-runtime/cranelift",
|
||||||
|
"wasmer-middleware-common/clif"
|
||||||
|
]
|
||||||
|
backend-llvm = [
|
||||||
|
"wasmer-llvm-backend",
|
||||||
|
"wasmer-runtime-core/backend-llvm",
|
||||||
|
"wasmer-runtime/llvm",
|
||||||
|
"wasmer-middleware-common/llvm"
|
||||||
|
]
|
||||||
|
backend-singlepass = [
|
||||||
|
"wasmer-singlepass-backend",
|
||||||
|
"wasmer-runtime-core/backend-singlepass",
|
||||||
|
"wasmer-runtime/singlepass",
|
||||||
|
"wasmer-middleware-common/singlepass"
|
||||||
|
]
|
||||||
wasi = ["wasmer-wasi"]
|
wasi = ["wasmer-wasi"]
|
||||||
# vfs = ["wasmer-runtime-abi"]
|
# vfs = ["wasmer-runtime-abi"]
|
||||||
|
|
||||||
|
16
Makefile
16
Makefile
@ -141,8 +141,20 @@ release-singlepass:
|
|||||||
release-llvm:
|
release-llvm:
|
||||||
cargo build --release --features backend-llvm
|
cargo build --release --features backend-llvm
|
||||||
|
|
||||||
bench:
|
bench-singlepass:
|
||||||
cargo bench --all
|
cargo bench --all --no-default-features --features "backend-singlepass"
|
||||||
|
bench-clif:
|
||||||
|
cargo bench --all --no-default-features --features "backend-clif"
|
||||||
|
bench-llvm:
|
||||||
|
cargo bench --all --no-default-features --features "backend-llvm"
|
||||||
|
|
||||||
|
# compile but don't run the benchmarks
|
||||||
|
compile-bench-singlepass:
|
||||||
|
cargo bench --all --no-run --no-default-features --features "backend-singlepass"
|
||||||
|
compile-bench-clif:
|
||||||
|
cargo bench --all --no-run --no-default-features --features "backend-clif"
|
||||||
|
compile-bench-llvm:
|
||||||
|
cargo bench --all --no-run --no-default-features --features "backend-llvm"
|
||||||
|
|
||||||
|
|
||||||
# Build utils
|
# Build utils
|
||||||
|
@ -220,7 +220,10 @@ Each integration can be tested separately:
|
|||||||
Benchmarks can be run with:
|
Benchmarks can be run with:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make bench
|
make bench-[backend]
|
||||||
|
|
||||||
|
# for example
|
||||||
|
make bench-singlepass
|
||||||
```
|
```
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
@ -164,15 +164,11 @@ fn get_compiler(limit: u64, metering: bool) -> impl Compiler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))]
|
#[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))]
|
||||||
fn get_compiler(_limit: u64, metering: bool) -> impl Compiler {
|
compile_error!("compiler not specified, activate a compiler via features");
|
||||||
panic!("compiler not specified, activate a compiler via features");
|
|
||||||
use wasmer_clif_backend::CraneliftCompiler;
|
|
||||||
CraneliftCompiler::new()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "clif")]
|
#[cfg(feature = "clif")]
|
||||||
fn get_compiler(_limit: u64, metering: bool) -> impl Compiler {
|
fn get_compiler(_limit: u64, metering: bool) -> impl Compiler {
|
||||||
panic!("cranelift does not implement metering");
|
compile_error!("cranelift does not implement metering");
|
||||||
use wasmer_clif_backend::CraneliftCompiler;
|
use wasmer_clif_backend::CraneliftCompiler;
|
||||||
CraneliftCompiler::new()
|
CraneliftCompiler::new()
|
||||||
}
|
}
|
||||||
|
@ -162,15 +162,11 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))]
|
#[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))]
|
||||||
fn get_compiler(_limit: u64) -> impl Compiler {
|
compile_error!("compiler not specified, activate a compiler via features");
|
||||||
panic!("compiler not specified, activate a compiler via features");
|
|
||||||
use wasmer_clif_backend::CraneliftCompiler;
|
|
||||||
CraneliftCompiler::new()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "clif")]
|
#[cfg(feature = "clif")]
|
||||||
fn get_compiler(_limit: u64) -> impl Compiler {
|
fn get_compiler(_limit: u64) -> impl Compiler {
|
||||||
panic!("cranelift does not implement metering");
|
compile_error!("cranelift does not implement metering");
|
||||||
use wasmer_clif_backend::CraneliftCompiler;
|
use wasmer_clif_backend::CraneliftCompiler;
|
||||||
CraneliftCompiler::new()
|
CraneliftCompiler::new()
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,12 @@ mod wasmer_wasi {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_import_object(_args: Vec<Vec<u8>>, _envs: Vec<Vec<u8>>) -> ImportObject {
|
pub fn generate_import_object(
|
||||||
|
_args: Vec<Vec<u8>>,
|
||||||
|
_envs: Vec<Vec<u8>>,
|
||||||
|
_preopened_files: Vec<String>,
|
||||||
|
_mapped_dirs: Vec<(String, std::path::PathBuf)>,
|
||||||
|
) -> ImportObject {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -620,11 +625,14 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
|
|||||||
if let Err(ref err) = result {
|
if let Err(ref err) = result {
|
||||||
match err {
|
match err {
|
||||||
RuntimeError::Trap { msg } => panic!("wasm trap occured: {}", msg),
|
RuntimeError::Trap { msg } => panic!("wasm trap occured: {}", msg),
|
||||||
|
#[cfg(feature = "wasi")]
|
||||||
RuntimeError::Error { data } => {
|
RuntimeError::Error { data } => {
|
||||||
if let Some(error_code) = data.downcast_ref::<wasmer_wasi::ExitCode>() {
|
if let Some(error_code) = data.downcast_ref::<wasmer_wasi::ExitCode>() {
|
||||||
std::process::exit(error_code.code as i32)
|
std::process::exit(error_code.code as i32)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(not(feature = "wasi"))]
|
||||||
|
RuntimeError::Error { .. } => (),
|
||||||
}
|
}
|
||||||
panic!("error: {:?}", err)
|
panic!("error: {:?}", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user