Skip to content

Commit

Permalink
Wasmtime: disable unwind_info unless needed
Browse files Browse the repository at this point in the history
fixes #4350

Otherwise wasm modules will be built with unwind info, even if
backtraces are disabled. This can get expensive in deeply recursive
modules.
  • Loading branch information
Stebalien committed Jun 29, 2022
1 parent 2034c8a commit 4f609f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions crates/wasmtime/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,10 @@ 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".to_string(), "false".to_string());
}
if self.features.reference_types {
if !self
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmtime/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4f609f7

Please sign in to comment.