Skip to content

Commit

Permalink
winch: Handle -W tail-call (#8447)
Browse files Browse the repository at this point in the history
Fixes #8446

The WebAssembly tail call proposal is currently not supported in Winch. This commit returns an error when trying to enable the tail call proposal while using Winch as the compiler. 

Even though the issue linked above doesn't make use of any of the tail instructions, the trampolines were generated using Cranelift's tail call calling convention.
  • Loading branch information
saulecabrera authored Apr 23, 2024
1 parent b4ecea3 commit 95ee0a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/cranelift/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ fn wasm_call_signature(
Architecture::S390x,
"https://github.com/bytecodealliance/wasmtime/issues/6530"
);

assert!(
!tunables.winch_callable,
"Winch doesn't support the WebAssembly tail call proposal",
);

CallConv::Tail
}

Expand Down
5 changes: 5 additions & 0 deletions crates/wasmtime/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1755,11 +1755,16 @@ impl Config {
Strategy::Cranelift => false,
Strategy::Winch => true,
};

if tunables.winch_callable && tunables.tail_callable {
bail!("Winch does not support the WebAssembly tail call proposal");
}
}

if tunables.static_memory_offset_guard_size < tunables.dynamic_memory_offset_guard_size {
bail!("static memory guard size cannot be smaller than dynamic memory guard size");
}

Ok(tunables)
}

Expand Down

0 comments on commit 95ee0a2

Please sign in to comment.