Correctly count the number of wasm parameters. (#1337)

* Correctly count the number of wasm parameters.

Following up on #1329, this further replaces `num_normal_params` with a function
which calls `is_wasm_parameter` to correctly count the number of wasm
parameters a function has.

* Move is_wasm_parameter's implementation into the trait.
This commit is contained in:
Dan Gohman
2020-01-14 11:42:22 -08:00
committed by GitHub
parent dd497c19e1
commit 1d504ecf6d
5 changed files with 18 additions and 18 deletions

View File

@@ -140,7 +140,9 @@ pub trait TargetEnvironment {
pub trait FuncEnvironment: TargetEnvironment {
/// Is the given parameter of the given function a wasm-level parameter, as opposed to a hidden
/// parameter added for use by the implementation?
fn is_wasm_parameter(&self, func: &ir::Function, index: usize) -> bool;
fn is_wasm_parameter(&self, signature: &ir::Signature, index: usize) -> bool {
signature.params[index].purpose == ir::ArgumentPurpose::Normal
}
/// Should the code be structured to use a single `fallthrough_return` instruction at the end
/// of the function body, rather than `return` instructions as needed? This is used by VMs