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
@@ -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 {