diff --git a/.circleci/config.yml b/.circleci/config.yml index 7871bf516..5f22b9464 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,6 @@ jobs: keys: - v4-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }} - run: sudo apt-get install -y cmake - - run: rustup default nightly-2018-10-07 - run: make test - run: command: | @@ -50,9 +49,9 @@ jobs: tar xf cmake-3.4.1-Darwin-x86_64.tar.gz export PATH="`pwd`/cmake-3.4.1-Darwin-x86_64/CMake.app/Contents/bin:$PATH" - run: - name: Install Rust Nightly + name: Install Rust command: | - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2018-10-07 + curl https://sh.rustup.rs -sSf | sh -s -- -y export PATH="$HOME/.cargo/bin:$PATH" cargo --version - run: diff --git a/Cargo.lock b/Cargo.lock index 0b0d6a774..0dd4135eb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -238,6 +238,11 @@ dependencies = [ "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "libc" +version = "0.2.43" +source = "git+https://github.com/rust-lang/libc#5cc006652a242c35b6fe5b615ccd39d9356a2346" + [[package]] name = "libc" version = "0.2.43" @@ -436,11 +441,6 @@ dependencies = [ "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "spin" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "strsim" version = "0.7.0" @@ -578,18 +578,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wabt" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", - "wabt-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wabt-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wabt-sys" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", @@ -606,18 +606,17 @@ dependencies = [ "cranelift-wasm 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)", "docopt 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (git+https://github.com/rust-lang/libc)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "region 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", - "spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wabt 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wabt 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "wasmparser 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -679,6 +678,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" +"checksum libc 0.2.43 (git+https://github.com/rust-lang/libc)" = "" "checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" "checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f" "checksum mach 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2fd13ee2dd61cc82833ba05ade5a30bb3d63f7ced605ef827063c63078302de9" @@ -703,7 +703,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "84257ccd054dc351472528c8587b4de2dbf0dc0fe2e634030c1a90bfdacebaa9" "checksum serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "31569d901045afbff7a9479f793177fe9259819aff10ab4f89ef69bbc5f567fe" "checksum serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "43344e7ce05d0d8280c5940cabb4964bea626aa58b1ec0e8c73fa2a8512a38ce" -"checksum spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ceac490aa12c567115b40b7b7fceca03a6c9d53d5defea066123debc83c5dc1f" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum structopt 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ca85f2c9a5a1e2d5ac686fc0be48e40f8ad803f5bbe31f692ff71eb2dd8aad45" "checksum structopt-derive 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "1383e5db585da799a5c4acc496c5c868e18bf82e658c00c75cc91038fa26b55f" @@ -722,8 +721,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum wabt 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0768faf932f2898c0a7545edee648fefa716906a2e143009addf4959d2335a75" -"checksum wabt-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4aaa9a8fa0d698315da5611f3e113a1e688fbb8d6fa0dd9510dfa023f665e9dc" +"checksum wabt 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5b24b2494bd6077dff717f41523f6e3e0161d58f578198589a6a6c8b314cb763" +"checksum wabt-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "122aefe1d22c067cce1dc5d20d89d1ca47ce0eb10120246a3e2340863f9e6ddd" "checksum wasmparser 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc6511bad33610d7798f80d48e10495a6eb4f1e39306b0bb340b2de0816c4ca" "checksum wasmparser 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a75e0c3fe9a4d4fd91901348a5be05ba4791e29dda89e8596bfe87900ba7edc" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" diff --git a/Cargo.toml b/Cargo.toml index 4a673b868..892d7c215 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "wasmer" version = "0.1.0" authors = ["Syrus Akbary "] -edition = "2018" +# edition = "2018" repository = "https://github.com/wafoundation/wasmer" publish = true description = "High-Performance WebAssembly JIT interpreter" @@ -34,18 +34,19 @@ serde_derive = "1.0.55" tempdir = "0.3.7" error-chain = "0.12.0" structopt = "0.2.11" -wabt = "0.6.0" +wabt = "0.7.1" wasmparser = "0.20.0" region = "0.3.0" memmap = "0.6.2" -spin = "0.4.10" +# spin = "0.4.10" log = "0.4.5" target-lexicon = { version = "0.0.3", default-features = false } -libc = "0.2" +# libc = "0.2" +libc = { git = "https://github.com/rust-lang/libc" } nix = "0.11" [build-dependencies] -wabt = "0.6.0" +wabt = "0.7.1" # [dev-dependencies] # libffi = "0.6.4" diff --git a/README.md b/README.md index ba9b63665..b80140ad7 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,6 @@ To build this project you will need Rust and Cargo. git clone https://github.com/wafoundation/wasmer.git cd wasmer -# Use rust nightly (we use 2018-10-07 as latest are failing) -rustup default nightly-2018-10-07 - # install tools # make sure that `python` is accessible. cargo install @@ -44,7 +41,7 @@ Thanks to [spectests](https://github.com/WAFoundation/wasmer/tree/master/spectes Tests can be run with: ```sh -cargo test +make test ``` If you need to re-generate the Rust tests from the spectests diff --git a/examples/pypyjs.wasm b/examples/pypyjs.wasm new file mode 100644 index 000000000..8f25bb5ad Binary files /dev/null and b/examples/pypyjs.wasm differ diff --git a/examples/trap.wat b/examples/trap.wat new file mode 100644 index 000000000..789073b09 --- /dev/null +++ b/examples/trap.wat @@ -0,0 +1,5 @@ +(module + (func $main (export "main") (result i32) + (i32.div_s (i32.const 0) (i32.const 0)) + ) +) diff --git a/install.sh b/install.sh index a3743d84f..8f4fd5f82 100755 --- a/install.sh +++ b/install.sh @@ -227,22 +227,22 @@ wasmer_install() { printf "${reset}Installing Wasmer!$reset\n" printf " - ${magenta3}###${reset} - ${magenta3}#####${reset} - ${magenta2}### ${magenta3}######${reset} - ${magenta2}###### ${magenta3}#############${reset} - ${magenta1}#${magenta2} ####### ${magenta3}##############${reset} - ${magenta1}#####${magenta2} #############${magenta3}#########${reset} + ${magenta1} ${magenta2} ${magenta3}###${reset} + ${magenta1} ${magenta2} ${magenta3}#####${reset} + ${magenta1} ${magenta2}### ${magenta3}######${reset} + ${magenta1} ${magenta2}###### ${magenta3}#############${reset} + ${magenta1}# ${magenta2}####### ${magenta3}##############${reset} + ${magenta1}##### ${magenta2}#############${magenta3}#########${reset} ${magenta1}######${magenta2}###############${magenta3}#######${reset} ${magenta1}############${magenta2}#########${magenta3}#######${reset} ${magenta1}##############${magenta2}#######${magenta3}#######${reset} ${magenta1}##############${magenta2}#######${magenta3}#######${reset} ${magenta1}##############${magenta2}#######${magenta3}#######${reset} - ${magenta1}##############${magenta2}####### ${magenta3}###${reset} + ${magenta1}##############${magenta2}#######${magenta3} ###${reset} ${magenta1}##############${magenta2}####### ${magenta1}###########${magenta2} ### ${magenta1}########${magenta2} - ${magenta1}####${reset} + ${magenta1}####${reset} " # if [ -d "$HOME/.wasmer" ]; then diff --git a/src/build_spectests.rs b/src/build_spectests.rs index 3ea83d240..3f9616d68 100644 --- a/src/build_spectests.rs +++ b/src/build_spectests.rs @@ -1,6 +1,8 @@ //! This file will run at build time to autogenerate Rust tests based on //! WebAssembly spec tests. It will convert the files indicated in TESTS //! from "/spectests/{MODULE}.wast" to "/src/spectests/{MODULE}.rs". +extern crate wabt; + use std::collections::HashMap; use std::env; use std::fs; @@ -206,8 +208,7 @@ fn test_module_{}() {{ module, module, calls.join("\n ") - ) - .as_str(), + ).as_str(), ); } self.module_calls.remove(&module); @@ -216,7 +217,8 @@ fn test_module_{}() {{ fn visit_module(&mut self, module: &ModuleBinary, _name: &Option) { let wasm_binary: Vec = module.clone().into_vec(); let wast_string = wasm2wat(wasm_binary).expect("Can't convert back to wasm"); - self.flush_module_calls(self.last_module); + let last_module = self.last_module; + self.flush_module_calls(last_module); self.last_module = self.last_module + 1; // self.module_calls.insert(self.last_module, vec![]); self.buffer.push_str( @@ -232,8 +234,7 @@ fn test_module_{}() {{ .replace("\n", "\n ") .replace("\\", "\\\\") .replace("\"", "\\\""), - ) - .as_str(), + ).as_str(), ); // We set the start call to the module @@ -244,8 +245,7 @@ fn test_module_{}() {{ result_object.instance.start(); }}\n", start_module_call - ) - .as_str(), + ).as_str(), ); self.module_calls .entry(self.last_module) @@ -256,6 +256,7 @@ fn test_module_{}() {{ fn visit_assert_invalid(&mut self, module: &ModuleBinary) { let wasm_binary: Vec = module.clone().into_vec(); // let wast_string = wasm2wat(wasm_binary).expect("Can't convert back to wasm"); + let command_name = self.command_name(); self.buffer.push_str( format!( "#[test] @@ -264,13 +265,12 @@ fn {}_assert_invalid() {{ let compilation = compile(wasm_binary.to_vec()); assert!(compilation.is_err(), \"WASM should not compile as is invalid\"); }}\n", - self.command_name(), + command_name, wasm_binary, // We do this to ident four spaces back // String::from_utf8_lossy(&wasm_binary), // wast_string.replace("\n", "\n "), - ) - .as_str(), + ).as_str(), ); } @@ -312,8 +312,7 @@ fn {}_assert_invalid() {{ func_return, args_values.join(", "), assertion, - ) - .as_str(), + ).as_str(), ); self.module_calls .entry(self.last_module) @@ -370,8 +369,7 @@ fn {}_assert_invalid() {{ func_return, args_values.join(", "), assertion, - ) - .as_str(), + ).as_str(), ); self.module_calls .entry(self.last_module) @@ -386,6 +384,7 @@ fn {}_assert_invalid() {{ fn visit_assert_malformed(&mut self, module: &ModuleBinary) { let wasm_binary: Vec = module.clone().into_vec(); + let command_name = self.command_name(); // let wast_string = wasm2wat(wasm_binary).expect("Can't convert back to wasm"); self.buffer.push_str( format!( @@ -395,13 +394,12 @@ fn {}_assert_malformed() {{ let compilation = compile(wasm_binary.to_vec()); assert!(compilation.is_err(), \"WASM should not compile as is malformed\"); }}\n", - self.command_name(), + command_name, wasm_binary, // We do this to ident four spaces back // String::from_utf8_lossy(&wasm_binary), // wast_string.replace("\n", "\n "), - ) - .as_str(), + ).as_str(), ); } @@ -465,8 +463,7 @@ fn {}_assert_malformed() {{ func_return, args_values.join(", "), assertion, - ) - .as_str(), + ).as_str(), ); Some(func_name) // let mut module_calls = self.module_calls.get(&self.last_module).unwrap(); @@ -521,8 +518,7 @@ fn {}() {{ trap_func_name, self.last_module, action_fn_name.unwrap(), - ) - .as_str(), + ).as_str(), ); // We don't group trap calls as they may cause memory faults diff --git a/src/linkers/emscripten/abort.rs b/src/linkers/emscripten/abort.rs index bb4cfa117..e2662bd19 100644 --- a/src/linkers/emscripten/abort.rs +++ b/src/linkers/emscripten/abort.rs @@ -1,9 +1,7 @@ - use crate::webassembly::Instance; use std::process; - pub extern "C" fn abort(_code: i32, _instance: &Instance) { process::abort(); // abort!("Aborted") -} \ No newline at end of file +} diff --git a/src/linkers/emscripten/mod.rs b/src/linkers/emscripten/mod.rs index 5994b4c77..64d1e4037 100644 --- a/src/linkers/emscripten/mod.rs +++ b/src/linkers/emscripten/mod.rs @@ -1,8 +1,8 @@ use crate::webassembly::{ImportObject, ImportValue}; +mod abort; mod printf; mod putchar; -mod abort; pub fn generate_emscripten_env<'a, 'b>() -> ImportObject<&'a str, &'b str> { let mut import_object = ImportObject::new(); diff --git a/src/linkers/mod.rs b/src/linkers/mod.rs index c21b7bcbd..ef78d9e06 100644 --- a/src/linkers/mod.rs +++ b/src/linkers/mod.rs @@ -1,4 +1,3 @@ - pub mod emscripten; pub use self::emscripten::generate_emscripten_env; diff --git a/src/main.rs b/src/main.rs index ea6bb04be..bb181aecf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,19 +1,19 @@ -#![feature(test, libc, core_intrinsics)] - -extern crate test; #[macro_use] extern crate error_chain; extern crate cranelift_codegen; extern crate cranelift_entity; extern crate cranelift_native; extern crate cranelift_wasm; +extern crate libc; +extern crate memmap; +extern crate region; extern crate structopt; extern crate wabt; +extern crate wasmparser; #[macro_use] extern crate target_lexicon; extern crate nix; -extern crate spin; -use std::error::Error; + use std::fs::File; use std::io; use std::io::Read; @@ -21,7 +21,6 @@ use std::path::PathBuf; use std::process::exit; use structopt::StructOpt; -use wabt::wat2wasm; #[macro_use] mod macros; @@ -51,7 +50,7 @@ struct Run { } /// Read the contents of a file -fn read_file_contents(path: PathBuf) -> Result, io::Error> { +fn read_file_contents(path: &PathBuf) -> Result, io::Error> { let mut buffer: Vec = Vec::new(); let mut file = File::open(path)?; file.read_to_end(&mut buffer)?; @@ -60,16 +59,22 @@ fn read_file_contents(path: PathBuf) -> Result, io::Error> { /// Execute a WASM/WAT file fn execute_wasm(wasm_path: PathBuf) -> Result<(), String> { - let mut wasm_binary: Vec = - read_file_contents(wasm_path).map_err(|err| String::from(err.description()))?; + let mut wasm_binary: Vec = read_file_contents(&wasm_path).map_err(|err| { + format!( + "Can't read the file {}: {}", + wasm_path.as_os_str().to_string_lossy(), + err + ) + })?; if !webassembly::utils::is_wasm_binary(&wasm_binary) { - wasm_binary = wat2wasm(wasm_binary).map_err(|err| String::from(err.description()))?; + wasm_binary = wabt::wat2wasm(wasm_binary) + .map_err(|err| format!("Can't convert from wast to wasm: {:?}", err))?; } let import_object = linkers::generate_emscripten_env(); let webassembly::ResultObject { module, instance } = webassembly::instantiate(wasm_binary, import_object) - .map_err(|err| format!("{}", err))?; + .map_err(|err| format!("Can't instantiate the WebAssembly module: {}", err))?; webassembly::utils::print_instance_offsets(&instance); @@ -79,9 +84,8 @@ fn execute_wasm(wasm_path: PathBuf) -> Result<(), String> { Some(&webassembly::Export::Function(index)) => index, _ => panic!("Main function not found"), }); - let main: fn(&webassembly::Instance) -> i32 = get_instance_function!(instance, func_index); - let result = main(&instance); - println!("RESULT {}", result); + let main: fn(&webassembly::Instance) = get_instance_function!(instance, func_index); + main(&instance); Ok(()) } @@ -89,8 +93,8 @@ fn run(options: Run) { match execute_wasm(options.path.clone()) { Ok(()) => {} Err(message) => { - let name = options.path.as_os_str().to_string_lossy(); - println!("error while executing {}: {}", name, message); + // let name = options.path.as_os_str().to_string_lossy(); + println!("{}", message); exit(1); } } diff --git a/src/sighandler.rs b/src/sighandler.rs index 123487e94..d75fb179b 100644 --- a/src/sighandler.rs +++ b/src/sighandler.rs @@ -5,9 +5,11 @@ //! Please read more about this here: https://github.com/CraneStation/wasmtime/issues/15 //! This code is inspired by: https://github.com/pepyakin/wasmtime/commit/625a2b6c0815b21996e111da51b9664feb174622 use nix::sys::signal::{ - sigaction, SaFlags, SigAction, SigHandler, SigSet, SIGBUS, SIGFPE, SIGILL, SIGSEGV, + sigaction, SaFlags, SigAction, SigHandler, SigSet, Signal, SIGBUS, SIGFPE, SIGILL, SIGSEGV, }; +static mut SETJMP_BUFFER: [::nix::libc::c_int; 27] = [0; 27]; + pub unsafe fn install_sighandler() { let sa = SigAction::new( SigHandler::Handler(signal_trap_handler), @@ -18,22 +20,29 @@ pub unsafe fn install_sighandler() { sigaction(SIGILL, &sa).unwrap(); sigaction(SIGSEGV, &sa).unwrap(); sigaction(SIGBUS, &sa).unwrap(); - let result = setjmp((&mut SETJMP_BUFFER[..]).as_mut_ptr() as *mut ::nix::libc::c_void); - if result != 0 { - panic!("Signal Error: {}", result); + let signum = setjmp((&mut SETJMP_BUFFER[..]).as_mut_ptr() as *mut ::nix::libc::c_void); + if signum != 0 { + let signal = Signal::from_c_int(signum).unwrap(); + match signal { + SIGFPE => panic!("floating-point exception"), + SIGILL => panic!("illegal instruction"), + SIGSEGV => panic!("segmentation violation"), + SIGBUS => panic!("bus error"), + _ => panic!("signal error: {:?}", signal), + }; } } -static mut SETJMP_BUFFER: [::nix::libc::c_int; 27] = [0; 27]; extern "C" { fn setjmp(env: *mut ::nix::libc::c_void) -> ::nix::libc::c_int; fn longjmp(env: *mut ::nix::libc::c_void, val: ::nix::libc::c_int); } -extern "C" fn signal_trap_handler(_: ::nix::libc::c_int) { + +extern "C" fn signal_trap_handler(signum: ::nix::libc::c_int) { unsafe { longjmp( (&mut SETJMP_BUFFER).as_mut_ptr() as *mut ::nix::libc::c_void, - 3, + signum, ); } } diff --git a/src/spectests/address.rs b/src/spectests/address.rs index 7b25e5dc7..798ad4fb9 100644 --- a/src/spectests/address.rs +++ b/src/spectests/address.rs @@ -146,7 +146,7 @@ fn create_module_1() -> ResultObject { (export \"16u_bad\" (func 27)) (export \"16s_bad\" (func 28)) (export \"32_bad\" (func 29)) - (data (i32.const 0) \"abcdefghijklmnopqrstuvwxyz\")) + (data (;0;) (i32.const 0) \"abcdefghijklmnopqrstuvwxyz\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -1545,7 +1545,7 @@ fn create_module_2() -> ResultObject { (export \"32u_bad\" (func 39)) (export \"32s_bad\" (func 40)) (export \"64_bad\" (func 41)) - (data (i32.const 0) \"abcdefghijklmnopqrstuvwxyz\")) + (data (;0;) (i32.const 0) \"abcdefghijklmnopqrstuvwxyz\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -3260,7 +3260,7 @@ fn create_module_3() -> ResultObject { (export \"32_good4\" (func 3)) (export \"32_good5\" (func 4)) (export \"32_bad\" (func 5)) - (data (i32.const 0) \"\\00\\00\\00\\00\\00\\00\\a0\\7f\\01\\00\\d0\\7f\")) + (data (;0;) (i32.const 0) \"\\00\\00\\00\\00\\00\\00\\a0\\7f\\01\\00\\d0\\7f\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -3554,7 +3554,7 @@ fn create_module_4() -> ResultObject { (export \"64_good4\" (func 3)) (export \"64_good5\" (func 4)) (export \"64_bad\" (func 5)) - (data (i32.const 0) \"\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\f4\\7f\\01\\00\\00\\00\\00\\00\\fc\\7f\")) + (data (;0;) (i32.const 0) \"\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\f4\\7f\\01\\00\\00\\00\\00\\00\\fc\\7f\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/binary.rs b/src/spectests/binary.rs index e78a7bec5..319a4226d 100644 --- a/src/spectests/binary.rs +++ b/src/spectests/binary.rs @@ -519,7 +519,7 @@ fn test_module_14() { fn create_module_15() -> ResultObject { let module_str = "(module (memory (;0;) 0) - (data (i32.const 0) \"\")) + (data (;0;) (i32.const 0) \"\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -540,7 +540,7 @@ fn test_module_15() { fn create_module_16() -> ResultObject { let module_str = "(module (table (;0;) 0 anyfunc) - (elem (i32.const 0))) + (elem (;0;) (i32.const 0))) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/block.rs b/src/spectests/block.rs index cee2539a4..907e4fce0 100644 --- a/src/spectests/block.rs +++ b/src/spectests/block.rs @@ -530,7 +530,7 @@ fn create_module_1() -> ResultObject { (export \"break-repeated\" (func 41)) (export \"break-inner\" (func 42)) (export \"effects\" (func 43)) - (elem (i32.const 0) 19)) + (elem (;0;) (i32.const 0) 19)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/br.rs b/src/spectests/br.rs index 766caed03..003168ecc 100644 --- a/src/spectests/br.rs +++ b/src/spectests/br.rs @@ -562,7 +562,7 @@ fn create_module_1() -> ResultObject { (export \"nested-br_if-value-cond\" (func 58)) (export \"nested-br_table-value\" (func 59)) (export \"nested-br_table-value-index\" (func 60)) - (elem (i32.const 0) 30)) + (elem (;0;) (i32.const 0) 30)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/br_if.rs b/src/spectests/br_if.rs index 367f22073..7db30a060 100644 --- a/src/spectests/br_if.rs +++ b/src/spectests/br_if.rs @@ -574,7 +574,7 @@ fn create_module_1() -> ResultObject { (export \"nested-br_if-value-cond\" (func 51)) (export \"nested-br_table-value\" (func 52)) (export \"nested-br_table-value-index\" (func 53)) - (elem (i32.const 0) 36)) + (elem (;0;) (i32.const 0) 36)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/br_table.rs b/src/spectests/br_table.rs index f8dfd602f..2360563e2 100644 --- a/src/spectests/br_table.rs +++ b/src/spectests/br_table.rs @@ -781,7 +781,7 @@ fn create_module_1() -> ResultObject { (export \"nested-br_table-value\" (func 66)) (export \"nested-br_table-value-index\" (func 67)) (export \"nested-br_table-loop-block\" (func 68)) - (elem (i32.const 0) 37)) + (elem (;0;) (i32.const 0) 37)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/call.rs b/src/spectests/call.rs index b84730c94..d972bfb19 100644 --- a/src/spectests/call.rs +++ b/src/spectests/call.rs @@ -316,7 +316,7 @@ fn create_module_1() -> ResultObject { (export \"as-tee_local-value\" (func 51)) (export \"as-set_global-value\" (func 52)) (export \"as-load-operand\" (func 53)) - (elem (i32.const 0) 40)) + (elem (;0;) (i32.const 0) 40)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/call_indirect.rs b/src/spectests/call_indirect.rs index d053ce45a..2044ccfa5 100644 --- a/src/spectests/call_indirect.rs +++ b/src/spectests/call_indirect.rs @@ -512,7 +512,7 @@ fn create_module_1() -> ResultObject { (export \"as-tee_local-value\" (func 63)) (export \"as-set_global-value\" (func 64)) (export \"as-load-operand\" (func 65)) - (elem (i32.const 0) 0 1 2 3 4 5 6 7 10 8 11 9 35 36 43 44 45 46 47 12 13 14 15 37 38 39 40 41 42)) + (elem (;0;) (i32.const 0) 0 1 2 3 4 5 6 7 10 8 11 9 35 36 43 44 45 46 47 12 13 14 15 37 38 39 40 41 42)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/data.rs b/src/spectests/data.rs index 07d5998fe..7e93ef9cb 100644 --- a/src/spectests/data.rs +++ b/src/spectests/data.rs @@ -19,18 +19,18 @@ use super::_common::{ fn create_module_1() -> ResultObject { let module_str = "(module (memory (;0;) 1) - (data (i32.const 0) \"\") - (data (i32.const 1) \"abcd\") - (data (i32.const 0) \"\") - (data (i32.const 0) \"abc\") - (data (i32.const 0) \"\") - (data (i32.const 1) \"abcd\") - (data (i32.const 0) \"\") - (data (i32.const 0) \"abc\") - (data (i32.const 0) \"\") - (data (i32.const 1) \"abcd\") - (data (i32.const 0) \"\") - (data (i32.const 0) \"abc\")) + (data (;0;) (i32.const 0) \"\") + (data (;1;) (i32.const 1) \"abcd\") + (data (;2;) (i32.const 0) \"\") + (data (;3;) (i32.const 0) \"abc\") + (data (;4;) (i32.const 0) \"\") + (data (;5;) (i32.const 1) \"abcd\") + (data (;6;) (i32.const 0) \"\") + (data (;7;) (i32.const 0) \"abc\") + (data (;8;) (i32.const 0) \"\") + (data (;9;) (i32.const 1) \"abcd\") + (data (;10;) (i32.const 0) \"\") + (data (;11;) (i32.const 0) \"abc\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -51,7 +51,7 @@ fn test_module_1() { fn create_module_2() -> ResultObject { let module_str = "(module (memory (;0;) 1) - (data (i32.const 0) \"a\")) + (data (;0;) (i32.const 0) \"a\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -72,7 +72,7 @@ fn test_module_2() { fn create_module_3() -> ResultObject { let module_str = "(module (import \"spectest\" \"memory\" (memory (;0;) 1)) - (data (i32.const 0) \"a\")) + (data (;0;) (i32.const 0) \"a\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -93,11 +93,11 @@ fn test_module_3() { fn create_module_4() -> ResultObject { let module_str = "(module (memory (;0;) 1) - (data (i32.const 0) \"a\") - (data (i32.const 3) \"b\") - (data (i32.const 100) \"cde\") - (data (i32.const 5) \"x\") - (data (i32.const 3) \"c\")) + (data (;0;) (i32.const 0) \"a\") + (data (;1;) (i32.const 3) \"b\") + (data (;2;) (i32.const 100) \"cde\") + (data (;3;) (i32.const 5) \"x\") + (data (;4;) (i32.const 3) \"c\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -118,12 +118,12 @@ fn test_module_4() { fn create_module_5() -> ResultObject { let module_str = "(module (import \"spectest\" \"memory\" (memory (;0;) 1)) - (data (i32.const 0) \"a\") - (data (i32.const 1) \"b\") - (data (i32.const 2) \"cde\") - (data (i32.const 3) \"f\") - (data (i32.const 2) \"g\") - (data (i32.const 1) \"h\")) + (data (;0;) (i32.const 0) \"a\") + (data (;1;) (i32.const 1) \"b\") + (data (;2;) (i32.const 2) \"cde\") + (data (;3;) (i32.const 3) \"f\") + (data (;4;) (i32.const 2) \"g\") + (data (;5;) (i32.const 1) \"h\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -144,8 +144,8 @@ fn test_module_5() { fn create_module_6() -> ResultObject { let module_str = "(module (memory (;0;) 1) - (data (i32.const 0) \"a\") - (data (i32.const 65535) \"b\")) + (data (;0;) (i32.const 0) \"a\") + (data (;1;) (i32.const 65535) \"b\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -166,8 +166,8 @@ fn test_module_6() { fn create_module_7() -> ResultObject { let module_str = "(module (import \"spectest\" \"memory\" (memory (;0;) 1)) - (data (i32.const 0) \"a\") - (data (i32.const 65535) \"b\")) + (data (;0;) (i32.const 0) \"a\") + (data (;1;) (i32.const 65535) \"b\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -188,7 +188,7 @@ fn test_module_7() { fn create_module_8() -> ResultObject { let module_str = "(module (memory (;0;) 2) - (data (i32.const 131071) \"a\")) + (data (;0;) (i32.const 131071) \"a\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -209,7 +209,7 @@ fn test_module_8() { fn create_module_9() -> ResultObject { let module_str = "(module (memory (;0;) 0) - (data (i32.const 0) \"\")) + (data (;0;) (i32.const 0) \"\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -230,7 +230,7 @@ fn test_module_9() { fn create_module_10() -> ResultObject { let module_str = "(module (import \"spectest\" \"memory\" (memory (;0;) 0)) - (data (i32.const 0) \"\")) + (data (;0;) (i32.const 0) \"\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -251,7 +251,7 @@ fn test_module_10() { fn create_module_11() -> ResultObject { let module_str = "(module (memory (;0;) 0 0) - (data (i32.const 0) \"\")) + (data (;0;) (i32.const 0) \"\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -272,7 +272,7 @@ fn test_module_11() { fn create_module_12() -> ResultObject { let module_str = "(module (memory (;0;) 1) - (data (i32.const 65536) \"\")) + (data (;0;) (i32.const 65536) \"\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -293,7 +293,7 @@ fn test_module_12() { fn create_module_13() -> ResultObject { let module_str = "(module (memory (;0;) 0) - (data (i32.const 0) \"\")) + (data (;0;) (i32.const 0) \"\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -314,7 +314,7 @@ fn test_module_13() { fn create_module_14() -> ResultObject { let module_str = "(module (import \"spectest\" \"memory\" (memory (;0;) 0)) - (data (i32.const 0) \"\")) + (data (;0;) (i32.const 0) \"\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -335,7 +335,7 @@ fn test_module_14() { fn create_module_15() -> ResultObject { let module_str = "(module (memory (;0;) 0 0) - (data (i32.const 0) \"\")) + (data (;0;) (i32.const 0) \"\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -356,7 +356,7 @@ fn test_module_15() { fn create_module_16() -> ResultObject { let module_str = "(module (import \"spectest\" \"memory\" (memory (;0;) 0)) - (data (i32.const 0) \"a\")) + (data (;0;) (i32.const 0) \"a\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -377,7 +377,7 @@ fn test_module_16() { fn create_module_17() -> ResultObject { let module_str = "(module (import \"spectest\" \"memory\" (memory (;0;) 0 3)) - (data (i32.const 0) \"a\")) + (data (;0;) (i32.const 0) \"a\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -398,7 +398,7 @@ fn test_module_17() { fn create_module_18() -> ResultObject { let module_str = "(module (import \"spectest\" \"memory\" (memory (;0;) 0)) - (data (i32.const 1) \"a\")) + (data (;0;) (i32.const 1) \"a\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -419,7 +419,7 @@ fn test_module_18() { fn create_module_19() -> ResultObject { let module_str = "(module (import \"spectest\" \"memory\" (memory (;0;) 0 3)) - (data (i32.const 1) \"a\")) + (data (;0;) (i32.const 1) \"a\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/float_exprs.rs b/src/spectests/float_exprs.rs index c6fa817b2..54b4a5e65 100644 --- a/src/spectests/float_exprs.rs +++ b/src/spectests/float_exprs.rs @@ -9720,7 +9720,7 @@ fn create_module_60() -> ResultObject { (memory (;0;) 1 1) (export \"f32.simple_x4_sum\" (func 0)) (export \"f32.load\" (func 1)) - (data (i32.const 0) \"\\01\\00\\00\\00\\01\\00\\00\\80\\01\\00\\00\\00\\01\\00\\00\\80\\01\\00\\00\\00\\01\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\")) + (data (;0;) (i32.const 0) \"\\01\\00\\00\\00\\01\\00\\00\\80\\01\\00\\00\\00\\01\\00\\00\\80\\01\\00\\00\\00\\01\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -9859,7 +9859,7 @@ fn create_module_61() -> ResultObject { (memory (;0;) 1 1) (export \"f64.simple_x4_sum\" (func 0)) (export \"f64.load\" (func 1)) - (data (i32.const 0) \"\\01\\00\\00\\00\\00\\00\\00\\00\\01\\00\\00\\00\\00\\00\\00\\80\\01\\00\\00\\00\\00\\00\\00\\00\\01\\00\\00\\00\\00\\00\\00\\80\\01\\00\\00\\00\\00\\00\\00\\00\\01\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\")) + (data (;0;) (i32.const 0) \"\\01\\00\\00\\00\\00\\00\\00\\00\\01\\00\\00\\00\\00\\00\\00\\80\\01\\00\\00\\00\\00\\00\\00\\00\\01\\00\\00\\00\\00\\00\\00\\80\\01\\00\\00\\00\\00\\00\\00\\00\\01\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -10001,7 +10001,7 @@ fn create_module_62() -> ResultObject { (memory (;0;) 1 1) (export \"f32.kahan_sum\" (func 0)) (export \"f32.plain_sum\" (func 1)) - (data (i32.const 0) \"\\c4\\c5W$\\a5\\84\\c8\\0bm\\b8K.\\f2v\\17\\1c\\caJV\\1e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\\cb?Y\\9f\\d8F\\90\\dc\\ae/\\22\\f9\\e21\\89\\d9\\9c\\1cL\\d3\\a9JW\\84\\9c\\9f\\ea,<\\ae<\\c3\\1e\\8b\\e5N\\17\\01%\\db4F_\\15\\ea\\05\\0c|\\d9E\\8c\\19\\d0s\\8a\\96\\16\\ddD\\f9\\05\\b7[q\\b0\\e6!6_u\\89\\91su\\ab}\\ae\\d3s\\ec7\\c6\\eaUu\\ef\\ea\\ab\\8b{\\11\\dcm\\1a\\b2j\\c4%\\cf\\aa\\e3\\9fII\\89\\cb7\\9b\\0a\\a7\\01`p\\dc\\b7\\c8\\83\\e1B\\f5\\be\\adb\\94\\ad\\8d\\a1\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -10104,7 +10104,7 @@ fn create_module_63() -> ResultObject { (memory (;0;) 1 1) (export \"f64.kahan_sum\" (func 0)) (export \"f64.plain_sum\" (func 1)) - (data (i32.const 0) \"\\13\\05\\84B]\\a2,\\c6C\\dbU\\a9\\cd\\daU\\e3s\\fcX\\d6\\ba\\d5\\00\\fd\\835B\\88\\8b\\13]8JG\\0drs\\a1\\1a\\ef\\c4E\\17W\\d8\\c9F\\e0\\8dl\\e17p\\c8\\83[U^Z-s\\1eV\\c8\\e1mi\\14x\\0a\\8aZd:\\09\\c7\\a8\\87\\c5\\f0\\d3]\\e6\\03\\fc\\93\\be&\\ca\\d6\\a9\\91`\\bd\\b0\\ed\\ae\\f70~\\92:o\\a7Y\\8e\\aa}\\bfgX*T\\f8N\\fe\\ed5X\\a6Q\\bfB\\e5Kf'$m\\7fB-(\\92\\18\\ec\\08\\ae\\e7U\\da\\b1\\a6e\\a5rPG\\1b\\b8\\a9T\\d7\\a6\\06[\\0fBX\\83\\8a\\17\\82\\c6\\10C\\a0\\c0.m\\bcZ\\85Sr\\7f\\adD\\bc0I\\f2~H\\f4\\a2q\\d0\\13\\8e\\b3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3\\15F\\b1\\a5\\bc\\9d\\9e8\\15\\f1\\bd\\1b!\\aa\\f1\\82\\00\\95\\fc\\a7wG9\\a73C\\92\\d7R@K\\06\\81\\8a\\a0\\bd\\f1k\\99\\84B[\\e2;\\c5^\\12\\5c(M\\b6\\0eN\\c8\\5c\\e8\\01\\8a\\c5\\e7\\e4\\9dB\\ee]\\9c\\c4\\eb\\ebh\\09'\\92\\95\\9a\\11Ts\\c4\\12\\80\\fb}\\fe\\c5\\08`\\7f6A\\e0\\10\\ba\\d6+l\\f1\\b4\\17\\fe&4\\e3K\\f8\\a8\\e3\\91\\beO*\\fc\\da\\81\\b8\\e7\\fe\\d5&PG\\f3\\1ae2\\81\\e0\\05\\b8O21&\\00JS\\97\\c2\\c3\\0e.\\a1&T\\ab\\05\\8eV/}\\af\\22\\84h\\a5\\8b\\97\\f6\\a4\\fd\\a8\\ccuA\\96\\86\\fd'=)\\86\\8d\\7fL\\d4\\8esA\\f4\\1e\\e2\\ddX'\\97\\ce\\9c\\94\\cfz\\04/\\dc\\ed\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/float_memory.rs b/src/spectests/float_memory.rs index 1fb78183d..6573c18c0 100644 --- a/src/spectests/float_memory.rs +++ b/src/spectests/float_memory.rs @@ -45,7 +45,7 @@ fn create_module_1() -> ResultObject { (export \"f32.store\" (func 2)) (export \"i32.store\" (func 3)) (export \"reset\" (func 4)) - (data (i32.const 0) \"\\00\\00\\a0\\7f\")) + (data (;0;) (i32.const 0) \"\\00\\00\\a0\\7f\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -277,7 +277,7 @@ fn create_module_2() -> ResultObject { (export \"f64.store\" (func 2)) (export \"i64.store\" (func 3)) (export \"reset\" (func 4)) - (data (i32.const 0) \"\\00\\00\\00\\00\\00\\00\\f4\\7f\")) + (data (;0;) (i32.const 0) \"\\00\\00\\00\\00\\00\\00\\f4\\7f\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -509,7 +509,7 @@ fn create_module_3() -> ResultObject { (export \"f32.store\" (func 2)) (export \"i32.store\" (func 3)) (export \"reset\" (func 4)) - (data (i32.const 0) \"\\00\\00\\00\\a0\\7f\")) + (data (;0;) (i32.const 0) \"\\00\\00\\00\\a0\\7f\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -741,7 +741,7 @@ fn create_module_4() -> ResultObject { (export \"f64.store\" (func 2)) (export \"i64.store\" (func 3)) (export \"reset\" (func 4)) - (data (i32.const 0) \"\\00\\00\\00\\00\\00\\00\\00\\f4\\7f\")) + (data (;0;) (i32.const 0) \"\\00\\00\\00\\00\\00\\00\\00\\f4\\7f\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -973,7 +973,7 @@ fn create_module_5() -> ResultObject { (export \"f32.store\" (func 2)) (export \"i32.store\" (func 3)) (export \"reset\" (func 4)) - (data (i32.const 0) \"\\01\\00\\d0\\7f\")) + (data (;0;) (i32.const 0) \"\\01\\00\\d0\\7f\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -1205,7 +1205,7 @@ fn create_module_6() -> ResultObject { (export \"f64.store\" (func 2)) (export \"i64.store\" (func 3)) (export \"reset\" (func 4)) - (data (i32.const 0) \"\\01\\00\\00\\00\\00\\00\\fc\\7f\")) + (data (;0;) (i32.const 0) \"\\01\\00\\00\\00\\00\\00\\fc\\7f\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/func.rs b/src/spectests/func.rs index f661b4e0c..e51167191 100644 --- a/src/spectests/func.rs +++ b/src/spectests/func.rs @@ -1359,7 +1359,7 @@ fn create_module_3() -> ResultObject { (export \"signature-implicit-reused\" (func 8)) (export \"signature-explicit-duplicate\" (func 9)) (export \"signature-implicit-duplicate\" (func 10)) - (elem (i32.const 0) 4 2 1 4 0 5 6)) + (elem (;0;) (i32.const 0) 4 2 1 4 0 5 6)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/func_ptrs.rs b/src/spectests/func_ptrs.rs index fca94347a..dd6d12b08 100644 --- a/src/spectests/func_ptrs.rs +++ b/src/spectests/func_ptrs.rs @@ -194,7 +194,7 @@ fn create_module_2() -> ResultObject { (table (;0;) 7 7 anyfunc) (export \"callt\" (func 5)) (export \"callu\" (func 6)) - (elem (i32.const 0) 0 1 2 3 4 0 2)) + (elem (;0;) (i32.const 0) 0 1 2 3 4 0 2)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -533,7 +533,7 @@ fn create_module_3() -> ResultObject { call_indirect (type 0)) (table (;0;) 2 2 anyfunc) (export \"callt\" (func 2)) - (elem (i32.const 0) 0 1)) + (elem (;0;) (i32.const 0) 0 1)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/globals.rs b/src/spectests/globals.rs index c792450e4..53a35ded6 100644 --- a/src/spectests/globals.rs +++ b/src/spectests/globals.rs @@ -269,7 +269,7 @@ fn create_module_1() -> ResultObject { (export \"as-unary-operand\" (func 42)) (export \"as-binary-operand\" (func 43)) (export \"as-compare-operand\" (func 44)) - (elem (i32.const 0) 26)) + (elem (;0;) (i32.const 0) 26)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/if_.rs b/src/spectests/if_.rs index 688c82a35..e3f4f54b0 100644 --- a/src/spectests/if_.rs +++ b/src/spectests/if_.rs @@ -635,7 +635,7 @@ fn create_module_1() -> ResultObject { (export \"break-bare\" (func 36)) (export \"break-value\" (func 37)) (export \"effects\" (func 38)) - (elem (i32.const 0) 16)) + (elem (;0;) (i32.const 0) 16)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/left_to_right.rs b/src/spectests/left_to_right.rs index 1308d2635..af2bdbbb1 100644 --- a/src/spectests/left_to_right.rs +++ b/src/spectests/left_to_right.rs @@ -959,7 +959,7 @@ fn create_module_1() -> ResultObject { (export \"f64_select\" (func 127)) (export \"br_if\" (func 128)) (export \"br_table\" (func 129)) - (elem (i32.const 0) 0 1 2 3 4 5 6 7)) + (elem (;0;) (i32.const 0) 0 1 2 3 4 5 6 7)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/loop_.rs b/src/spectests/loop_.rs index 7597b5d3f..4c84b8a53 100644 --- a/src/spectests/loop_.rs +++ b/src/spectests/loop_.rs @@ -667,7 +667,7 @@ fn create_module_1() -> ResultObject { (export \"while\" (func 42)) (export \"for\" (func 43)) (export \"nesting\" (func 44)) - (elem (i32.const 0) 16)) + (elem (;0;) (i32.const 0) 16)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/memory.rs b/src/spectests/memory.rs index 262b0122b..20bcbf844 100644 --- a/src/spectests/memory.rs +++ b/src/spectests/memory.rs @@ -119,7 +119,7 @@ fn create_module_5() -> ResultObject { memory.size) (memory (;0;) 0 0) (export \"memsize\" (func 0)) - (data (i32.const 0) \"\")) + (data (;0;) (i32.const 0) \"\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -157,7 +157,7 @@ fn create_module_6() -> ResultObject { memory.size) (memory (;0;) 0 0) (export \"memsize\" (func 0)) - (data (i32.const 0) \"\")) + (data (;0;) (i32.const 0) \"\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -195,7 +195,7 @@ fn create_module_7() -> ResultObject { memory.size) (memory (;0;) 1 1) (export \"memsize\" (func 0)) - (data (i32.const 0) \"x\")) + (data (;0;) (i32.const 0) \"x\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/nop.rs b/src/spectests/nop.rs index 8be6c9fe7..80807428c 100644 --- a/src/spectests/nop.rs +++ b/src/spectests/nop.rs @@ -632,7 +632,7 @@ fn create_module_1() -> ResultObject { (export \"as-store-mid\" (func 80)) (export \"as-store-last\" (func 81)) (export \"as-store-everywhere\" (func 82)) - (elem (i32.const 0) 61)) + (elem (;0;) (i32.const 0) 61)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/return_.rs b/src/spectests/return_.rs index 9f3911b10..9c2e34971 100644 --- a/src/spectests/return_.rs +++ b/src/spectests/return_.rs @@ -412,7 +412,7 @@ fn create_module_1() -> ResultObject { (export \"as-compare-right\" (func 56)) (export \"as-convert-operand\" (func 57)) (export \"as-memory.grow-size\" (func 58)) - (elem (i32.const 0) 36)) + (elem (;0;) (i32.const 0) 36)) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/spectests/start.rs b/src/spectests/start.rs index 4bed85714..04b518d88 100644 --- a/src/spectests/start.rs +++ b/src/spectests/start.rs @@ -63,7 +63,7 @@ fn create_module_1() -> ResultObject { (export \"inc\" (func 0)) (export \"get\" (func 1)) (start 2) - (data (i32.const 0) \"A\")) + (data (;0;) (i32.const 0) \"A\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") @@ -169,7 +169,7 @@ fn create_module_2() -> ResultObject { (export \"inc\" (func 0)) (export \"get\" (func 1)) (start 2) - (data (i32.const 0) \"A\")) + (data (;0;) (i32.const 0) \"A\")) "; let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed"); instantiate(wasm_binary, spectest_importobject()).expect("WASM can't be instantiated") diff --git a/src/webassembly/instance.rs b/src/webassembly/instance.rs index 4238b9715..d7e8c6e53 100644 --- a/src/webassembly/instance.rs +++ b/src/webassembly/instance.rs @@ -24,6 +24,7 @@ use super::memory::LinearMemory; use super::module::Export; use super::module::Module; use super::relocation::{Reloc, RelocSink, RelocationType}; +use super::math_intrinsics; type TablesSlice = UncheckedSlice>; type MemoriesSlice = UncheckedSlice>; @@ -57,7 +58,7 @@ fn get_function_addr( let func_pointer = if index < len { import_functions[index] } else { - (&functions[func_index.index() - len]).as_ptr() + (functions[index - len]).as_ptr() }; func_pointer } @@ -119,9 +120,9 @@ pub struct InstanceOptions { pub mock_missing_imports: bool, } -extern fn mock_fn() -> i32 { - return 0; -} +// extern fn mock_fn() -> i32 { +// return 0; +// } impl Instance { pub const TABLES_OFFSET: usize = 0; // 0 on 64-bit | 0 on 32-bit @@ -134,7 +135,7 @@ impl Instance { pub fn new( module: &Module, import_object: ImportObject<&str, &str>, - options: InstanceOptions, + _options: InstanceOptions, ) -> Result { let mut tables: Vec> = Vec::new(); let mut memories: Vec = Vec::new(); @@ -244,28 +245,28 @@ impl Instance { grow_memory as isize }, RelocationType::LibCall(LibCall::CeilF32) => { - _ceilf32 as isize + math_intrinsics::ceilf32 as isize }, RelocationType::LibCall(LibCall::FloorF32) => { - _floorf32 as isize + math_intrinsics::floorf32 as isize }, RelocationType::LibCall(LibCall::TruncF32) => { - _truncf32 as isize + math_intrinsics::truncf32 as isize }, RelocationType::LibCall(LibCall::NearestF32) => { - _nearbyintf32 as isize + math_intrinsics::nearbyintf32 as isize }, RelocationType::LibCall(LibCall::CeilF64) => { - _ceilf64 as isize + math_intrinsics::ceilf64 as isize }, RelocationType::LibCall(LibCall::FloorF64) => { - _floorf64 as isize + math_intrinsics::floorf64 as isize }, RelocationType::LibCall(LibCall::TruncF64) => { - _truncf64 as isize + math_intrinsics::truncf64 as isize }, RelocationType::LibCall(LibCall::NearestF64) => { - _nearbyintf64 as isize + math_intrinsics::nearbyintf64 as isize }, _ => unimplemented!() // RelocationType::Intrinsic(name) => { @@ -297,7 +298,7 @@ impl Instance { } // Looping through and getting the imported objects - for (key, value) in import_object.map { + for (_key, value) in import_object.map { match value { ImportValue::Memory(value) => imported_memories.push(value), @@ -420,7 +421,7 @@ impl Instance { .info .start_func .or_else(|| match module.info.exports.get("main") { - Some(Export::Function(index)) => Some(index.to_owned()), + Some(Export::Function(index)) => Some(*index), _ => None, }); @@ -522,44 +523,3 @@ extern "C" fn current_memory(memory_index: u32, instance: &mut Instance) -> u32 let memory = &instance.memories[memory_index as usize]; memory.current_size() as u32 } - -// Because of this bug https://github.com/rust-lang/rust/issues/34123 -// We create internal functions for it - -use std::intrinsics::{ - ceilf32, ceilf64, floorf32, floorf64, nearbyintf32, nearbyintf64, truncf32, truncf64, -}; - -// F32 -unsafe extern "C" fn _ceilf32(x: f32) -> f32 { - ceilf32(x) -} - -unsafe extern "C" fn _floorf32(x: f32) -> f32 { - floorf32(x) -} - -unsafe extern "C" fn _truncf32(x: f32) -> f32 { - truncf32(x) -} - -unsafe extern "C" fn _nearbyintf32(x: f32) -> f32 { - nearbyintf32(x) -} - -// F64 -unsafe extern "C" fn _ceilf64(x: f64) -> f64 { - ceilf64(x) -} - -unsafe extern "C" fn _floorf64(x: f64) -> f64 { - floorf64(x) -} - -unsafe extern "C" fn _truncf64(x: f64) -> f64 { - truncf64(x) -} - -unsafe extern "C" fn _nearbyintf64(x: f64) -> f64 { - nearbyintf64(x) -} diff --git a/src/webassembly/math_intrinsics.rs b/src/webassembly/math_intrinsics.rs new file mode 100644 index 000000000..0e946af3d --- /dev/null +++ b/src/webassembly/math_intrinsics.rs @@ -0,0 +1,41 @@ +// F32 +#[inline] +pub extern "C" fn ceilf32(x: f32) -> f32 { + x.ceil() +} + +#[inline] +pub extern "C" fn floorf32(x: f32) -> f32 { + x.floor() +} + +#[inline] +pub extern "C" fn truncf32(x: f32) -> f32 { + x.trunc() +} + +#[inline] +pub extern "C" fn nearbyintf32(x: f32) -> f32 { + x.round() +} + +// F64 +#[inline] +pub extern "C" fn ceilf64(x: f64) -> f64 { + x.ceil() +} + +#[inline] +pub extern "C" fn floorf64(x: f64) -> f64 { + x.floor() +} + +#[inline] +pub extern "C" fn truncf64(x: f64) -> f64 { + x.trunc() +} + +#[inline] +pub extern "C" fn nearbyintf64(x: f64) -> f64 { + x.round() +} diff --git a/src/webassembly/mod.rs b/src/webassembly/mod.rs index f97bfd92f..033f1c849 100644 --- a/src/webassembly/mod.rs +++ b/src/webassembly/mod.rs @@ -5,11 +5,13 @@ pub mod memory; pub mod module; pub mod relocation; pub mod utils; +pub mod math_intrinsics; use std::panic; use std::str::FromStr; use target_lexicon; use wasmparser; +use wasmparser::WasmDecoder; pub use self::errors::{Error, ErrorKind}; pub use self::import_object::{ImportObject, ImportValue}; @@ -46,7 +48,13 @@ pub fn instantiate( ) -> Result { let module = compile(buffer_source)?; debug!("webassembly - creating instance"); - let instance = Instance::new(&module, import_object, InstanceOptions { mock_missing_imports: true })?; + let instance = Instance::new( + &module, + import_object, + InstanceOptions { + mock_missing_imports: true, + }, + )?; debug!("webassembly - instance created"); Ok(ResultObject { module, instance }) } @@ -73,11 +81,9 @@ pub fn instantiate_streaming( /// webassembly::CompileError. pub fn compile(buffer_source: Vec) -> Result { // TODO: This should be automatically validated when creating the Module - let valid = validate(&buffer_source); - debug!("webassembly - valid {:?}", valid); - if !valid { - return Err(ErrorKind::CompileError("Module not valid".to_string())); - } + debug!("webassembly - validating module"); + validate_or_error(&buffer_source)?; + debug!("webassembly - creating module"); let module = Module::from_bytes(buffer_source, triple!("x86_64"), None)?; debug!("webassembly - module created"); @@ -89,8 +95,25 @@ pub fn compile(buffer_source: Vec) -> Result { /// array of WebAssembly binary code, returning whether the bytes /// form a valid wasm module (true) or not (false). /// Params: -/// * `buffer_source`: A `Vec` containing the +/// * `buffer_source`: A `&[u8]` containing the /// binary code of the .wasm module you want to compile. -pub fn validate(buffer_source: &Vec) -> bool { - wasmparser::validate(buffer_source, None) +pub fn validate(buffer_source: &[u8]) -> bool { + validate_or_error(buffer_source).is_ok() +} + +pub fn validate_or_error(bytes: &[u8]) -> Result<(), ErrorKind> { + let mut parser = wasmparser::ValidatingParser::new(bytes, None); + loop { + let state = parser.read(); + match *state { + wasmparser::ParserState::EndWasm => return Ok(()), + wasmparser::ParserState::Error(err) => { + return Err(ErrorKind::CompileError(format!( + "Validation error: {}", + err.message + ))) + } + _ => (), + } + } } diff --git a/src/webassembly/module.rs b/src/webassembly/module.rs index 5592b397f..0049c3192 100644 --- a/src/webassembly/module.rs +++ b/src/webassembly/module.rs @@ -427,7 +427,7 @@ impl<'environment> FuncEnvironmentTrait for FuncEnvironment<'environment> { // Based on the index provided, we need to know the offset into memories array // Each element in the memories array has a size of (ptr_size * 2) - let memory_data_offset = (memory_index as usize * ptr_size * 2) as i32; + let memory_data_offset = 0; // (memory_index as usize * ptr_size * 2) as i32; // Load value at the (base + memory_data_offset) // which is the address of data_pointer.memories[index].data