cranelift-wasm: support multi-value Wasm (#1049)

This commit introduces initial support for multi-value Wasm. Wasm blocks and
calls can now take and return an arbitrary number of values.

The encoding for multi-value blocks means that we need to keep the contents of
the "Types" section around when translating function bodies. To do this, we
introduce a `WasmTypesMap` type that maps the type indices to their parameters
and returns, construct it when parsing the "Types" section, and shepherd it
through a bunch of functions and methods when translating function bodies.
This commit is contained in:
Nick Fitzgerald
2019-10-02 12:40:35 -07:00
committed by GitHub
parent f9d802fb1d
commit 10be3e4ba8
30 changed files with 610 additions and 138 deletions

View File

@@ -113,6 +113,12 @@ fn add_enable_simd_flag<'a>() -> clap::Arg<'a, 'a> {
.help("Enable WASM's SIMD operations")
}
fn add_enable_multi_value<'a>() -> clap::Arg<'a, 'a> {
Arg::with_name("enable-multi-value")
.long("enable-multi-value")
.help("Enable WASM's multi-value support")
}
/// Returns a vector of clap value options and changes these options into a vector of strings
fn get_vec(argument_vec: Option<clap::Values>) -> Vec<String> {
let mut ret_vec: Vec<String> = Vec::new();
@@ -144,6 +150,7 @@ fn add_wasm_or_compile<'a>(cmd: &str) -> clap::App<'a, 'a> {
.arg(add_input_file_arg())
.arg(add_debug_flag())
.arg(add_enable_simd_flag())
.arg(add_enable_multi_value())
}
fn handle_debug_flag(debug: bool) {
@@ -304,6 +311,7 @@ fn main() {
rest_cmd.is_present("time-passes"),
rest_cmd.is_present("value-ranges"),
rest_cmd.is_present("enable-simd"),
rest_cmd.is_present("enable-multi-value"),
)
};