Bump wasmtime to 6.0.0 (#13429)

* Bump `wasmtime` to 6.0.0

* Disable cranelift egraphs
This commit is contained in:
Koute
2023-02-23 19:56:11 +09:00
committed by GitHub
parent 55ff791d80
commit 17e055e594
5 changed files with 71 additions and 50 deletions
@@ -19,13 +19,13 @@ log = "0.4.17"
# When bumping wasmtime do not forget to also bump rustix
# to exactly the same version as used by wasmtime!
wasmtime = { version = "5.0.0", default-features = false, features = [
wasmtime = { version = "6.0.0", default-features = false, features = [
"cache",
"cranelift",
"jitdump",
"parallel-compilation",
"pooling-allocator"
], git = "https://github.com/paritytech/wasmtime.git", branch = "v5.0.0_lto_fix" }
] }
anyhow = "1.0.68"
sc-allocator = { version = "4.1.0-dev", path = "../../allocator" }
sc-executor-common = { version = "0.10.0-dev", path = "../common" }
@@ -38,7 +38,7 @@ sp-wasm-interface = { version = "7.0.0", path = "../../../primitives/wasm-interf
# By default rustix directly calls the appropriate syscalls completely bypassing libc;
# this doesn't have any actual benefits for us besides making it harder to debug memory
# problems (since then `mmap` etc. cannot be easily hooked into).
rustix = { version = "0.36.0", default-features = false, features = ["std", "mm", "fs", "param", "use-libc"] }
rustix = { version = "0.36.7", default-features = false, features = ["std", "mm", "fs", "param", "use-libc"] }
once_cell = "1.12.0"
[dev-dependencies]
@@ -402,8 +402,7 @@ fn decommit_works() {
let code = wat::parse_str("(module (memory (export \"memory\") 1 4))").unwrap();
let module = wasmtime::Module::new(&engine, code).unwrap();
let linker = wasmtime::Linker::new(&engine);
let mut store = create_store(&engine, None);
let instance_pre = linker.instantiate_pre(&mut store, &module).unwrap();
let instance_pre = linker.instantiate_pre(&module).unwrap();
let mut wrapper = InstanceWrapper::new(&engine, &instance_pre, None).unwrap();
unsafe { *wrapper.memory.data_ptr(&wrapper.store) = 42 };
assert_eq!(unsafe { *wrapper.memory.data_ptr(&wrapper.store) }, 42);
@@ -298,6 +298,11 @@ fn common_config(semantics: &Semantics) -> std::result::Result<wasmtime::Config,
config.cranelift_opt_level(wasmtime::OptLevel::SpeedAndSize);
config.cranelift_nan_canonicalization(semantics.canonicalize_nans);
// Since wasmtime 6.0.0 the default for this is `true`, but that heavily regresses
// the contracts pallet's performance, so disable it for now.
#[allow(deprecated)]
config.cranelift_use_egraphs(false);
let profiler = match std::env::var_os("WASMTIME_PROFILING_STRATEGY") {
Some(os_string) if os_string == "jitdump" => wasmtime::ProfilingStrategy::JitDump,
None => wasmtime::ProfilingStrategy::None,
@@ -368,7 +373,7 @@ fn common_config(semantics: &Semantics) -> std::result::Result<wasmtime::Config,
let mut pooling_config = wasmtime::PoolingAllocationConfig::default();
pooling_config
.strategy(wasmtime::PoolingAllocationStrategy::ReuseAffinity)
.max_unused_warm_slots(4)
// Pooling needs a bunch of hard limits to be set; if we go over
// any of these then the instantiation will fail.
//
@@ -680,10 +685,8 @@ where
let mut linker = wasmtime::Linker::new(&engine);
crate::imports::prepare_imports::<H>(&mut linker, &module, config.allow_missing_func_imports)?;
let mut store =
crate::instance_wrapper::create_store(module.engine(), config.semantics.max_memory_size);
let instance_pre = linker
.instantiate_pre(&mut store, &module)
.instantiate_pre(&module)
.map_err(|e| WasmError::Other(format!("cannot preinstantiate module: {:#}", e)))?;
Ok(WasmtimeRuntime {