Use is_wasm_parameter in translating wasm calls (#1352)
* Use `is_wasm_parameter` in translating wasm calls Added in #1329 it's now possible for multiple parameters to be non-wasm parameters, so the previous `param_types` method is no longer suitable for acquiring all wasm-related parameters, rather then `FuncEnvironment` must be consulted. This removes usage of `param_types()` as a method from the wasm translation and instead adds a custom method inline for filtering the parameters based on `is_wasm_parameter`. * Apply feedback * Run rustfmt * Don't require `mut` * Run rustfmt
This commit is contained in:
committed by
Dan Gohman
parent
e1d513ab4b
commit
1266b68f9a
@@ -4,7 +4,7 @@
|
||||
//! function to Cranelift IR guided by a `FuncEnvironment` which provides information about the
|
||||
//! WebAssembly module and the runtime environment.
|
||||
|
||||
use crate::code_translator::{bitcast_arguments, translate_operator};
|
||||
use crate::code_translator::{bitcast_arguments, translate_operator, wasm_param_types};
|
||||
use crate::environ::{FuncEnvironment, ReturnMode, WasmResult};
|
||||
use crate::state::{FuncTranslationState, ModuleTranslationState};
|
||||
use crate::translation_utils::get_vmctx_value_label;
|
||||
@@ -245,7 +245,9 @@ fn parse_function_body<FE: FuncEnvironment + ?Sized>(
|
||||
if !builder.is_unreachable() {
|
||||
match environ.return_mode() {
|
||||
ReturnMode::NormalReturns => {
|
||||
let return_types = &builder.func.signature.return_types();
|
||||
let return_types = wasm_param_types(&builder.func.signature.returns, |i| {
|
||||
environ.is_wasm_return(&builder.func.signature, i)
|
||||
});
|
||||
bitcast_arguments(&mut state.stack, &return_types, builder);
|
||||
builder.ins().return_(&state.stack)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user