Support for multi-value wasm (#399)
* deps: bump wasmparser to 0.39.2 This has a bug fix for multi-value Wasm validation that is required for getting the spec tests passing. https://github.com/yurydelendik/wasmparser.rs/pull/135 * Update cranelift to 0.46.1 to get multi-value Wasm support The `cranelift_wasm` APIs had to change a little bit to maintain state necessary when translating multi-value Wasm blocks. The `translate_module` function now returns a `ModuleTranslationState` that is borrowed during each function's translation. * Enable multi-value proposal's spec tests This enables all the Wasm multi-value proposal's spec tests other than the ones that rely on functions having more return values than registers available on the target. That is not supported by cranelift yet. * wasmtime-interface-types: always use multi-value Wasm And remove the return pointer hacks that work around the lack of multi-value.
This commit is contained in:
committed by
Dan Gohman
parent
9d54f84a32
commit
842faf5aa6
28
build.rs
28
build.rs
@@ -37,6 +37,12 @@ fn main() {
|
||||
strategy,
|
||||
)
|
||||
.expect("generating tests");
|
||||
|
||||
let multi_value_suite = Path::new("spec_testsuite")
|
||||
.join("proposals")
|
||||
.join("multi-value");
|
||||
let multi_value_suite = multi_value_suite.display().to_string();
|
||||
test_directory(&mut out, &multi_value_suite, strategy).expect("generating tests");
|
||||
} else {
|
||||
println!("cargo:warning=The spec testsuite is disabled. To enable, run `git submodule update --remote`.");
|
||||
}
|
||||
@@ -94,7 +100,8 @@ fn start_test_module(out: &mut File, testsuite: &str) -> io::Result<()> {
|
||||
.expect("testsuite filename should have a stem")
|
||||
.to_str()
|
||||
.expect("testsuite filename should be representable as a string")
|
||||
.replace("-", "_"),
|
||||
.replace("-", "_")
|
||||
.replace("/", "_")
|
||||
)?;
|
||||
writeln!(
|
||||
out,
|
||||
@@ -131,7 +138,8 @@ fn write_testsuite_tests(
|
||||
)?;
|
||||
writeln!(
|
||||
out,
|
||||
" let features = Features {{ simd: true, ..Default::default() }};"
|
||||
" let features = Features {{ simd: true, multi_value: {}, ..Default::default() }};",
|
||||
testsuite.contains("multi-value")
|
||||
)?;
|
||||
writeln!(
|
||||
out,
|
||||
@@ -159,18 +167,32 @@ fn write_testsuite_tests(
|
||||
|
||||
/// Ignore tests that aren't supported yet.
|
||||
fn ignore(testsuite: &str, name: &str, strategy: &str) -> bool {
|
||||
let is_multi_value = testsuite.ends_with("multi-value");
|
||||
match strategy {
|
||||
#[cfg(feature = "lightbeam")]
|
||||
"Lightbeam" => match (testsuite, name) {
|
||||
("single_file_spec_test", "simd_const") => return true,
|
||||
(_, _) if is_multi_value => return true,
|
||||
_ => (),
|
||||
},
|
||||
"Cranelift" => {}
|
||||
"Cranelift" => match (testsuite, name) {
|
||||
// We don't currently support more return values than available
|
||||
// registers, and this contains a function with many, many more
|
||||
// return values than that.
|
||||
(_, "func") if is_multi_value => return true,
|
||||
_ => {}
|
||||
},
|
||||
_ => panic!("unrecognized strategy"),
|
||||
}
|
||||
|
||||
if cfg!(windows) {
|
||||
return match (testsuite, name) {
|
||||
// Currently, our multi-value support only works with however many
|
||||
// extra return registers we have available, and windows' fastcall
|
||||
// ABI only has a single return register, so we need to wait on full
|
||||
// multi-value support in Cranelift.
|
||||
(_, _) if is_multi_value => true,
|
||||
|
||||
("spec_testsuite", "address") => true,
|
||||
("spec_testsuite", "align") => true,
|
||||
("spec_testsuite", "call") => true,
|
||||
|
||||
Reference in New Issue
Block a user