From 2af544de8bfe40bb7f13d05f5721f2505a74db0f Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Fri, 7 Feb 2020 14:47:55 -0800 Subject: [PATCH] Update to cranelift 0.58.0 and enable (but ignore) reference types and bulk memory tests (#926) * Update cranelift to 0.58.0 * Update `wasmprinter` dep to require 0.2.1 We already had it in the lock file, but this ensures we won't ever go back down. * Ensure that our error messages match `assert_invalid`'s The bulk of this work was done in https://github.com/bytecodealliance/wasmparser/pull/186 but now we can test it at the `wasmtime` level as well. Fixes #492 * Stop feeling guilty about not matching `assert_malformed` messages Remove the "TODO" and stop printing warning messages. These would just be busy work to implement, and getting all the messages the exact same relies on using the same structure as the spec interpreter's parser, which means that where you have a helper function and they don't, then things go wrong, and vice versa. Not worth it. Fixes #492 * Enable (but ignore) the reference-types proposal tests * Match test suite directly, instead of roundabout starts/endswith * Enable (but ignore) bulk memory operations proposal test suite --- Cargo.lock | 123 ++++++++++++--------- build.rs | 24 +++- crates/api/src/trampoline/func.rs | 12 +- crates/environ/Cargo.toml | 8 +- crates/environ/src/cache/tests.rs | 1 - crates/environ/src/cranelift.rs | 14 +-- crates/environ/src/func_environ.rs | 75 +++++++++++++ crates/fuzzing/Cargo.toml | 2 +- crates/jit/Cargo.toml | 10 +- crates/jit/src/compiler.rs | 12 +- crates/jit/src/trampoline.rs | 6 +- crates/lightbeam/Cargo.toml | 2 +- crates/lightbeam/src/translate_sections.rs | 2 +- crates/runtime/src/instance.rs | 2 +- crates/wast/src/wast.rs | 29 ++--- tests/wast_testsuites.rs | 10 +- 16 files changed, 221 insertions(+), 111 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e5f4ba09f7..e6e5f8b728 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,9 +2,9 @@ # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" +checksum = "5f56c476256dc249def911d6f7580b5fc7e875895b5d7ee88f5d602208035744" dependencies = [ "memchr", ] @@ -85,9 +85,9 @@ checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" [[package]] name = "backtrace" -version = "0.3.42" +version = "0.3.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b1549d804b6c73f4817df2ba073709e96e426f12987127c48e6745568c350b" +checksum = "7f80256bc78f67e7df7e36d77366f636ed976895d91fe2ab9efa3973e8fe8c4f" dependencies = [ "backtrace-sys", "cfg-if", @@ -332,25 +332,25 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.56.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dfb4890b4075d5c39a581c0cf6354b43c8f8273d232cbc2a5e6c7e0f1027edc" +checksum = "fd0f53d59dc9ab1c8ab68c991d8406b52b7a0aab0b15b05a3a6895579c4e5dd9" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.56.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7600b2e36e28ecb0872e803d794b05c7a000273af8f7ac7d7cc32362e082e647" +checksum = "0381a794836fb994c47006465d46d46be072483b667f36013d993b9895117fee" dependencies = [ "byteorder", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", "cranelift-entity", - "gimli", + "gimli 0.20.0", "log", "serde", "smallvec", @@ -360,9 +360,9 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.56.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e50e5d5ffd37ec65b347cfbc653d64d0593b0ef7ff1eaf159f9fe1e1947207" +checksum = "208c3c8d82bfef32a534c5020c6cfc3bc92f41388f1246b7bb98cf543331abaa" dependencies = [ "cranelift-codegen-shared", "cranelift-entity", @@ -370,24 +370,24 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.56.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc3de82e8bbd74f58dd8791c09cea215ba775f0bed780cbe4269ba3138848a51" +checksum = "ea048c456a517e56fd6df8f0e3947922897e6e6f61fbc5eb557a36c7b8ff6394" [[package]] name = "cranelift-entity" -version = "0.56.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35fd5d8705013678bdcd21d607b6fe70d6d5a8f8a954820cf16a19275331478c" +checksum = "0c8c7ed50812194c9e9de1fa39c77b39fc9ab48173d5e7ee88b25b6a8953e9b8" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.56.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c948841f008f5f147e9a7527e144e1014b979f77e4190ade8080070436dd208" +checksum = "21ceb931d9f919731df1b1ecdc716b5c66384b413a7f95909d1f45441ab9bef5" dependencies = [ "cranelift-codegen", "log", @@ -397,9 +397,9 @@ dependencies = [ [[package]] name = "cranelift-native" -version = "0.56.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9da354ffc3b9dd1c244eb23cc49048a7117bf685bc2a8fb5b3d4a3f6661d80" +checksum = "564ee82268bc25b914fcf331edfc2452f2d9ca34f976b187b4ca668beba250c8" dependencies = [ "cranelift-codegen", "raw-cpuid", @@ -408,9 +408,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.56.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f48052598a13f46fa6fe1490e460bd6c9c61e81823b2e527165566f8d76755a" +checksum = "de63e2271b374be5b07f359184e2126a08fb24d24a740cbc178b7e0107ddafa5" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -418,7 +418,7 @@ dependencies = [ "log", "serde", "thiserror", - "wasmparser 0.47.0", + "wasmparser 0.48.2", ] [[package]] @@ -705,6 +705,16 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "gimli" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81dd6190aad0f05ddbbf3245c54ed14ca4aa6dd32f22312b70d8f168c3e3e633" +dependencies = [ + "byteorder", + "indexmap", +] + [[package]] name = "glob" version = "0.3.0" @@ -826,9 +836,9 @@ checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" [[package]] name = "jobserver" -version = "0.1.19" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b06c1b455f1cf4269a8cfc320ab930a810e2375a42af5075eb8a8b36405ce0" +checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2" dependencies = [ "libc", ] @@ -1123,9 +1133,9 @@ dependencies = [ [[package]] name = "proc-macro-error" -version = "0.4.5" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b79a464461615532fcc8a6ed8296fa66cc12350c18460ab3f4594a6cee0fcb6" +checksum = "875077759af22fa20b610ad4471d8155b321c89c3f2785526c9839b099be4e0a" dependencies = [ "proc-macro-error-attr", "proc-macro2", @@ -1136,9 +1146,9 @@ dependencies = [ [[package]] name = "proc-macro-error-attr" -version = "0.4.5" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23832e5eae6bac56bbac190500eef1aaede63776b5cd131eaa4ee7fe120cd892" +checksum = "c5717d9fa2664351a01ed73ba5ef6df09c01a521cb42cb65a061432a826f3c7a" dependencies = [ "proc-macro2", "quote", @@ -1343,9 +1353,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.3.3" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5508c1941e4e7cb19965abef075d35a9a8b5cdf0846f30b4050e9b55dc55e87" +checksum = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8" dependencies = [ "aho-corasick", "memchr", @@ -1355,9 +1365,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e734e891f5b408a29efbf8309e656876276f49ab6a6ac208600b4419bd893d90" +checksum = "b28dfe3fe9badec5dbf0a79a9cccad2cfc2ab5484bdb3e44cbd1ae8b3ba2be06" [[package]] name = "region" @@ -1496,9 +1506,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.45" +version = "1.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab8f15f15d6c41a154c1b128a22f2dfabe350ef53c40953d84e36155c91192b" +checksum = "21b01d7f0288608a01dca632cf1df859df6fd6ffa885300fc275ce2ba6221953" dependencies = [ "itoa", "ryu", @@ -1525,9 +1535,9 @@ checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] name = "smallvec" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44e59e0c9fa00817912ae6e4e6e3c4fe04455e75699d06eedc7d85917ed8e8f4" +checksum = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" [[package]] name = "spin" @@ -1558,9 +1568,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df136b42d76b1fbea72e2ab3057343977b04b4a2e00836c3c7c0673829572713" +checksum = "a1bcbed7d48956fcbb5d80c6b95aedb553513de0a1b451ea92679d999c010e98" dependencies = [ "clap", "lazy_static", @@ -1569,9 +1579,9 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd50a87d2f7b8958055f3e73a963d78feaccca3836767a9069844e34b5b03c0a" +checksum = "095064aa1f5b94d14e635d0a5684cf140c43ae40a0fd990708d38f5d669e5f64" dependencies = [ "heck", "proc-macro-error", @@ -1593,9 +1603,9 @@ dependencies = [ [[package]] name = "syn-mid" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd3937748a7eccff61ba5b90af1a20dbf610858923a9192ea0ecb0cb77db1d0" +checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" dependencies = [ "proc-macro2", "quote", @@ -1670,18 +1680,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f357d1814b33bc2dc221243f8424104bfe72dbe911d5b71b3816a2dff1c977e" +checksum = "205684fd018ca14432b12cce6ea3d46763311a571c3d294e71ba3f01adcf1aad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb2e25d25307eb8436894f727aba8f65d07adf02e5b35a13cebed48bd282bfef" +checksum = "57e4d2e50ca050ed44fb58309bdce3efa79948f84f9993ad1978de5eebdce5a7" dependencies = [ "proc-macro2", "quote", @@ -1861,9 +1871,9 @@ checksum = "c702914acda5feeeffbc29e4d953e5b9ce79d8b98da4dbf18a77086e116c5470" [[package]] name = "wasmparser" -version = "0.47.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1add8db5a53a2f64f13418b241982c4ab533d7a9e1e8a5dcadccce633d8d393b" +checksum = "073da89bf1c84db000dd68ce660c1b4a08e3a2d28fd1e3394ab9e7abdde4a0f8" [[package]] name = "wasmparser" @@ -1947,7 +1957,7 @@ version = "0.9.0" dependencies = [ "anyhow", "faerie", - "gimli", + "gimli 0.19.0", "more-asserts", "target-lexicon", "thiserror", @@ -2142,6 +2152,15 @@ dependencies = [ "leb128", ] +[[package]] +name = "wast" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed3db7029d1d31a15c10126e78b58e51781faefafbc8afb20fb01291b779984" +dependencies = [ + "leb128", +] + [[package]] name = "wast" version = "7.0.0" @@ -2153,11 +2172,11 @@ dependencies = [ [[package]] name = "wat" -version = "1.0.8" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5795e34a4b39893653dec97e644fac85c31398e0ce1abecc48967aac83d9e8ce" +checksum = "9d59ba5b224f5507d55e4f89d0b18cc6452d84640ab11b4c9086d61a3ee62d03" dependencies = [ - "wast 7.0.0", + "wast 6.0.0", ] [[package]] diff --git a/build.rs b/build.rs index 9d19675915..0678bdc9aa 100644 --- a/build.rs +++ b/build.rs @@ -40,6 +40,20 @@ fn main() -> anyhow::Result<()> { strategy, ) .expect("generating tests"); + + test_directory( + &mut out, + "tests/spec_testsuite/proposals/reference-types", + strategy, + ) + .expect("generating tests"); + + test_directory( + &mut out, + "tests/spec_testsuite/proposals/bulk-memory-operations", + strategy, + ) + .expect("generating tests"); } else { println!( "cargo:warning=The spec testsuite is disabled. To enable, run `git submodule \ @@ -145,8 +159,10 @@ fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool { match strategy { #[cfg(feature = "lightbeam")] "Lightbeam" => match (testsuite, testname) { - (_, _) if testname.starts_with("simd") => return true, - (_, _) if testsuite.ends_with("multi_value") => return true, + ("simd", _) => return true, + ("multi_value", _) => return true, + ("reference_types", _) => return true, + ("bulk_memory_operations", _) => return true, // Lightbeam doesn't support float arguments on the stack. ("spec_testsuite", "call") => return true, _ => (), @@ -163,6 +179,10 @@ fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool { ("simd", "simd_load_extend") => return true, // FIXME Unsupported feature: proposed SIMD operator I16x8Load8x8S { memarg: MemoryImmediate { flags: 0, offset: 0 } } ("simd", "simd_load_splat") => return true, // FIXME Unsupported feature: proposed SIMD operator V8x16LoadSplat { memarg: MemoryImmediate { flags: 0, offset: 0 } } ("simd", "simd_splat") => return true, // FIXME Unsupported feature: proposed SIMD operator I8x16ShrS + + ("reference_types", _) => return true, + ("bulk_memory_operations", _) => return true, + _ => {} }, _ => panic!("unrecognized strategy"), diff --git a/crates/api/src/trampoline/func.rs b/crates/api/src/trampoline/func.rs index 5076a2f9b2..c76dbc49b7 100644 --- a/crates/api/src/trampoline/func.rs +++ b/crates/api/src/trampoline/func.rs @@ -159,9 +159,9 @@ fn make_trampoline( { let mut builder = FunctionBuilder::new(&mut context.func, fn_builder_ctx); - let block0 = builder.create_ebb(); + let block0 = builder.create_block(); - builder.append_ebb_params_for_function_params(block0); + builder.append_block_params_for_function_params(block0); builder.switch_to_block(block0); builder.seal_block(block0); @@ -172,7 +172,7 @@ fn make_trampoline( continue; } - let val = builder.func.dfg.ebb_params(block0)[i]; + let val = builder.func.dfg.block_params(block0)[i]; builder.ins().store( mflags, val, @@ -181,9 +181,9 @@ fn make_trampoline( ); } - let ebb_params = builder.func.dfg.ebb_params(block0); - let vmctx_ptr_val = ebb_params[0]; - let caller_vmctx_ptr_val = ebb_params[1]; + let block_params = builder.func.dfg.block_params(block0); + let vmctx_ptr_val = block_params[0]; + let caller_vmctx_ptr_val = block_params[1]; let call_id_val = builder.ins().iconst(types::I32, call_id as i64); let callee_args = vec![ diff --git a/crates/environ/Cargo.toml b/crates/environ/Cargo.toml index 2f53823e64..262cca7bb6 100644 --- a/crates/environ/Cargo.toml +++ b/crates/environ/Cargo.toml @@ -13,9 +13,9 @@ edition = "2018" [dependencies] anyhow = "1.0" -cranelift-codegen = { version = "0.56", features = ["enable-serde"] } -cranelift-entity = { version = "0.56", features = ["enable-serde"] } -cranelift-wasm = { version = "0.56", features = ["enable-serde"] } +cranelift-codegen = { version = "0.58.0", features = ["enable-serde"] } +cranelift-entity = { version = "0.58.0", features = ["enable-serde"] } +cranelift-wasm = { version = "0.58.0", features = ["enable-serde"] } wasmparser = "0.51.0" lightbeam = { path = "../lightbeam", optional = true, version = "0.9.0" } indexmap = "1.0.2" @@ -44,7 +44,7 @@ tempfile = "3" target-lexicon = { version = "0.10.0", default-features = false } pretty_env_logger = "0.3.0" rand = { version = "0.7.0", default-features = false, features = ["small_rng"] } -cranelift-codegen = { version = "0.56", features = ["enable-serde", "all-arch"] } +cranelift-codegen = { version = "0.58.0", features = ["enable-serde", "all-arch"] } filetime = "0.2.7" lazy_static = "1.3.0" diff --git a/crates/environ/src/cache/tests.rs b/crates/environ/src/cache/tests.rs index 781cd4b529..1d80415514 100644 --- a/crates/environ/src/cache/tests.rs +++ b/crates/environ/src/cache/tests.rs @@ -317,7 +317,6 @@ fn new_module_cache_data(rng: &mut impl Rng) -> ModuleCacheData { size: rng.gen(), offset: rng.gen(), }); - slots.frame_size = rng.gen(); slots }) .collect(); diff --git a/crates/environ/src/cranelift.rs b/crates/environ/src/cranelift.rs index 6c48c353f1..d0d7d47d5c 100644 --- a/crates/environ/src/cranelift.rs +++ b/crates/environ/src/cranelift.rs @@ -30,14 +30,14 @@ pub struct RelocSink { } impl binemit::RelocSink for RelocSink { - fn reloc_ebb( + fn reloc_block( &mut self, _offset: binemit::CodeOffset, _reloc: binemit::Reloc, - _ebb_offset: binemit::CodeOffset, + _block_offset: binemit::CodeOffset, ) { // This should use the `offsets` field of `ir::Function`. - panic!("ebb headers not yet implemented"); + panic!("block headers not yet implemented"); } fn reloc_external( &mut self, @@ -134,12 +134,12 @@ fn get_function_address_map<'data>( let mut instructions = Vec::new(); let func = &context.func; - let mut ebbs = func.layout.ebbs().collect::>(); - ebbs.sort_by_key(|ebb| func.offsets[*ebb]); // Ensure inst offsets always increase + let mut blocks = func.layout.blocks().collect::>(); + blocks.sort_by_key(|block| func.offsets[*block]); // Ensure inst offsets always increase let encinfo = isa.encoding_info(); - for ebb in ebbs { - for (offset, inst, size) in func.inst_offsets(ebb, &encinfo) { + for block in blocks { + for (offset, inst, size) in func.inst_offsets(block, &encinfo) { let srcloc = func.srclocs[inst]; instructions.push(InstructionAddressMap { srcloc, diff --git a/crates/environ/src/func_environ.rs b/crates/environ/src/func_environ.rs index 9808907d1f..f8d2ba5ec6 100644 --- a/crates/environ/src/func_environ.rs +++ b/crates/environ/src/func_environ.rs @@ -425,6 +425,81 @@ impl<'module_environment> cranelift_wasm::FuncEnvironment for FuncEnvironment<'m })) } + fn translate_table_grow( + &mut self, + _: cranelift_codegen::cursor::FuncCursor<'_>, + _: u32, + _: ir::Value, + _: ir::Value, + ) -> WasmResult { + Err(WasmError::Unsupported( + "the `table.grow` instruction is not supported yet".into(), + )) + } + + fn translate_table_get( + &mut self, + _: cranelift_codegen::cursor::FuncCursor<'_>, + _: u32, + _: ir::Value, + ) -> WasmResult { + Err(WasmError::Unsupported( + "the `table.get` instruction is not supported yet".into(), + )) + } + + fn translate_table_set( + &mut self, + _: cranelift_codegen::cursor::FuncCursor<'_>, + _: u32, + _: ir::Value, + _: ir::Value, + ) -> WasmResult<()> { + Err(WasmError::Unsupported( + "the `table.set` instruction is not supported yet".into(), + )) + } + + fn translate_table_fill( + &mut self, + _: cranelift_codegen::cursor::FuncCursor<'_>, + _: u32, + _: ir::Value, + _: ir::Value, + _: ir::Value, + ) -> WasmResult<()> { + Err(WasmError::Unsupported( + "the `table.fill` instruction is not supported yet".into(), + )) + } + + fn translate_ref_func( + &mut self, + _: cranelift_codegen::cursor::FuncCursor<'_>, + _: u32, + ) -> WasmResult { + Err(WasmError::Unsupported( + "the `ref.func` instruction is not supported yet".into(), + )) + } + + fn translate_custom_global_get( + &mut self, + _: cranelift_codegen::cursor::FuncCursor<'_>, + _: cranelift_wasm::GlobalIndex, + ) -> WasmResult { + unreachable!("we don't make any custom globals") + } + + fn translate_custom_global_set( + &mut self, + _: cranelift_codegen::cursor::FuncCursor<'_>, + _: cranelift_wasm::GlobalIndex, + _: ir::Value, + ) -> WasmResult<()> { + unreachable!("we don't make any custom globals") + } + fn make_heap(&mut self, func: &mut ir::Function, index: MemoryIndex) -> WasmResult { let pointer_type = self.pointer_type(); diff --git a/crates/fuzzing/Cargo.toml b/crates/fuzzing/Cargo.toml index 2ba90cd990..d8ebcddac1 100644 --- a/crates/fuzzing/Cargo.toml +++ b/crates/fuzzing/Cargo.toml @@ -13,7 +13,7 @@ binaryen = "0.10.0" env_logger = "0.7.1" log = "0.4.8" wasmparser = "0.51.0" -wasmprinter = "0.2.0" +wasmprinter = "0.2.1" wasmtime = { path = "../api", version = "0.9.0" } [dev-dependencies] diff --git a/crates/jit/Cargo.toml b/crates/jit/Cargo.toml index ce8e2b5868..2212663384 100644 --- a/crates/jit/Cargo.toml +++ b/crates/jit/Cargo.toml @@ -11,11 +11,11 @@ readme = "README.md" edition = "2018" [dependencies] -cranelift-codegen = { version = "0.56", features = ["enable-serde"] } -cranelift-entity = { version = "0.56", features = ["enable-serde"] } -cranelift-wasm = { version = "0.56", features = ["enable-serde"] } -cranelift-native = "0.56" -cranelift-frontend = "0.56" +cranelift-codegen = { version = "0.58.0", features = ["enable-serde"] } +cranelift-entity = { version = "0.58.0", features = ["enable-serde"] } +cranelift-wasm = { version = "0.58.0", features = ["enable-serde"] } +cranelift-native = "0.58.0" +cranelift-frontend = "0.58.0" wasmtime-environ = { path = "../environ", version = "0.9.0" } wasmtime-runtime = { path = "../runtime", version = "0.9.0" } wasmtime-debug = { path = "../debug", version = "0.9.0" } diff --git a/crates/jit/src/compiler.rs b/crates/jit/src/compiler.rs index bc519d9f5d..21a274eb23 100644 --- a/crates/jit/src/compiler.rs +++ b/crates/jit/src/compiler.rs @@ -281,14 +281,14 @@ fn make_trampoline( { let mut builder = FunctionBuilder::new(&mut context.func, fn_builder_ctx); - let block0 = builder.create_ebb(); + let block0 = builder.create_block(); - builder.append_ebb_params_for_function_params(block0); + builder.append_block_params_for_function_params(block0); builder.switch_to_block(block0); builder.seal_block(block0); let (vmctx_ptr_val, caller_vmctx_ptr_val, values_vec_ptr_val) = { - let params = builder.func.dfg.ebb_params(block0); + let params = builder.func.dfg.block_params(block0); (params[0], params[1], params[2]) }; @@ -412,13 +412,13 @@ fn register_traps( struct RelocSink {} impl binemit::RelocSink for RelocSink { - fn reloc_ebb( + fn reloc_block( &mut self, _offset: binemit::CodeOffset, _reloc: binemit::Reloc, - _ebb_offset: binemit::CodeOffset, + _block_offset: binemit::CodeOffset, ) { - panic!("trampoline compilation should not produce ebb relocs"); + panic!("trampoline compilation should not produce block relocs"); } fn reloc_external( &mut self, diff --git a/crates/jit/src/trampoline.rs b/crates/jit/src/trampoline.rs index 9e78bd5d43..8d32cd714d 100644 --- a/crates/jit/src/trampoline.rs +++ b/crates/jit/src/trampoline.rs @@ -20,13 +20,13 @@ pub mod binemit { pub struct TrampolineRelocSink {} impl binemit::RelocSink for TrampolineRelocSink { - fn reloc_ebb( + fn reloc_block( &mut self, _offset: binemit::CodeOffset, _reloc: binemit::Reloc, - _ebb_offset: binemit::CodeOffset, + _block_offset: binemit::CodeOffset, ) { - panic!("trampoline compilation should not produce ebb relocs"); + panic!("trampoline compilation should not produce block relocs"); } fn reloc_external( &mut self, diff --git a/crates/lightbeam/Cargo.toml b/crates/lightbeam/Cargo.toml index 9b88f8ed68..89221bbea8 100644 --- a/crates/lightbeam/Cargo.toml +++ b/crates/lightbeam/Cargo.toml @@ -19,7 +19,7 @@ memoffset = "0.5.3" itertools = "0.8.2" capstone = "0.6.0" thiserror = "1.0.9" -cranelift-codegen = "0.56" +cranelift-codegen = "0.58.0" multi_mut = "0.1" either = "1.5" typemap = "0.3" diff --git a/crates/lightbeam/src/translate_sections.rs b/crates/lightbeam/src/translate_sections.rs index 3c446e7f91..aaae78ba64 100644 --- a/crates/lightbeam/src/translate_sections.rs +++ b/crates/lightbeam/src/translate_sections.rs @@ -80,7 +80,7 @@ pub fn element(elements: ElementSectionReader) -> Result<(), Error> { struct UnimplementedRelocSink; impl binemit::RelocSink for UnimplementedRelocSink { - fn reloc_ebb(&mut self, _: binemit::CodeOffset, _: binemit::Reloc, _: binemit::CodeOffset) { + fn reloc_block(&mut self, _: binemit::CodeOffset, _: binemit::Reloc, _: binemit::CodeOffset) { unimplemented!() } diff --git a/crates/runtime/src/instance.rs b/crates/runtime/src/instance.rs index 7bfc5fe605..656b10ba74 100644 --- a/crates/runtime/src/instance.rs +++ b/crates/runtime/src/instance.rs @@ -1017,7 +1017,7 @@ fn initialize_globals(instance: &Instance) { *to = from; } GlobalInit::Import => panic!("locally-defined global initialized as import"), - GlobalInit::RefNullConst => unimplemented!(), + GlobalInit::RefNullConst | GlobalInit::RefFunc(_) => unimplemented!(), } } } diff --git a/crates/wast/src/wast.rs b/crates/wast/src/wast.rs index fa486f9b62..dff4bec0ed 100644 --- a/crates/wast/src/wast.rs +++ b/crates/wast/src/wast.rs @@ -288,36 +288,27 @@ impl WastContext { }; let error_message = format!("{:?}", err); if !error_message.contains(&message) { - // TODO: change to bail! - println!( - "assert_invalid: expected {}, got {}", - message, error_message + bail!( + "assert_invalid: expected \"{}\", got \"{}\"", + message, + error_message ) } } AssertMalformed { - span: _, module, - message, + span: _, + message: _, } => { let mut module = match module { wast::QuoteModule::Module(m) => m, - // this is a `*.wat` parser test which we're not - // interested in + // This is a `*.wat` parser test which we're not + // interested in. wast::QuoteModule::Quote(_) => return Ok(()), }; let bytes = module.encode()?; - let err = match self.module(None, &bytes) { - Ok(()) => bail!("expected module to fail to instantiate"), - Err(e) => e, - }; - let error_message = format!("{:?}", err); - if !error_message.contains(&message) { - // TODO: change to bail! - println!( - "assert_malformed: expected {}, got {}", - message, error_message - ) + if let Ok(_) = self.module(None, &bytes) { + bail!("expected malformed module to fail to instantiate"); } } AssertUnlinkable { diff --git a/tests/wast_testsuites.rs b/tests/wast_testsuites.rs index 02734add70..543bed9377 100644 --- a/tests/wast_testsuites.rs +++ b/tests/wast_testsuites.rs @@ -12,10 +12,16 @@ fn run_wast(wast: &str, strategy: Strategy) -> anyhow::Result<()> { let simd = wast.iter().any(|s| s == "simd"); + // Some simd tests assume support for multiple tables, which are introduced + // by reference types. + let reftypes = simd || wast.iter().any(|s| s == "reference-types"); + + let multi_val = wast.iter().any(|s| s == "multi-value"); + let mut cfg = Config::new(); cfg.wasm_simd(simd) - .wasm_reference_types(simd) // some simd tests assume multiple tables ok - .wasm_multi_value(wast.iter().any(|s| s == "multi-value")) + .wasm_reference_types(reftypes) + .wasm_multi_value(multi_val) .strategy(strategy)? .cranelift_debug_verifier(true); let store = Store::new(&Engine::new(&cfg));