From 92d9bff69495e74d42a640ddd2a12ea1540857bc Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 28 Jun 2022 20:03:16 -0700 Subject: [PATCH] Wasmtime: disable unwind_info unless needed fixes #4350 Otherwise wasm modules will be built with unwind info, even if backtraces are disabled. This can get expensive in deeply recursive modules. --- crates/wasmtime/src/config.rs | 2 ++ crates/wasmtime/src/engine.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs index b41ae9396f43..d2c905ea4872 100644 --- a/crates/wasmtime/src/config.rs +++ b/crates/wasmtime/src/config.rs @@ -1423,6 +1423,8 @@ impl Config { { bail!("compiler option 'unwind_info' must be enabled when either 'backtraces' or 'reference types' are enabled"); } + } else { + self.compiler_config.settings.insert("unwind_info", "false"); } if self.features.reference_types { if !self diff --git a/crates/wasmtime/src/engine.rs b/crates/wasmtime/src/engine.rs index 9dd637e7143f..b86e636da535 100644 --- a/crates/wasmtime/src/engine.rs +++ b/crates/wasmtime/src/engine.rs @@ -345,7 +345,6 @@ impl Engine { // can affect the way the generated code performs or behaves at // runtime. "avoid_div_traps" => *value == FlagValue::Bool(true), - "unwind_info" => *value == FlagValue::Bool(true), "libcall_call_conv" => *value == FlagValue::Enum("isa_default".into()), // Features wasmtime doesn't use should all be disabled, since @@ -381,6 +380,7 @@ impl Engine { | "enable_verifier" | "regalloc_checker" | "is_pic" + | "unwind_info" | "machine_code_cfg_info" | "tls_model" // wasmtime doesn't use tls right now | "opt_level" // opt level doesn't change semantics