Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

add feature wasmtime-jitdump #9871

Merged
merged 12 commits into from
Sep 29, 2021
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bin/node/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ futures = "0.3.9"

[features]
wasmtime = ["sc-executor/wasmtime"]
wasmtime-jitdump = ["sc-executor/wasmtime-jitdump"]
wasmi-errno = ["sc-executor/wasmi-errno"]
stress-test = []

Expand Down
1 change: 1 addition & 0 deletions client/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ tempfile = "3.1.0"
wasmtime = [
"sc-service/wasmtime",
]
wasmtime-jitdump = ["sc-service/wasmtime-jitdump"]
1 change: 1 addition & 0 deletions client/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ default = ["std"]
std = []
wasm-extern-trace = []
wasmtime = ["sc-executor-wasmtime"]
wasmtime-jitdump = ["wasmtime", "sc-executor-wasmtime/jitdump"]
wasmi-errno = ["wasmi/errno"]
wasmer-sandbox = ["sc-executor-common/wasmer-sandbox"]
3 changes: 3 additions & 0 deletions client/executor/wasmtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ wasmtime = { version = "0.27.0", default-features = false, features = [
sc-runtime-test = { version = "2.0.0", path = "../runtime-test" }
sp-io = { version = "4.0.0-dev", path = "../../../primitives/io" }
wat = "1.0"

[features]
jitdump = ["wasmtime/jitdump"]
librelois marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions client/executor/wasmtime/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ directory = \"{cache_dir}\"
fn common_config(semantics: &Semantics) -> std::result::Result<wasmtime::Config, WasmError> {
let mut config = wasmtime::Config::new();
config.cranelift_opt_level(wasmtime::OptLevel::SpeedAndSize);
#[cfg(feature = "jitdump")]
if std::env::var("WASMTIME_PROFILING_STRATEGY") == Ok("jitdump".to_owned()) {
librelois marked this conversation as resolved.
Show resolved Hide resolved
config.profiler(wasmtime::ProfilingStrategy::JitDump).map_err(|e| {
WasmError::Instantiation(format!("fail to set jitdump profiler: {}", e))
})?;
}
config.cranelift_nan_canonicalization(semantics.canonicalize_nans);

if let Some(DeterministicStackLimit { native_stack_max, .. }) =
Expand Down
1 change: 1 addition & 0 deletions client/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ default = ["db"]
# a path to a database, an error will be produced at runtime.
db = ["sc-client-db/with-kvdb-rocksdb", "sc-client-db/with-parity-db"]
wasmtime = ["sc-executor/wasmtime"]
wasmtime-jitdump = ["sc-executor/wasmtime-jitdump"]
# exposes the client type
test-helpers = []

Expand Down