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

@@ -135,7 +135,7 @@ fn declare_wasm_parameters<FE: FuncEnvironment + ?Sized>(
let param_type = builder.func.signature.params[i];
// There may be additional special-purpose parameters in addition to the normal WebAssembly
// signature parameters. For example, a `vmctx` pointer.
if environ.is_wasm_parameter(&builder.func, i) {
if environ.is_wasm_parameter(&builder.func.signature, i) {
// This is a normal WebAssembly signature parameter, so create a local for it.
let local = Variable::new(next_local);
builder.declare_var(local, param_type.value_type);