From f186ed8534cd4ead3289661928ee46ed769bb12c Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Sun, 25 Nov 2018 21:31:32 -0800 Subject: [PATCH 1/7] Added self-update command --- install.sh | 93 ++++++++++++++++++++++++++++++++++++++++----------- src/main.rs | 6 ++++ src/update.rs | 17 ++++++++++ 3 files changed, 97 insertions(+), 19 deletions(-) create mode 100644 src/update.rs diff --git a/install.sh b/install.sh index a8fcc663e..ae623019a 100755 --- a/install.sh +++ b/install.sh @@ -225,26 +225,30 @@ wasmer_install() { magenta2="${reset}\033[34m" magenta3="${reset}\033[34;2m" - printf "${reset}Installing Wasmer!$reset\n" - printf " - ${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} + if which wasmer >/dev/null; then + printf "${reset}Updating wasmer$reset\n" + else + printf "${reset}Installing Wasmer!$reset\n" + printf " + ${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} " + fi # if [ -d "$HOME/.wasmer" ]; then # if which wasmer; then # local latest_url @@ -290,9 +294,41 @@ wasmer_install() { wasmer_reset() { - unset -f wasmer_install wasmer_reset wasmer_download_json wasmer_link wasmer_detect_profile wasmer_download_file wasmer_download wasmer_verify_or_quit + unset -f wasmer_install wasmer_compareversions wasmer_reset wasmer_download_json wasmer_link wasmer_detect_profile wasmer_download_file wasmer_download wasmer_verify_or_quit } +# Example taken from +# https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash +wasmer_compareversions () { + if [[ $1 == $2 ]] + then + return 0 + fi + local IFS=. + local i ver1=($1) ver2=($2) + # fill empty fields in ver1 with zeros + for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)) + do + ver1[i]=0 + done + for ((i=0; i<${#ver1[@]}; i++)) + do + if [[ -z ${ver2[i]} ]] + then + # fill empty fields in ver2 with zeros + ver2[i]=0 + fi + if ((10#${ver1[i]} > 10#${ver2[i]})) + then + return 1 + fi + if ((10#${ver1[i]} < 10#${ver2[i]})) + then + return 2 + fi + done + return 0 +} wasmer_download() { # identify platform based on uname output @@ -322,6 +358,25 @@ wasmer_download() { printf "\033[1A$cyan> Getting wasmer releases... ✓$reset\n" fi + if which wasmer >/dev/null; then + WASMER_VERSION=$(wasmer --version | sed 's/[a-z[:blank:]]//g') + wasmer_compareversions "$WASMER_VERSION" "$WASMER_RELEASE_TAG" + case $? in + # WASMER_VERSION = WASMER_RELEASE_TAG + 0) + printf "You are already on the latest wasmer: ${WASMER_RELEASE_TAG}\n"; + exit 0 + ;; + # WASMER_VERSION > WASMER_RELEASE_TAG + 1) + printf "You are already on a more recent version than the published one: ${WASMER_RELEASE_TAG}.\nExiting\n"; + exit 0 + ;; + # WASMER_VERSION < WASMER_RELEASE_TAG (we continue) + 2) + ;; + esac + fi # fetch the real release data to make sure it exists before we attempt a download wasmer_download_json RELEASE_DATA "$RELEASES_URL/tag/$WASMER_RELEASE_TAG" diff --git a/src/main.rs b/src/main.rs index d68417f94..3a53aedde 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,6 +29,7 @@ mod macros; mod recovery; pub mod apis; pub mod common; +mod update; pub mod sighandler; #[cfg(test)] mod spectests; @@ -41,6 +42,10 @@ enum CLIOptions { /// Run a WebAssembly file. Formats accepted: wasm, wast #[structopt(name = "run")] Run(Run), + + /// Update wasmer to the latest version + #[structopt(name = "self-update")] + SelfUpdate, } #[derive(Debug, StructOpt)] @@ -117,5 +122,6 @@ fn main() { let options = CLIOptions::from_args(); match options { CLIOptions::Run(options) => run(options), + CLIOptions::SelfUpdate => update::self_update(), } } diff --git a/src/update.rs b/src/update.rs new file mode 100644 index 000000000..cfd1cccbb --- /dev/null +++ b/src/update.rs @@ -0,0 +1,17 @@ +//! When wasmer self-update is executed, this is what gets executed +use std::process::{Command, Stdio}; +use std::io; + +pub fn self_update() { + println!("Fetching latest installer"); + let cmd = Command::new("curl").arg("https://get.wasmer.io").arg("-sSfL") + .stdout(Stdio::piped()).spawn().unwrap(); + + let mut the_process = Command::new("sh") + .stdin(cmd.stdout.unwrap()) + .stdout(Stdio::inherit()) + .spawn() + .ok().expect("Failed to execute."); + + the_process.wait(); +} From 3815eaf13ae2fec8f3bc97abdc4c5218b955adc4 Mon Sep 17 00:00:00 2001 From: losfair Date: Wed, 28 Nov 2018 13:15:33 +0800 Subject: [PATCH 2/7] Allow using wasmer as a library. --- src/{main.rs => bin/wasmer.rs} | 27 ++-------------- src/lib.rs | 27 ++++++++++++++++ src/recovery.rs | 59 +++++++++++++++++----------------- 3 files changed, 59 insertions(+), 54 deletions(-) rename src/{main.rs => bin/wasmer.rs} (86%) create mode 100644 src/lib.rs diff --git a/src/main.rs b/src/bin/wasmer.rs similarity index 86% rename from src/main.rs rename to src/bin/wasmer.rs index d68417f94..682132856 100644 --- a/src/main.rs +++ b/src/bin/wasmer.rs @@ -1,19 +1,5 @@ -#[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 rayon; +extern crate wasmer; use std::fs::File; use std::io; @@ -23,16 +9,7 @@ use std::process::exit; use structopt::StructOpt; -#[macro_use] -mod macros; -#[macro_use] -mod recovery; -pub mod apis; -pub mod common; -pub mod sighandler; -#[cfg(test)] -mod spectests; -pub mod webassembly; +use wasmer::*; #[derive(Debug, StructOpt)] #[structopt(name = "wasmer", about = "WASM execution runtime.")] diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 000000000..efad3bcac --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,27 @@ +#[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; +pub extern crate nix; // re-exported for usage in macros +extern crate rayon; + +#[macro_use] +mod macros; +#[macro_use] +pub mod recovery; +pub mod apis; +pub mod common; +pub mod sighandler; +#[cfg(test)] +mod spectests; +pub mod webassembly; diff --git a/src/recovery.rs b/src/recovery.rs index b685bf12d..2a853b6f8 100644 --- a/src/recovery.rs +++ b/src/recovery.rs @@ -4,10 +4,10 @@ //! are very special, the async signal unsafety of Rust's TLS implementation generally does not affect the correctness here //! unless you have memory unsafety elsewhere in your code. -use std::cell::UnsafeCell; -use nix::sys::signal::{Signal, SIGFPE, SIGILL, SIGSEGV, SIGBUS}; -use super::webassembly::ErrorKind; use super::sighandler::install_sighandler; +use super::webassembly::ErrorKind; +use nix::sys::signal::{Signal, SIGBUS, SIGFPE, SIGILL, SIGSEGV}; +use std::cell::UnsafeCell; extern "C" { pub fn setjmp(env: *mut ::nix::libc::c_void) -> ::nix::libc::c_int; @@ -29,39 +29,40 @@ thread_local! { /// the behavior of call_protected is undefined. #[macro_export] macro_rules! call_protected { - ($x:expr) => {unsafe { - use crate::webassembly::ErrorKind; - use crate::recovery::{SETJMP_BUFFER, setjmp}; - use crate::sighandler::install_sighandler; + ($x:expr) => { + unsafe { + use crate::recovery::{setjmp, SETJMP_BUFFER}; + use crate::sighandler::install_sighandler; + use crate::webassembly::ErrorKind; - use nix::sys::signal::{Signal, SIGFPE, SIGILL, SIGSEGV, SIGBUS}; + use crate::nix::sys::signal::{Signal, SIGBUS, SIGFPE, SIGILL, SIGSEGV}; - let jmp_buf = SETJMP_BUFFER.with(|buf| buf.get()); - let prev_jmp_buf = *jmp_buf; + let jmp_buf = SETJMP_BUFFER.with(|buf| buf.get()); + let prev_jmp_buf = *jmp_buf; - install_sighandler(); + install_sighandler(); - let signum = setjmp(jmp_buf as *mut ::nix::libc::c_void); - if signum != 0 { - *jmp_buf = prev_jmp_buf; - let signal = match Signal::from_c_int(signum) { - Ok(SIGFPE) => "floating-point exception", - Ok(SIGILL) => "illegal instruction", - Ok(SIGSEGV) => "segmentation violation", - Ok(SIGBUS) => "bus error", - Err(_) => "error while getting the Signal", - _ => "unkown trapped signal", - }; - Err(ErrorKind::RuntimeError(format!("trap - {}", signal))) - } else { - let ret = $x; // TODO: Switch stack? - *jmp_buf = prev_jmp_buf; - Ok(ret) + let signum = setjmp(jmp_buf as *mut ::nix::libc::c_void); + if signum != 0 { + *jmp_buf = prev_jmp_buf; + let signal = match Signal::from_c_int(signum) { + Ok(SIGFPE) => "floating-point exception", + Ok(SIGILL) => "illegal instruction", + Ok(SIGSEGV) => "segmentation violation", + Ok(SIGBUS) => "bus error", + Err(_) => "error while getting the Signal", + _ => "unkown trapped signal", + }; + Err(ErrorKind::RuntimeError(format!("trap - {}", signal))) + } else { + let ret = $x; // TODO: Switch stack? + *jmp_buf = prev_jmp_buf; + Ok(ret) + } } - }} + }; } - /// Unwinds to last protected_call. pub unsafe fn do_unwind(signum: i32) -> ! { // Since do_unwind is only expected to get called from WebAssembly code which doesn't hold any host resources (locks etc.) From b9714e1ce17e4f61e34e63628c4021b8f141979d Mon Sep 17 00:00:00 2001 From: losfair Date: Wed, 28 Nov 2018 13:18:23 +0800 Subject: [PATCH 3/7] Fix a few warnings --- src/recovery.rs | 3 --- src/webassembly/instance.rs | 11 ++--------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/recovery.rs b/src/recovery.rs index 2a853b6f8..4b296cc9e 100644 --- a/src/recovery.rs +++ b/src/recovery.rs @@ -4,9 +4,6 @@ //! are very special, the async signal unsafety of Rust's TLS implementation generally does not affect the correctness here //! unless you have memory unsafety elsewhere in your code. -use super::sighandler::install_sighandler; -use super::webassembly::ErrorKind; -use nix::sys::signal::{Signal, SIGBUS, SIGFPE, SIGILL, SIGSEGV}; use std::cell::UnsafeCell; extern "C" { diff --git a/src/webassembly/instance.rs b/src/webassembly/instance.rs index 63b1d8b91..ec53ab7eb 100644 --- a/src/webassembly/instance.rs +++ b/src/webassembly/instance.rs @@ -22,7 +22,6 @@ use std::slice; use std::sync::Arc; use super::super::common::slice::{BoundedSlice, UncheckedSlice}; -use super::super::recovery; use super::errors::ErrorKind; use super::import_object::{ImportObject, ImportValue}; use super::math_intrinsics; @@ -481,12 +480,7 @@ impl Instance { tables.iter().map(|table| table[..].into()).collect(); let memories_pointer: Vec> = memories .iter() - .map(|mem| { - BoundedSlice::new( - &mem[..], - mem.current_size(), - ) - }) + .map(|mem| BoundedSlice::new(&mem[..], mem.current_size())) .collect(); let globals_pointer: GlobalsSlice = globals[..].into(); @@ -530,8 +524,7 @@ impl Instance { if let Some(func_index) = self.start_func { let func: fn(&Instance) = get_instance_function!(&self, func_index); call_protected!(func(self)) - } - else { + } else { Ok(()) } } From 319bd08905f43cf7b6a6bd4b318cdeb6bd96af7a Mon Sep 17 00:00:00 2001 From: losfair Date: Wed, 28 Nov 2018 13:21:03 +0800 Subject: [PATCH 4/7] Install signal handler only once. --- src/recovery.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/recovery.rs b/src/recovery.rs index 4b296cc9e..e644b9b06 100644 --- a/src/recovery.rs +++ b/src/recovery.rs @@ -5,6 +5,7 @@ //! unless you have memory unsafety elsewhere in your code. use std::cell::UnsafeCell; +use std::sync::Once; extern "C" { pub fn setjmp(env: *mut ::nix::libc::c_void) -> ::nix::libc::c_int; @@ -12,6 +13,7 @@ extern "C" { } const SETJMP_BUFFER_LEN: usize = 27; +pub static SIGHANDLER_INIT: Once = Once::new(); thread_local! { pub static SETJMP_BUFFER: UnsafeCell<[::nix::libc::c_int; SETJMP_BUFFER_LEN]> = UnsafeCell::new([0; SETJMP_BUFFER_LEN]); @@ -28,7 +30,7 @@ thread_local! { macro_rules! call_protected { ($x:expr) => { unsafe { - use crate::recovery::{setjmp, SETJMP_BUFFER}; + use crate::recovery::{setjmp, SETJMP_BUFFER, SIGHANDLER_INIT}; use crate::sighandler::install_sighandler; use crate::webassembly::ErrorKind; @@ -37,7 +39,9 @@ macro_rules! call_protected { let jmp_buf = SETJMP_BUFFER.with(|buf| buf.get()); let prev_jmp_buf = *jmp_buf; - install_sighandler(); + SIGHANDLER_INIT.call_once(|| { + install_sighandler(); + }); let signum = setjmp(jmp_buf as *mut ::nix::libc::c_void); if signum != 0 { From 35b07ea9a3457e7ff6b3b223afa335918c8db867 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Tue, 27 Nov 2018 23:19:51 -0800 Subject: [PATCH 5/7] Updated install script to use .wasmer/wasmer.sh --- install.sh | 50 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/install.sh b/install.sh index ae623019a..a855a7e32 100755 --- a/install.sh +++ b/install.sh @@ -127,9 +127,13 @@ wasmer_detect_profile() { } wasmer_link() { - printf "$cyan> Adding to \$PATH...$reset\n" + printf "$cyan> Adding to bash profile...$reset\n" WASMER_PROFILE="$(wasmer_detect_profile)" - SOURCE_STR="\nexport PATH=\"\$HOME/.wasmer/bin:\$PATH\"\n" + LOAD_STR="\n# Wasmer\nexport WASMER_DIR=\"\$HOME/.wasmer\"\n[ -s \"\$WASMER_DIR/wasmer.sh\" ] && source \"\$WASMER_DIR/wasmer.sh\" # This loads wasmer\n" + SOURCE_STR="# Wasmer config\nexport WASMER_DIR=\"\$HOME/.wasmer\"\nexport PATH=\"\$HOME/.wasmer/bin:\$PATH\"\n" + + # We create the wasmer.sh file + echo "$SOURCE_STR" > "$HOME/.wasmer/wasmer.sh" if [ -z "${WASMER_PROFILE-}" ] ; then printf "${red}Profile not found. Tried:\n* ${WASMER_PROFILE} (as defined in \$PROFILE)\n* ~/.bashrc\n* ~/.bash_profile\n* ~/.zshrc\n* ~/.profile.\n" @@ -139,24 +143,25 @@ wasmer_link() { printf "* Append the following lines to the correct file yourself:$reset\n" command printf "${SOURCE_STR}" else - if ! grep -q 'wasmer' "$WASMER_PROFILE"; then - if [[ $WASMER_PROFILE == *"fish"* ]]; then - command fish -c 'set -U fish_user_paths $fish_user_paths ~/.wasmer/bin' - else - command printf "$SOURCE_STR" >> "$WASMER_PROFILE" - fi + if ! grep -q 'wasmer.sh' "$WASMER_PROFILE"; then + # if [[ $WASMER_PROFILE == *"fish"* ]]; then + # command fish -c 'set -U fish_user_paths $fish_user_paths ~/.wasmer/bin' + # else + command printf "$LOAD_STR" >> "$WASMER_PROFILE" + # fi fi - printf "\033[1A$cyan> Adding to \$PATH... ✓$reset\n" + printf "\033[1A$cyan> Adding to bash profile... ✓$reset\n" printf "${dim}Note: We've added the following to your $WASMER_PROFILE\n" echo "If this isn't the profile of your current shell then please add the following to your correct profile:" - printf "$SOURCE_STR$reset\n" + printf "$LOAD_STR$reset\n" version=`$HOME/.wasmer/bin/wasmer --version` || ( printf "$red> wasmer was installed, but doesn't seem to be working :($reset\n" exit 1; ) - printf "$green> Successfully installed $version!\n${reset}Please open another terminal where the \`${bold}wasmer$reset\` command will now be available.$reset\n" + printf "$green> Successfully installed $version!\n\n${reset}If you want to have the command available now please execute:\nsource $HOME/.wasmer/wasmer.sh$reset\n" + printf "\nOtherwise, wasmer will be available the next time you open the terminal.\n" fi } @@ -302,6 +307,7 @@ wasmer_reset() { wasmer_compareversions () { if [[ $1 == $2 ]] then + echo "=" return 0 fi local IFS=. @@ -320,13 +326,16 @@ wasmer_compareversions () { fi if ((10#${ver1[i]} > 10#${ver2[i]})) then - return 1 + echo ">" + return 0 fi if ((10#${ver1[i]} < 10#${ver2[i]})) then - return 2 + echo "<" + return 0 fi done + echo "=" return 0 } @@ -360,20 +369,21 @@ wasmer_download() { if which wasmer >/dev/null; then WASMER_VERSION=$(wasmer --version | sed 's/[a-z[:blank:]]//g') - wasmer_compareversions "$WASMER_VERSION" "$WASMER_RELEASE_TAG" - case $? in + WASMER_COMPARE=$(wasmer_compareversions $WASMER_VERSION $WASMER_RELEASE_TAG) + # printf "version: $WASMER_COMPARE\n" + case $WASMER_COMPARE in # WASMER_VERSION = WASMER_RELEASE_TAG - 0) - printf "You are already on the latest wasmer: ${WASMER_RELEASE_TAG}\n"; + "=") + printf "You are already on the latest release of wasmer: ${WASMER_RELEASE_TAG}\n"; exit 0 ;; # WASMER_VERSION > WASMER_RELEASE_TAG - 1) - printf "You are already on a more recent version than the published one: ${WASMER_RELEASE_TAG}.\nExiting\n"; + ">") + printf "You are on a more recent version ($WASMER_VERSION) than the published one (${WASMER_RELEASE_TAG})\n"; exit 0 ;; # WASMER_VERSION < WASMER_RELEASE_TAG (we continue) - 2) + "<") ;; esac fi From 836f6c70af3476c7cf48fa75ed53f66a259955ec Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Tue, 27 Nov 2018 23:32:54 -0800 Subject: [PATCH 6/7] =?UTF-8?q?Added=20memory=5Ftrap=20spectests=20?= =?UTF-8?q?=F0=9F=92=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spectests/README.md | 2 +- spectests/memory_trap.wast | 270 +++ src/build_spectests.rs | 3 +- src/spectests/memory_trap.rs | 3409 ++++++++++++++++++++++++++++++++++ src/spectests/mod.rs | 1 + 5 files changed, 3683 insertions(+), 2 deletions(-) create mode 100644 spectests/memory_trap.wast create mode 100644 src/spectests/memory_trap.rs diff --git a/spectests/README.md b/spectests/README.md index 90bbf1a23..f391ad541 100644 --- a/spectests/README.md +++ b/spectests/README.md @@ -81,7 +81,7 @@ This spectests are currently covered: - memory.wast ✅ - memory_grow.wast ✅ - memory_redundancy.wast ✅ -- memory_trap.wast +- memory_trap.wast ✅ - names.wast ✅ - nop.wast ✅ - return.wast ✅ diff --git a/spectests/memory_trap.wast b/spectests/memory_trap.wast new file mode 100644 index 000000000..b79627d7c --- /dev/null +++ b/spectests/memory_trap.wast @@ -0,0 +1,270 @@ +(module + (memory 1) + + (func $addr_limit (result i32) + (i32.mul (memory.size) (i32.const 0x10000)) + ) + + (func (export "store") (param $i i32) (param $v i32) + (i32.store (i32.add (call $addr_limit) (get_local $i)) (get_local $v)) + ) + + (func (export "load") (param $i i32) (result i32) + (i32.load (i32.add (call $addr_limit) (get_local $i))) + ) + + (func (export "memory.grow") (param i32) (result i32) + (memory.grow (get_local 0)) + ) +) + +(assert_return (invoke "store" (i32.const -4) (i32.const 42))) +(assert_return (invoke "load" (i32.const -4)) (i32.const 42)) +(assert_trap (invoke "store" (i32.const -3) (i32.const 13)) "out of bounds memory access") +(assert_trap (invoke "load" (i32.const -3)) "out of bounds memory access") +(assert_trap (invoke "store" (i32.const -2) (i32.const 13)) "out of bounds memory access") +(assert_trap (invoke "load" (i32.const -2)) "out of bounds memory access") +(assert_trap (invoke "store" (i32.const -1) (i32.const 13)) "out of bounds memory access") +(assert_trap (invoke "load" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "store" (i32.const 0) (i32.const 13)) "out of bounds memory access") +(assert_trap (invoke "load" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "store" (i32.const 0x80000000) (i32.const 13)) "out of bounds memory access") +(assert_trap (invoke "load" (i32.const 0x80000000)) "out of bounds memory access") +(assert_return (invoke "memory.grow" (i32.const 0x10001)) (i32.const -1)) + +(module + (memory 1) + (data (i32.const 0) "abcdefgh") + (data (i32.const 0xfff8) "abcdefgh") + + (func (export "i32.load") (param $a i32) (result i32) + (i32.load (get_local $a)) + ) + (func (export "i64.load") (param $a i32) (result i64) + (i64.load (get_local $a)) + ) + (func (export "f32.load") (param $a i32) (result f32) + (f32.load (get_local $a)) + ) + (func (export "f64.load") (param $a i32) (result f64) + (f64.load (get_local $a)) + ) + (func (export "i32.load8_s") (param $a i32) (result i32) + (i32.load8_s (get_local $a)) + ) + (func (export "i32.load8_u") (param $a i32) (result i32) + (i32.load8_u (get_local $a)) + ) + (func (export "i32.load16_s") (param $a i32) (result i32) + (i32.load16_s (get_local $a)) + ) + (func (export "i32.load16_u") (param $a i32) (result i32) + (i32.load16_u (get_local $a)) + ) + (func (export "i64.load8_s") (param $a i32) (result i64) + (i64.load8_s (get_local $a)) + ) + (func (export "i64.load8_u") (param $a i32) (result i64) + (i64.load8_u (get_local $a)) + ) + (func (export "i64.load16_s") (param $a i32) (result i64) + (i64.load16_s (get_local $a)) + ) + (func (export "i64.load16_u") (param $a i32) (result i64) + (i64.load16_u (get_local $a)) + ) + (func (export "i64.load32_s") (param $a i32) (result i64) + (i64.load32_s (get_local $a)) + ) + (func (export "i64.load32_u") (param $a i32) (result i64) + (i64.load32_u (get_local $a)) + ) + (func (export "i32.store") (param $a i32) (param $v i32) + (i32.store (get_local $a) (get_local $v)) + ) + (func (export "i64.store") (param $a i32) (param $v i64) + (i64.store (get_local $a) (get_local $v)) + ) + (func (export "f32.store") (param $a i32) (param $v f32) + (f32.store (get_local $a) (get_local $v)) + ) + (func (export "f64.store") (param $a i32) (param $v f64) + (f64.store (get_local $a) (get_local $v)) + ) + (func (export "i32.store8") (param $a i32) (param $v i32) + (i32.store8 (get_local $a) (get_local $v)) + ) + (func (export "i32.store16") (param $a i32) (param $v i32) + (i32.store16 (get_local $a) (get_local $v)) + ) + (func (export "i64.store8") (param $a i32) (param $v i64) + (i64.store8 (get_local $a) (get_local $v)) + ) + (func (export "i64.store16") (param $a i32) (param $v i64) + (i64.store16 (get_local $a) (get_local $v)) + ) + (func (export "i64.store32") (param $a i32) (param $v i64) + (i64.store32 (get_local $a) (get_local $v)) + ) +) + +(assert_trap (invoke "i32.store" (i32.const 0x10000) (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "i32.store" (i32.const 0xffff) (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "i32.store" (i32.const 0xfffe) (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "i32.store" (i32.const 0xfffd) (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "i32.store" (i32.const -1) (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "i32.store" (i32.const -2) (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "i32.store" (i32.const -3) (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "i32.store" (i32.const -4) (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const 0x10000) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const 0xffff) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const 0xfffe) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const 0xfffd) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const 0xfffc) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const 0xfffb) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const 0xfffa) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const 0xfff9) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const -1) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const -2) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const -3) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const -4) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const -5) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const -6) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const -7) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store" (i32.const -8) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f32.store" (i32.const 0x10000) (f32.const 0)) "out of bounds memory access") +(assert_trap (invoke "f32.store" (i32.const 0xffff) (f32.const 0)) "out of bounds memory access") +(assert_trap (invoke "f32.store" (i32.const 0xfffe) (f32.const 0)) "out of bounds memory access") +(assert_trap (invoke "f32.store" (i32.const 0xfffd) (f32.const 0)) "out of bounds memory access") +(assert_trap (invoke "f32.store" (i32.const -1) (f32.const 0)) "out of bounds memory access") +(assert_trap (invoke "f32.store" (i32.const -2) (f32.const 0)) "out of bounds memory access") +(assert_trap (invoke "f32.store" (i32.const -3) (f32.const 0)) "out of bounds memory access") +(assert_trap (invoke "f32.store" (i32.const -4) (f32.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const 0x10000) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const 0xffff) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const 0xfffe) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const 0xfffd) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const 0xfffc) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const 0xfffb) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const 0xfffa) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const 0xfff9) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const -1) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const -2) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const -3) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const -4) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const -5) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const -6) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const -7) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "f64.store" (i32.const -8) (f64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i32.store8" (i32.const 0x10000) (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "i32.store8" (i32.const -1) (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "i32.store16" (i32.const 0x10000) (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "i32.store16" (i32.const 0xffff) (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "i32.store16" (i32.const -1) (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "i32.store16" (i32.const -2) (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store8" (i32.const 0x10000) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store8" (i32.const -1) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store16" (i32.const 0x10000) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store16" (i32.const 0xffff) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store16" (i32.const -1) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store16" (i32.const -2) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store32" (i32.const 0x10000) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store32" (i32.const 0xffff) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store32" (i32.const 0xfffe) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store32" (i32.const 0xfffd) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store32" (i32.const -1) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store32" (i32.const -2) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store32" (i32.const -3) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i64.store32" (i32.const -4) (i64.const 0)) "out of bounds memory access") +(assert_trap (invoke "i32.load" (i32.const 0x10000)) "out of bounds memory access") +(assert_trap (invoke "i32.load" (i32.const 0xffff)) "out of bounds memory access") +(assert_trap (invoke "i32.load" (i32.const 0xfffe)) "out of bounds memory access") +(assert_trap (invoke "i32.load" (i32.const 0xfffd)) "out of bounds memory access") +(assert_trap (invoke "i32.load" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "i32.load" (i32.const -2)) "out of bounds memory access") +(assert_trap (invoke "i32.load" (i32.const -3)) "out of bounds memory access") +(assert_trap (invoke "i32.load" (i32.const -4)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const 0x10000)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const 0xffff)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const 0xfffe)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const 0xfffd)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const 0xfffc)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const 0xfffb)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const 0xfffa)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const 0xfff9)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const -2)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const -3)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const -4)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const -5)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const -6)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const -7)) "out of bounds memory access") +(assert_trap (invoke "i64.load" (i32.const -8)) "out of bounds memory access") +(assert_trap (invoke "f32.load" (i32.const 0x10000)) "out of bounds memory access") +(assert_trap (invoke "f32.load" (i32.const 0xffff)) "out of bounds memory access") +(assert_trap (invoke "f32.load" (i32.const 0xfffe)) "out of bounds memory access") +(assert_trap (invoke "f32.load" (i32.const 0xfffd)) "out of bounds memory access") +(assert_trap (invoke "f32.load" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "f32.load" (i32.const -2)) "out of bounds memory access") +(assert_trap (invoke "f32.load" (i32.const -3)) "out of bounds memory access") +(assert_trap (invoke "f32.load" (i32.const -4)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const 0x10000)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const 0xffff)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const 0xfffe)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const 0xfffd)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const 0xfffc)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const 0xfffb)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const 0xfffa)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const 0xfff9)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const -2)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const -3)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const -4)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const -5)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const -6)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const -7)) "out of bounds memory access") +(assert_trap (invoke "f64.load" (i32.const -8)) "out of bounds memory access") +(assert_trap (invoke "i32.load8_s" (i32.const 0x10000)) "out of bounds memory access") +(assert_trap (invoke "i32.load8_s" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "i32.load8_u" (i32.const 0x10000)) "out of bounds memory access") +(assert_trap (invoke "i32.load8_u" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "i32.load16_s" (i32.const 0x10000)) "out of bounds memory access") +(assert_trap (invoke "i32.load16_s" (i32.const 0xffff)) "out of bounds memory access") +(assert_trap (invoke "i32.load16_s" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "i32.load16_s" (i32.const -2)) "out of bounds memory access") +(assert_trap (invoke "i32.load16_u" (i32.const 0x10000)) "out of bounds memory access") +(assert_trap (invoke "i32.load16_u" (i32.const 0xffff)) "out of bounds memory access") +(assert_trap (invoke "i32.load16_u" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "i32.load16_u" (i32.const -2)) "out of bounds memory access") +(assert_trap (invoke "i64.load8_s" (i32.const 0x10000)) "out of bounds memory access") +(assert_trap (invoke "i64.load8_s" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "i64.load8_u" (i32.const 0x10000)) "out of bounds memory access") +(assert_trap (invoke "i64.load8_u" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "i64.load16_s" (i32.const 0x10000)) "out of bounds memory access") +(assert_trap (invoke "i64.load16_s" (i32.const 0xffff)) "out of bounds memory access") +(assert_trap (invoke "i64.load16_s" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "i64.load16_s" (i32.const -2)) "out of bounds memory access") +(assert_trap (invoke "i64.load16_u" (i32.const 0x10000)) "out of bounds memory access") +(assert_trap (invoke "i64.load16_u" (i32.const 0xffff)) "out of bounds memory access") +(assert_trap (invoke "i64.load16_u" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "i64.load16_u" (i32.const -2)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_s" (i32.const 0x10000)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_s" (i32.const 0xffff)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_s" (i32.const 0xfffe)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_s" (i32.const 0xfffd)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_s" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_s" (i32.const -2)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_s" (i32.const -3)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_s" (i32.const -4)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_u" (i32.const 0x10000)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_u" (i32.const 0xffff)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_u" (i32.const 0xfffe)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_u" (i32.const 0xfffd)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_u" (i32.const -1)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_u" (i32.const -2)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_u" (i32.const -3)) "out of bounds memory access") +(assert_trap (invoke "i64.load32_u" (i32.const -4)) "out of bounds memory access") + +;; No memory was changed +(assert_return (invoke "i64.load" (i32.const 0xfff8)) (i64.const 0x6867666564636261)) +(assert_return (invoke "i64.load" (i32.const 0)) (i64.const 0x6867666564636261)) diff --git a/src/build_spectests.rs b/src/build_spectests.rs index 947cc8e87..21b0f53cd 100644 --- a/src/build_spectests.rs +++ b/src/build_spectests.rs @@ -15,7 +15,7 @@ static ENV_VAR: &str = "WASM_GENERATE_SPECTESTS"; static BANNER: &str = "// Rust test file autogenerated with cargo build (src/build_spectests.rs). // Please do NOT modify it by hand, as it will be reseted on next build.\n"; -const TESTS: [&str; 58] = [ +const TESTS: [&str; 59] = [ "spectests/address.wast", "spectests/align.wast", "spectests/binary.wast", @@ -61,6 +61,7 @@ const TESTS: [&str; 58] = [ "spectests/memory.wast", "spectests/memory_grow.wast", "spectests/memory_redundancy.wast", + "spectests/memory_trap.wast", "spectests/nop.wast", "spectests/return_.wast", "spectests/select.wast", diff --git a/src/spectests/memory_trap.rs b/src/spectests/memory_trap.rs new file mode 100644 index 000000000..a5ad46393 --- /dev/null +++ b/src/spectests/memory_trap.rs @@ -0,0 +1,3409 @@ +// Rust test file autogenerated with cargo build (src/build_spectests.rs). +// Please do NOT modify it by hand, as it will be reseted on next build. +// Test based on spectests/memory_trap.wast +#![allow( + warnings, + dead_code +)] +use wabt::wat2wasm; + +use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, Instance, Export}; +use super::_common::{ + spectest_importobject, + NaNCheck, +}; + + +// Line 1 +fn create_module_1() -> ResultObject { + let module_str = "(module + (type (;0;) (func (result i32))) + (type (;1;) (func (param i32 i32))) + (type (;2;) (func (param i32) (result i32))) + (func (;0;) (type 0) (result i32) + memory.size + i32.const 65536 + i32.mul) + (func (;1;) (type 1) (param i32 i32) + call 0 + get_local 0 + i32.add + get_local 1 + i32.store) + (func (;2;) (type 2) (param i32) (result i32) + call 0 + get_local 0 + i32.add + i32.load) + (func (;3;) (type 2) (param i32) (result i32) + get_local 0 + memory.grow) + (memory (;0;) 1) + (export \"store\" (func 1)) + (export \"load\" (func 2)) + (export \"memory.grow\" (func 3))) + "; + 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") +} + +fn start_module_1(result_object: &ResultObject) { + result_object.instance.start(); +} + +// Line 21 +fn c1_l21_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c1_l21_action_invoke"); + let func_index = match result_object.module.info.exports.get("store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-4 as i32, 42 as i32, &result_object.instance); + assert_eq!(result, ()); +} + +// Line 22 +fn c2_l22_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c2_l22_action_invoke"); + let func_index = match result_object.module.info.exports.get("load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-4 as i32, &result_object.instance); + assert_eq!(result, 42 as i32); +} + +// Line 23 +fn c3_l23_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c3_l23_action_invoke"); + let func_index = match result_object.module.info.exports.get("store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-3 as i32, 13 as i32, &result_object.instance); + +} + +#[test] +fn c3_l23_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c3_l23_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 24 +fn c4_l24_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c4_l24_action_invoke"); + let func_index = match result_object.module.info.exports.get("load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-3 as i32, &result_object.instance); + +} + +#[test] +fn c4_l24_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c4_l24_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 25 +fn c5_l25_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c5_l25_action_invoke"); + let func_index = match result_object.module.info.exports.get("store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, 13 as i32, &result_object.instance); + +} + +#[test] +fn c5_l25_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c5_l25_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 26 +fn c6_l26_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c6_l26_action_invoke"); + let func_index = match result_object.module.info.exports.get("load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, &result_object.instance); + +} + +#[test] +fn c6_l26_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c6_l26_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 27 +fn c7_l27_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c7_l27_action_invoke"); + let func_index = match result_object.module.info.exports.get("store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, 13 as i32, &result_object.instance); + +} + +#[test] +fn c7_l27_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c7_l27_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 28 +fn c8_l28_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c8_l28_action_invoke"); + let func_index = match result_object.module.info.exports.get("load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c8_l28_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c8_l28_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 29 +fn c9_l29_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c9_l29_action_invoke"); + let func_index = match result_object.module.info.exports.get("store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(0 as i32, 13 as i32, &result_object.instance); + +} + +#[test] +fn c9_l29_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c9_l29_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 30 +fn c10_l30_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c10_l30_action_invoke"); + let func_index = match result_object.module.info.exports.get("load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(0 as i32, &result_object.instance); + +} + +#[test] +fn c10_l30_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c10_l30_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 31 +fn c11_l31_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c11_l31_action_invoke"); + let func_index = match result_object.module.info.exports.get("store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2147483648 as i32, 13 as i32, &result_object.instance); + +} + +#[test] +fn c11_l31_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c11_l31_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 32 +fn c12_l32_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c12_l32_action_invoke"); + let func_index = match result_object.module.info.exports.get("load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2147483648 as i32, &result_object.instance); + +} + +#[test] +fn c12_l32_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c12_l32_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 33 +fn c13_l33_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c13_l33_action_invoke"); + let func_index = match result_object.module.info.exports.get("memory.grow") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65537 as i32, &result_object.instance); + assert_eq!(result, -1 as i32); +} + +// Line 35 + +#[test] +fn test_module_1() { + let result_object = create_module_1(); + // We group the calls together + start_module_1(&result_object); + c1_l21_action_invoke(&result_object); + c2_l22_action_invoke(&result_object); + c13_l33_action_invoke(&result_object); +} +fn create_module_2() -> ResultObject { + let module_str = "(module + (type (;0;) (func (param i32) (result i32))) + (type (;1;) (func (param i32) (result i64))) + (type (;2;) (func (param i32) (result f32))) + (type (;3;) (func (param i32) (result f64))) + (type (;4;) (func (param i32 i32))) + (type (;5;) (func (param i32 i64))) + (type (;6;) (func (param i32 f32))) + (type (;7;) (func (param i32 f64))) + (func (;0;) (type 0) (param i32) (result i32) + get_local 0 + i32.load) + (func (;1;) (type 1) (param i32) (result i64) + get_local 0 + i64.load) + (func (;2;) (type 2) (param i32) (result f32) + get_local 0 + f32.load) + (func (;3;) (type 3) (param i32) (result f64) + get_local 0 + f64.load) + (func (;4;) (type 0) (param i32) (result i32) + get_local 0 + i32.load8_s) + (func (;5;) (type 0) (param i32) (result i32) + get_local 0 + i32.load8_u) + (func (;6;) (type 0) (param i32) (result i32) + get_local 0 + i32.load16_s) + (func (;7;) (type 0) (param i32) (result i32) + get_local 0 + i32.load16_u) + (func (;8;) (type 1) (param i32) (result i64) + get_local 0 + i64.load8_s) + (func (;9;) (type 1) (param i32) (result i64) + get_local 0 + i64.load8_u) + (func (;10;) (type 1) (param i32) (result i64) + get_local 0 + i64.load16_s) + (func (;11;) (type 1) (param i32) (result i64) + get_local 0 + i64.load16_u) + (func (;12;) (type 1) (param i32) (result i64) + get_local 0 + i64.load32_s) + (func (;13;) (type 1) (param i32) (result i64) + get_local 0 + i64.load32_u) + (func (;14;) (type 4) (param i32 i32) + get_local 0 + get_local 1 + i32.store) + (func (;15;) (type 5) (param i32 i64) + get_local 0 + get_local 1 + i64.store) + (func (;16;) (type 6) (param i32 f32) + get_local 0 + get_local 1 + f32.store) + (func (;17;) (type 7) (param i32 f64) + get_local 0 + get_local 1 + f64.store) + (func (;18;) (type 4) (param i32 i32) + get_local 0 + get_local 1 + i32.store8) + (func (;19;) (type 4) (param i32 i32) + get_local 0 + get_local 1 + i32.store16) + (func (;20;) (type 5) (param i32 i64) + get_local 0 + get_local 1 + i64.store8) + (func (;21;) (type 5) (param i32 i64) + get_local 0 + get_local 1 + i64.store16) + (func (;22;) (type 5) (param i32 i64) + get_local 0 + get_local 1 + i64.store32) + (memory (;0;) 1) + (export \"i32.load\" (func 0)) + (export \"i64.load\" (func 1)) + (export \"f32.load\" (func 2)) + (export \"f64.load\" (func 3)) + (export \"i32.load8_s\" (func 4)) + (export \"i32.load8_u\" (func 5)) + (export \"i32.load16_s\" (func 6)) + (export \"i32.load16_u\" (func 7)) + (export \"i64.load8_s\" (func 8)) + (export \"i64.load8_u\" (func 9)) + (export \"i64.load16_s\" (func 10)) + (export \"i64.load16_u\" (func 11)) + (export \"i64.load32_s\" (func 12)) + (export \"i64.load32_u\" (func 13)) + (export \"i32.store\" (func 14)) + (export \"i64.store\" (func 15)) + (export \"f32.store\" (func 16)) + (export \"f64.store\" (func 17)) + (export \"i32.store8\" (func 18)) + (export \"i32.store16\" (func 19)) + (export \"i64.store8\" (func 20)) + (export \"i64.store16\" (func 21)) + (export \"i64.store32\" (func 22)) + (data (;0;) (i32.const 0) \"abcdefgh\") + (data (;1;) (i32.const 65528) \"abcdefgh\")) + "; + 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") +} + +fn start_module_2(result_object: &ResultObject) { + result_object.instance.start(); +} + +// Line 111 +fn c15_l111_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c15_l111_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, 0 as i32, &result_object.instance); + +} + +#[test] +fn c15_l111_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c15_l111_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 112 +fn c16_l112_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c16_l112_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, 0 as i32, &result_object.instance); + +} + +#[test] +fn c16_l112_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c16_l112_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 113 +fn c17_l113_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c17_l113_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65534 as i32, 0 as i32, &result_object.instance); + +} + +#[test] +fn c17_l113_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c17_l113_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 114 +fn c18_l114_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c18_l114_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65533 as i32, 0 as i32, &result_object.instance); + +} + +#[test] +fn c18_l114_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c18_l114_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 115 +fn c19_l115_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c19_l115_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, 0 as i32, &result_object.instance); + +} + +#[test] +fn c19_l115_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c19_l115_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 116 +fn c20_l116_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c20_l116_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, 0 as i32, &result_object.instance); + +} + +#[test] +fn c20_l116_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c20_l116_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 117 +fn c21_l117_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c21_l117_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-3 as i32, 0 as i32, &result_object.instance); + +} + +#[test] +fn c21_l117_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c21_l117_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 118 +fn c22_l118_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c22_l118_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-4 as i32, 0 as i32, &result_object.instance); + +} + +#[test] +fn c22_l118_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c22_l118_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 119 +fn c23_l119_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c23_l119_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c23_l119_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c23_l119_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 120 +fn c24_l120_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c24_l120_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c24_l120_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c24_l120_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 121 +fn c25_l121_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c25_l121_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65534 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c25_l121_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c25_l121_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 122 +fn c26_l122_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c26_l122_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65533 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c26_l122_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c26_l122_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 123 +fn c27_l123_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c27_l123_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65532 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c27_l123_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c27_l123_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 124 +fn c28_l124_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c28_l124_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65531 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c28_l124_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c28_l124_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 125 +fn c29_l125_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c29_l125_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65530 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c29_l125_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c29_l125_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 126 +fn c30_l126_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c30_l126_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65529 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c30_l126_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c30_l126_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 127 +fn c31_l127_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c31_l127_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c31_l127_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c31_l127_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 128 +fn c32_l128_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c32_l128_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c32_l128_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c32_l128_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 129 +fn c33_l129_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c33_l129_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-3 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c33_l129_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c33_l129_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 130 +fn c34_l130_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c34_l130_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-4 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c34_l130_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c34_l130_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 131 +fn c35_l131_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c35_l131_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-5 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c35_l131_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c35_l131_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 132 +fn c36_l132_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c36_l132_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-6 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c36_l132_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c36_l132_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 133 +fn c37_l133_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c37_l133_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-7 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c37_l133_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c37_l133_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 134 +fn c38_l134_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c38_l134_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-8 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c38_l134_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c38_l134_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 135 +fn c39_l135_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c39_l135_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, 0.0 as f32, &result_object.instance); + +} + +#[test] +fn c39_l135_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c39_l135_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 136 +fn c40_l136_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c40_l136_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, 0.0 as f32, &result_object.instance); + +} + +#[test] +fn c40_l136_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c40_l136_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 137 +fn c41_l137_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c41_l137_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65534 as i32, 0.0 as f32, &result_object.instance); + +} + +#[test] +fn c41_l137_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c41_l137_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 138 +fn c42_l138_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c42_l138_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65533 as i32, 0.0 as f32, &result_object.instance); + +} + +#[test] +fn c42_l138_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c42_l138_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 139 +fn c43_l139_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c43_l139_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, 0.0 as f32, &result_object.instance); + +} + +#[test] +fn c43_l139_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c43_l139_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 140 +fn c44_l140_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c44_l140_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, 0.0 as f32, &result_object.instance); + +} + +#[test] +fn c44_l140_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c44_l140_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 141 +fn c45_l141_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c45_l141_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-3 as i32, 0.0 as f32, &result_object.instance); + +} + +#[test] +fn c45_l141_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c45_l141_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 142 +fn c46_l142_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c46_l142_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-4 as i32, 0.0 as f32, &result_object.instance); + +} + +#[test] +fn c46_l142_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c46_l142_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 143 +fn c47_l143_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c47_l143_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c47_l143_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c47_l143_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 144 +fn c48_l144_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c48_l144_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c48_l144_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c48_l144_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 145 +fn c49_l145_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c49_l145_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65534 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c49_l145_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c49_l145_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 146 +fn c50_l146_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c50_l146_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65533 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c50_l146_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c50_l146_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 147 +fn c51_l147_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c51_l147_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65532 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c51_l147_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c51_l147_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 148 +fn c52_l148_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c52_l148_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65531 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c52_l148_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c52_l148_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 149 +fn c53_l149_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c53_l149_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65530 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c53_l149_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c53_l149_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 150 +fn c54_l150_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c54_l150_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65529 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c54_l150_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c54_l150_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 151 +fn c55_l151_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c55_l151_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c55_l151_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c55_l151_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 152 +fn c56_l152_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c56_l152_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c56_l152_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c56_l152_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 153 +fn c57_l153_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c57_l153_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-3 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c57_l153_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c57_l153_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 154 +fn c58_l154_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c58_l154_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-4 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c58_l154_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c58_l154_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 155 +fn c59_l155_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c59_l155_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-5 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c59_l155_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c59_l155_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 156 +fn c60_l156_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c60_l156_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-6 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c60_l156_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c60_l156_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 157 +fn c61_l157_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c61_l157_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-7 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c61_l157_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c61_l157_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 158 +fn c62_l158_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c62_l158_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.store") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, f64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-8 as i32, 0.0 as f64, &result_object.instance); + +} + +#[test] +fn c62_l158_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c62_l158_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 159 +fn c63_l159_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c63_l159_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.store8") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, 0 as i32, &result_object.instance); + +} + +#[test] +fn c63_l159_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c63_l159_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 160 +fn c64_l160_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c64_l160_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.store8") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, 0 as i32, &result_object.instance); + +} + +#[test] +fn c64_l160_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c64_l160_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 161 +fn c65_l161_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c65_l161_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.store16") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, 0 as i32, &result_object.instance); + +} + +#[test] +fn c65_l161_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c65_l161_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 162 +fn c66_l162_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c66_l162_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.store16") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, 0 as i32, &result_object.instance); + +} + +#[test] +fn c66_l162_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c66_l162_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 163 +fn c67_l163_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c67_l163_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.store16") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, 0 as i32, &result_object.instance); + +} + +#[test] +fn c67_l163_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c67_l163_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 164 +fn c68_l164_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c68_l164_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.store16") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, 0 as i32, &result_object.instance); + +} + +#[test] +fn c68_l164_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c68_l164_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 165 +fn c69_l165_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c69_l165_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store8") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c69_l165_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c69_l165_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 166 +fn c70_l166_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c70_l166_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store8") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c70_l166_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c70_l166_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 167 +fn c71_l167_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c71_l167_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store16") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c71_l167_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c71_l167_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 168 +fn c72_l168_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c72_l168_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store16") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c72_l168_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c72_l168_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 169 +fn c73_l169_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c73_l169_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store16") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c73_l169_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c73_l169_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 170 +fn c74_l170_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c74_l170_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store16") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c74_l170_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c74_l170_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 171 +fn c75_l171_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c75_l171_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store32") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c75_l171_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c75_l171_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 172 +fn c76_l172_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c76_l172_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store32") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c76_l172_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c76_l172_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 173 +fn c77_l173_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c77_l173_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store32") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65534 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c77_l173_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c77_l173_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 174 +fn c78_l174_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c78_l174_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store32") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65533 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c78_l174_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c78_l174_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 175 +fn c79_l175_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c79_l175_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store32") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c79_l175_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c79_l175_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 176 +fn c80_l176_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c80_l176_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store32") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c80_l176_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c80_l176_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 177 +fn c81_l177_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c81_l177_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store32") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-3 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c81_l177_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c81_l177_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 178 +fn c82_l178_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c82_l178_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.store32") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, i64, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-4 as i32, 0 as i64, &result_object.instance); + +} + +#[test] +fn c82_l178_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c82_l178_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 179 +fn c83_l179_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c83_l179_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, &result_object.instance); + +} + +#[test] +fn c83_l179_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c83_l179_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 180 +fn c84_l180_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c84_l180_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, &result_object.instance); + +} + +#[test] +fn c84_l180_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c84_l180_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 181 +fn c85_l181_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c85_l181_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65534 as i32, &result_object.instance); + +} + +#[test] +fn c85_l181_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c85_l181_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 182 +fn c86_l182_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c86_l182_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65533 as i32, &result_object.instance); + +} + +#[test] +fn c86_l182_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c86_l182_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 183 +fn c87_l183_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c87_l183_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c87_l183_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c87_l183_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 184 +fn c88_l184_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c88_l184_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, &result_object.instance); + +} + +#[test] +fn c88_l184_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c88_l184_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 185 +fn c89_l185_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c89_l185_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-3 as i32, &result_object.instance); + +} + +#[test] +fn c89_l185_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c89_l185_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 186 +fn c90_l186_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c90_l186_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-4 as i32, &result_object.instance); + +} + +#[test] +fn c90_l186_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c90_l186_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 187 +fn c91_l187_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c91_l187_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, &result_object.instance); + +} + +#[test] +fn c91_l187_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c91_l187_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 188 +fn c92_l188_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c92_l188_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, &result_object.instance); + +} + +#[test] +fn c92_l188_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c92_l188_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 189 +fn c93_l189_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c93_l189_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65534 as i32, &result_object.instance); + +} + +#[test] +fn c93_l189_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c93_l189_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 190 +fn c94_l190_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c94_l190_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65533 as i32, &result_object.instance); + +} + +#[test] +fn c94_l190_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c94_l190_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 191 +fn c95_l191_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c95_l191_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65532 as i32, &result_object.instance); + +} + +#[test] +fn c95_l191_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c95_l191_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 192 +fn c96_l192_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c96_l192_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65531 as i32, &result_object.instance); + +} + +#[test] +fn c96_l192_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c96_l192_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 193 +fn c97_l193_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c97_l193_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65530 as i32, &result_object.instance); + +} + +#[test] +fn c97_l193_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c97_l193_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 194 +fn c98_l194_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c98_l194_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65529 as i32, &result_object.instance); + +} + +#[test] +fn c98_l194_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c98_l194_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 195 +fn c99_l195_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c99_l195_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c99_l195_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c99_l195_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 196 +fn c100_l196_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c100_l196_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, &result_object.instance); + +} + +#[test] +fn c100_l196_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c100_l196_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 197 +fn c101_l197_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c101_l197_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-3 as i32, &result_object.instance); + +} + +#[test] +fn c101_l197_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c101_l197_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 198 +fn c102_l198_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c102_l198_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-4 as i32, &result_object.instance); + +} + +#[test] +fn c102_l198_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c102_l198_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 199 +fn c103_l199_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c103_l199_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-5 as i32, &result_object.instance); + +} + +#[test] +fn c103_l199_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c103_l199_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 200 +fn c104_l200_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c104_l200_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-6 as i32, &result_object.instance); + +} + +#[test] +fn c104_l200_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c104_l200_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 201 +fn c105_l201_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c105_l201_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-7 as i32, &result_object.instance); + +} + +#[test] +fn c105_l201_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c105_l201_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 202 +fn c106_l202_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c106_l202_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-8 as i32, &result_object.instance); + +} + +#[test] +fn c106_l202_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c106_l202_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 203 +fn c107_l203_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c107_l203_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, &result_object.instance); + +} + +#[test] +fn c107_l203_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c107_l203_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 204 +fn c108_l204_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c108_l204_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, &result_object.instance); + +} + +#[test] +fn c108_l204_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c108_l204_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 205 +fn c109_l205_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c109_l205_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65534 as i32, &result_object.instance); + +} + +#[test] +fn c109_l205_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c109_l205_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 206 +fn c110_l206_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c110_l206_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65533 as i32, &result_object.instance); + +} + +#[test] +fn c110_l206_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c110_l206_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 207 +fn c111_l207_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c111_l207_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c111_l207_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c111_l207_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 208 +fn c112_l208_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c112_l208_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, &result_object.instance); + +} + +#[test] +fn c112_l208_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c112_l208_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 209 +fn c113_l209_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c113_l209_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-3 as i32, &result_object.instance); + +} + +#[test] +fn c113_l209_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c113_l209_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 210 +fn c114_l210_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c114_l210_action_invoke"); + let func_index = match result_object.module.info.exports.get("f32.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-4 as i32, &result_object.instance); + +} + +#[test] +fn c114_l210_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c114_l210_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 211 +fn c115_l211_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c115_l211_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, &result_object.instance); + +} + +#[test] +fn c115_l211_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c115_l211_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 212 +fn c116_l212_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c116_l212_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, &result_object.instance); + +} + +#[test] +fn c116_l212_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c116_l212_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 213 +fn c117_l213_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c117_l213_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65534 as i32, &result_object.instance); + +} + +#[test] +fn c117_l213_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c117_l213_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 214 +fn c118_l214_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c118_l214_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65533 as i32, &result_object.instance); + +} + +#[test] +fn c118_l214_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c118_l214_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 215 +fn c119_l215_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c119_l215_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65532 as i32, &result_object.instance); + +} + +#[test] +fn c119_l215_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c119_l215_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 216 +fn c120_l216_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c120_l216_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65531 as i32, &result_object.instance); + +} + +#[test] +fn c120_l216_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c120_l216_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 217 +fn c121_l217_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c121_l217_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65530 as i32, &result_object.instance); + +} + +#[test] +fn c121_l217_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c121_l217_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 218 +fn c122_l218_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c122_l218_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65529 as i32, &result_object.instance); + +} + +#[test] +fn c122_l218_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c122_l218_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 219 +fn c123_l219_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c123_l219_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c123_l219_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c123_l219_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 220 +fn c124_l220_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c124_l220_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, &result_object.instance); + +} + +#[test] +fn c124_l220_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c124_l220_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 221 +fn c125_l221_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c125_l221_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-3 as i32, &result_object.instance); + +} + +#[test] +fn c125_l221_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c125_l221_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 222 +fn c126_l222_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c126_l222_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-4 as i32, &result_object.instance); + +} + +#[test] +fn c126_l222_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c126_l222_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 223 +fn c127_l223_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c127_l223_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-5 as i32, &result_object.instance); + +} + +#[test] +fn c127_l223_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c127_l223_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 224 +fn c128_l224_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c128_l224_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-6 as i32, &result_object.instance); + +} + +#[test] +fn c128_l224_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c128_l224_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 225 +fn c129_l225_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c129_l225_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-7 as i32, &result_object.instance); + +} + +#[test] +fn c129_l225_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c129_l225_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 226 +fn c130_l226_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c130_l226_action_invoke"); + let func_index = match result_object.module.info.exports.get("f64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-8 as i32, &result_object.instance); + +} + +#[test] +fn c130_l226_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c130_l226_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 227 +fn c131_l227_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c131_l227_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load8_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, &result_object.instance); + +} + +#[test] +fn c131_l227_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c131_l227_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 228 +fn c132_l228_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c132_l228_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load8_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c132_l228_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c132_l228_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 229 +fn c133_l229_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c133_l229_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load8_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, &result_object.instance); + +} + +#[test] +fn c133_l229_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c133_l229_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 230 +fn c134_l230_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c134_l230_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load8_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c134_l230_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c134_l230_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 231 +fn c135_l231_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c135_l231_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load16_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, &result_object.instance); + +} + +#[test] +fn c135_l231_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c135_l231_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 232 +fn c136_l232_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c136_l232_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load16_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, &result_object.instance); + +} + +#[test] +fn c136_l232_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c136_l232_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 233 +fn c137_l233_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c137_l233_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load16_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c137_l233_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c137_l233_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 234 +fn c138_l234_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c138_l234_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load16_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, &result_object.instance); + +} + +#[test] +fn c138_l234_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c138_l234_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 235 +fn c139_l235_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c139_l235_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load16_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, &result_object.instance); + +} + +#[test] +fn c139_l235_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c139_l235_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 236 +fn c140_l236_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c140_l236_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load16_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, &result_object.instance); + +} + +#[test] +fn c140_l236_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c140_l236_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 237 +fn c141_l237_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c141_l237_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load16_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c141_l237_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c141_l237_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 238 +fn c142_l238_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c142_l238_action_invoke"); + let func_index = match result_object.module.info.exports.get("i32.load16_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, &result_object.instance); + +} + +#[test] +fn c142_l238_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c142_l238_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 239 +fn c143_l239_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c143_l239_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load8_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, &result_object.instance); + +} + +#[test] +fn c143_l239_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c143_l239_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 240 +fn c144_l240_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c144_l240_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load8_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c144_l240_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c144_l240_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 241 +fn c145_l241_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c145_l241_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load8_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, &result_object.instance); + +} + +#[test] +fn c145_l241_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c145_l241_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 242 +fn c146_l242_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c146_l242_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load8_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c146_l242_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c146_l242_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 243 +fn c147_l243_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c147_l243_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load16_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, &result_object.instance); + +} + +#[test] +fn c147_l243_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c147_l243_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 244 +fn c148_l244_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c148_l244_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load16_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, &result_object.instance); + +} + +#[test] +fn c148_l244_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c148_l244_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 245 +fn c149_l245_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c149_l245_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load16_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c149_l245_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c149_l245_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 246 +fn c150_l246_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c150_l246_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load16_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, &result_object.instance); + +} + +#[test] +fn c150_l246_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c150_l246_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 247 +fn c151_l247_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c151_l247_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load16_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, &result_object.instance); + +} + +#[test] +fn c151_l247_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c151_l247_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 248 +fn c152_l248_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c152_l248_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load16_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, &result_object.instance); + +} + +#[test] +fn c152_l248_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c152_l248_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 249 +fn c153_l249_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c153_l249_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load16_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c153_l249_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c153_l249_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 250 +fn c154_l250_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c154_l250_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load16_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, &result_object.instance); + +} + +#[test] +fn c154_l250_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c154_l250_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 251 +fn c155_l251_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c155_l251_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, &result_object.instance); + +} + +#[test] +fn c155_l251_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c155_l251_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 252 +fn c156_l252_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c156_l252_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, &result_object.instance); + +} + +#[test] +fn c156_l252_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c156_l252_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 253 +fn c157_l253_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c157_l253_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65534 as i32, &result_object.instance); + +} + +#[test] +fn c157_l253_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c157_l253_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 254 +fn c158_l254_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c158_l254_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65533 as i32, &result_object.instance); + +} + +#[test] +fn c158_l254_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c158_l254_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 255 +fn c159_l255_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c159_l255_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c159_l255_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c159_l255_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 256 +fn c160_l256_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c160_l256_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, &result_object.instance); + +} + +#[test] +fn c160_l256_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c160_l256_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 257 +fn c161_l257_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c161_l257_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-3 as i32, &result_object.instance); + +} + +#[test] +fn c161_l257_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c161_l257_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 258 +fn c162_l258_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c162_l258_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_s") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-4 as i32, &result_object.instance); + +} + +#[test] +fn c162_l258_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c162_l258_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 259 +fn c163_l259_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c163_l259_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65536 as i32, &result_object.instance); + +} + +#[test] +fn c163_l259_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c163_l259_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 260 +fn c164_l260_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c164_l260_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65535 as i32, &result_object.instance); + +} + +#[test] +fn c164_l260_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c164_l260_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 261 +fn c165_l261_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c165_l261_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65534 as i32, &result_object.instance); + +} + +#[test] +fn c165_l261_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c165_l261_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 262 +fn c166_l262_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c166_l262_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65533 as i32, &result_object.instance); + +} + +#[test] +fn c166_l262_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c166_l262_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 263 +fn c167_l263_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c167_l263_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-1 as i32, &result_object.instance); + +} + +#[test] +fn c167_l263_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c167_l263_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 264 +fn c168_l264_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c168_l264_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-2 as i32, &result_object.instance); + +} + +#[test] +fn c168_l264_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c168_l264_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 265 +fn c169_l265_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c169_l265_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-3 as i32, &result_object.instance); + +} + +#[test] +fn c169_l265_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c169_l265_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 266 +fn c170_l266_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c170_l266_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load32_u") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(-4 as i32, &result_object.instance); + +} + +#[test] +fn c170_l266_assert_trap() { + let result_object = create_module_2(); + let result = call_protected!(c170_l266_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 269 +fn c171_l269_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c171_l269_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(65528 as i32, &result_object.instance); + assert_eq!(result, 7523094288207667809 as i64); +} + +// Line 270 +fn c172_l270_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c172_l270_action_invoke"); + let func_index = match result_object.module.info.exports.get("i64.load") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(i32, &Instance) -> i64 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(0 as i32, &result_object.instance); + assert_eq!(result, 7523094288207667809 as i64); +} + +#[test] +fn test_module_2() { + let result_object = create_module_2(); + // We group the calls together + start_module_2(&result_object); + c171_l269_action_invoke(&result_object); + c172_l270_action_invoke(&result_object); +} diff --git a/src/spectests/mod.rs b/src/spectests/mod.rs index 691fe75fb..42542cdb3 100644 --- a/src/spectests/mod.rs +++ b/src/spectests/mod.rs @@ -60,6 +60,7 @@ mod loop_; mod memory; mod memory_grow; mod memory_redundancy; +mod memory_trap; mod nop; mod return_; mod select; From 30f79554e5e7d62b7fc94a29bd084e305ae9820c Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Tue, 27 Nov 2018 23:38:35 -0800 Subject: [PATCH 7/7] Added unwind spectests --- spectests/README.md | 2 +- spectests/unwind.wast | 267 +++++++++ src/build_spectests.rs | 3 +- src/spectests/mod.rs | 1 + src/spectests/unwind.rs | 1142 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 1413 insertions(+), 2 deletions(-) create mode 100644 spectests/unwind.wast create mode 100644 src/spectests/unwind.rs diff --git a/spectests/README.md b/spectests/README.md index f391ad541..b9c26d864 100644 --- a/spectests/README.md +++ b/spectests/README.md @@ -99,7 +99,7 @@ This spectests are currently covered: - typecheck.wast ✅ - unreachable.wast - unreached-invalid.wast -- unwind.wast +- unwind.wast ✅ - utf8-custom-section-id.wast - utf8-import-field.wast - utf8-import-module.wast diff --git a/spectests/unwind.wast b/spectests/unwind.wast new file mode 100644 index 000000000..85db60b59 --- /dev/null +++ b/spectests/unwind.wast @@ -0,0 +1,267 @@ +;; Test that control-flow transfer unwinds stack and it can be anything after. + +(module + (func (export "func-unwind-by-unreachable") + (i32.const 3) (i64.const 1) (unreachable) + ) + (func (export "func-unwind-by-br") + (i32.const 3) (i64.const 1) (br 0) + ) + (func (export "func-unwind-by-br-value") (result i32) + (i32.const 3) (i64.const 1) (br 0 (i32.const 9)) + ) + (func (export "func-unwind-by-br_if") + (i32.const 3) (i64.const 1) (drop (drop (br_if 0 (i32.const 1)))) + ) + (func (export "func-unwind-by-br_if-value") (result i32) + (i32.const 3) (i64.const 1) (drop (drop (br_if 0 (i32.const 9) (i32.const 1)))) + ) + (func (export "func-unwind-by-br_table") + (i32.const 3) (i64.const 1) (br_table 0 (i32.const 0)) + ) + (func (export "func-unwind-by-br_table-value") (result i32) + (i32.const 3) (i64.const 1) (br_table 0 (i32.const 9) (i32.const 0)) + ) + (func (export "func-unwind-by-return") (result i32) + (i32.const 3) (i64.const 1) (return (i32.const 9)) + ) + + (func (export "block-unwind-by-unreachable") + (block (i32.const 3) (i64.const 1) (unreachable)) + ) + (func (export "block-unwind-by-br") (result i32) + (block (i32.const 3) (i64.const 1) (br 0)) (i32.const 9) + ) + (func (export "block-unwind-by-br-value") (result i32) + (block (result i32) (i32.const 3) (i64.const 1) (br 0 (i32.const 9))) + ) + (func (export "block-unwind-by-br_if") (result i32) + (block (i32.const 3) (i64.const 1) (drop (drop (br_if 0 (i32.const 1))))) (i32.const 9) + ) + (func (export "block-unwind-by-br_if-value") (result i32) + (block (result i32) + (i32.const 3) (i64.const 1) (drop (drop (br_if 0 (i32.const 9) (i32.const 1)))) + ) + ) + (func (export "block-unwind-by-br_table") (result i32) + (block (i32.const 3) (i64.const 1) (br_table 0 (i32.const 0))) (i32.const 9) + ) + (func (export "block-unwind-by-br_table-value") (result i32) + (block (result i32) + (i32.const 3) (i64.const 1) (br_table 0 (i32.const 9) (i32.const 0)) + ) + ) + (func (export "block-unwind-by-return") (result i32) + (block (result i32) (i32.const 3) (i64.const 1) (return (i32.const 9))) + ) + + (func (export "block-nested-unwind-by-unreachable") (result i32) + (block (result i32) (i32.const 3) (block (i64.const 1) (unreachable))) + ) + (func (export "block-nested-unwind-by-br") (result i32) + (block (i32.const 3) (block (i64.const 1) (br 1)) (drop)) (i32.const 9) + ) + (func (export "block-nested-unwind-by-br-value") (result i32) + (block (result i32) + (i32.const 3) (block (i64.const 1) (br 1 (i32.const 9))) + ) + ) + (func (export "block-nested-unwind-by-br_if") (result i32) + (block (i32.const 3) (block (i64.const 1) (drop (br_if 1 (i32.const 1)))) (drop)) (i32.const 9) + ) + (func (export "block-nested-unwind-by-br_if-value") (result i32) + (block (result i32) + (i32.const 3) (block (i64.const 1) (drop (drop (br_if 1 (i32.const 9) (i32.const 1))))) + ) + ) + (func (export "block-nested-unwind-by-br_table") (result i32) + (block + (i32.const 3) (block (i64.const 1) (br_table 1 (i32.const 1))) + (drop) + ) + (i32.const 9) + ) + (func (export "block-nested-unwind-by-br_table-value") (result i32) + (block (result i32) + (i32.const 3) + (block (i64.const 1) (br_table 1 (i32.const 9) (i32.const 1))) + ) + ) + (func (export "block-nested-unwind-by-return") (result i32) + (block (result i32) + (i32.const 3) (block (i64.const 1) (return (i32.const 9))) + ) + ) + + (func (export "unary-after-unreachable") (result i32) + (f32.const 0) (unreachable) (i64.eqz) + ) + (func (export "unary-after-br") (result i32) + (block (result i32) (f32.const 0) (br 0 (i32.const 9)) (i64.eqz)) + ) + (func (export "unary-after-br_if") (result i32) + (block (result i32) + (i64.const 0) (drop (br_if 0 (i32.const 9) (i32.const 1))) (i64.eqz) + ) + ) + (func (export "unary-after-br_table") (result i32) + (block (result i32) + (f32.const 0) (br_table 0 0 (i32.const 9) (i32.const 0)) (i64.eqz) + ) + ) + (func (export "unary-after-return") (result i32) + (f32.const 0) (return (i32.const 9)) (i64.eqz) + ) + + (func (export "binary-after-unreachable") (result i32) + (f32.const 0) (f64.const 1) (unreachable) (i64.eq) + ) + (func (export "binary-after-br") (result i32) + (block (result i32) + (f32.const 0) (f64.const 1) (br 0 (i32.const 9)) (i64.eq) + ) + ) + (func (export "binary-after-br_if") (result i32) + (block (result i32) + (i64.const 0) (i64.const 1) (drop (br_if 0 (i32.const 9) (i32.const 1))) + (i64.eq) + ) + ) + (func (export "binary-after-br_table") (result i32) + (block (result i32) + (f32.const 0) (f64.const 1) (br_table 0 (i32.const 9) (i32.const 0)) + (i64.eq) + ) + ) + (func (export "binary-after-return") (result i32) + (f32.const 0) (f64.const 1) (return (i32.const 9)) (i64.eq) + ) + + (func (export "select-after-unreachable") (result i32) + (f32.const 0) (f64.const 1) (i64.const 0) (unreachable) (select) + ) + (func (export "select-after-br") (result i32) + (block (result i32) + (f32.const 0) (f64.const 1) (i64.const 0) (br 0 (i32.const 9)) (select) + ) + ) + (func (export "select-after-br_if") (result i32) + (block (result i32) + (i32.const 0) (i32.const 1) (i32.const 0) + (drop (br_if 0 (i32.const 9) (i32.const 1))) + (select) + ) + ) + (func (export "select-after-br_table") (result i32) + (block (result i32) + (f32.const 0) (f64.const 1) (i64.const 0) + (br_table 0 (i32.const 9) (i32.const 0)) + (select) + ) + ) + (func (export "select-after-return") (result i32) + (f32.const 0) (f64.const 1) (i64.const 1) (return (i32.const 9)) (select) + ) + + (func (export "block-value-after-unreachable") (result i32) + (block (result i32) (f32.const 0) (unreachable)) + ) + (func (export "block-value-after-br") (result i32) + (block (result i32) (f32.const 0) (br 0 (i32.const 9))) + ) + (func (export "block-value-after-br_if") (result i32) + (block (result i32) + (i32.const 0) (drop (br_if 0 (i32.const 9) (i32.const 1))) + ) + ) + (func (export "block-value-after-br_table") (result i32) + (block (result i32) + (f32.const 0) (br_table 0 0 (i32.const 9) (i32.const 0)) + ) + ) + (func (export "block-value-after-return") (result i32) + (block (result i32) (f32.const 0) (return (i32.const 9))) + ) + + (func (export "loop-value-after-unreachable") (result i32) + (loop (result i32) (f32.const 0) (unreachable)) + ) + (func (export "loop-value-after-br") (result i32) + (block (result i32) (loop (result i32) (f32.const 0) (br 1 (i32.const 9)))) + ) + (func (export "loop-value-after-br_if") (result i32) + (block (result i32) + (loop (result i32) + (i32.const 0) (drop (br_if 1 (i32.const 9) (i32.const 1))) + ) + ) + ) + + (func (export "loop-value-after-br_table") (result i32) + (block (result i32) + (loop (result i32) + (f32.const 0) (br_table 1 1 (i32.const 9) (i32.const 0)) + ) + ) + ) + (func (export "loop-value-after-return") (result i32) + (loop (result i32) (f32.const 0) (return (i32.const 9))) + ) +) + +(assert_trap (invoke "func-unwind-by-unreachable") "unreachable") +(assert_return (invoke "func-unwind-by-br")) +(assert_return (invoke "func-unwind-by-br-value") (i32.const 9)) +(assert_return (invoke "func-unwind-by-br_if")) +(assert_return (invoke "func-unwind-by-br_if-value") (i32.const 9)) +(assert_return (invoke "func-unwind-by-br_table")) +(assert_return (invoke "func-unwind-by-br_table-value") (i32.const 9)) +(assert_return (invoke "func-unwind-by-return") (i32.const 9)) + +(assert_trap (invoke "block-unwind-by-unreachable") "unreachable") +(assert_return (invoke "block-unwind-by-br") (i32.const 9)) +(assert_return (invoke "block-unwind-by-br-value") (i32.const 9)) +(assert_return (invoke "block-unwind-by-br_if") (i32.const 9)) +(assert_return (invoke "block-unwind-by-br_if-value") (i32.const 9)) +(assert_return (invoke "block-unwind-by-br_table") (i32.const 9)) +(assert_return (invoke "block-unwind-by-br_table-value") (i32.const 9)) +(assert_return (invoke "block-unwind-by-return") (i32.const 9)) + +(assert_trap (invoke "block-nested-unwind-by-unreachable") "unreachable") +(assert_return (invoke "block-nested-unwind-by-br") (i32.const 9)) +(assert_return (invoke "block-nested-unwind-by-br-value") (i32.const 9)) +(assert_return (invoke "block-nested-unwind-by-br_if") (i32.const 9)) +(assert_return (invoke "block-nested-unwind-by-br_if-value") (i32.const 9)) +(assert_return (invoke "block-nested-unwind-by-br_table") (i32.const 9)) +(assert_return (invoke "block-nested-unwind-by-br_table-value") (i32.const 9)) +(assert_return (invoke "block-nested-unwind-by-return") (i32.const 9)) + +(assert_trap (invoke "unary-after-unreachable") "unreachable") +(assert_return (invoke "unary-after-br") (i32.const 9)) +(assert_return (invoke "unary-after-br_if") (i32.const 9)) +(assert_return (invoke "unary-after-br_table") (i32.const 9)) +(assert_return (invoke "unary-after-return") (i32.const 9)) + +(assert_trap (invoke "binary-after-unreachable") "unreachable") +(assert_return (invoke "binary-after-br") (i32.const 9)) +(assert_return (invoke "binary-after-br_if") (i32.const 9)) +(assert_return (invoke "binary-after-br_table") (i32.const 9)) +(assert_return (invoke "binary-after-return") (i32.const 9)) + +(assert_trap (invoke "select-after-unreachable") "unreachable") +(assert_return (invoke "select-after-br") (i32.const 9)) +(assert_return (invoke "select-after-br_if") (i32.const 9)) +(assert_return (invoke "select-after-br_table") (i32.const 9)) +(assert_return (invoke "select-after-return") (i32.const 9)) + +(assert_trap (invoke "block-value-after-unreachable") "unreachable") +(assert_return (invoke "block-value-after-br") (i32.const 9)) +(assert_return (invoke "block-value-after-br_if") (i32.const 9)) +(assert_return (invoke "block-value-after-br_table") (i32.const 9)) +(assert_return (invoke "block-value-after-return") (i32.const 9)) + +(assert_trap (invoke "loop-value-after-unreachable") "unreachable") +(assert_return (invoke "loop-value-after-br") (i32.const 9)) +(assert_return (invoke "loop-value-after-br_if") (i32.const 9)) +(assert_return (invoke "loop-value-after-br_table") (i32.const 9)) +(assert_return (invoke "loop-value-after-return") (i32.const 9)) diff --git a/src/build_spectests.rs b/src/build_spectests.rs index 21b0f53cd..2585a348f 100644 --- a/src/build_spectests.rs +++ b/src/build_spectests.rs @@ -15,7 +15,7 @@ static ENV_VAR: &str = "WASM_GENERATE_SPECTESTS"; static BANNER: &str = "// Rust test file autogenerated with cargo build (src/build_spectests.rs). // Please do NOT modify it by hand, as it will be reseted on next build.\n"; -const TESTS: [&str; 59] = [ +const TESTS: [&str; 60] = [ "spectests/address.wast", "spectests/align.wast", "spectests/binary.wast", @@ -75,6 +75,7 @@ const TESTS: [&str; 59] = [ "spectests/traps.wast", "spectests/typecheck.wast", "spectests/types.wast", + "spectests/unwind.wast", ]; fn wabt2rust_type(v: &Value) -> String { diff --git a/src/spectests/mod.rs b/src/spectests/mod.rs index 42542cdb3..0f953c3bf 100644 --- a/src/spectests/mod.rs +++ b/src/spectests/mod.rs @@ -74,3 +74,4 @@ mod token; mod traps; mod typecheck; mod types; +mod unwind; diff --git a/src/spectests/unwind.rs b/src/spectests/unwind.rs new file mode 100644 index 000000000..5987db0bc --- /dev/null +++ b/src/spectests/unwind.rs @@ -0,0 +1,1142 @@ +// Rust test file autogenerated with cargo build (src/build_spectests.rs). +// Please do NOT modify it by hand, as it will be reseted on next build. +// Test based on spectests/unwind.wast +#![allow( + warnings, + dead_code +)] +use wabt::wat2wasm; + +use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, Instance, Export}; +use super::_common::{ + spectest_importobject, + NaNCheck, +}; + + +// Line 3 +fn create_module_1() -> ResultObject { + let module_str = "(module + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (func (;0;) (type 0) + i32.const 3 + i64.const 1 + unreachable) + (func (;1;) (type 0) + i32.const 3 + i64.const 1 + br 0 (;@0;)) + (func (;2;) (type 1) (result i32) + i32.const 3 + i64.const 1 + i32.const 9 + br 0 (;@0;)) + (func (;3;) (type 0) + i32.const 3 + i64.const 1 + i32.const 1 + br_if 0 (;@0;) + drop + drop) + (func (;4;) (type 1) (result i32) + i32.const 3 + i64.const 1 + i32.const 9 + i32.const 1 + br_if 0 (;@0;) + drop + drop) + (func (;5;) (type 0) + i32.const 3 + i64.const 1 + i32.const 0 + br_table 0 (;@0;)) + (func (;6;) (type 1) (result i32) + i32.const 3 + i64.const 1 + i32.const 9 + i32.const 0 + br_table 0 (;@0;)) + (func (;7;) (type 1) (result i32) + i32.const 3 + i64.const 1 + i32.const 9 + return) + (func (;8;) (type 0) + block ;; label = @1 + i32.const 3 + i64.const 1 + unreachable + end) + (func (;9;) (type 1) (result i32) + block ;; label = @1 + i32.const 3 + i64.const 1 + br 0 (;@1;) + end + i32.const 9) + (func (;10;) (type 1) (result i32) + block (result i32) ;; label = @1 + i32.const 3 + i64.const 1 + i32.const 9 + br 0 (;@1;) + end) + (func (;11;) (type 1) (result i32) + block ;; label = @1 + i32.const 3 + i64.const 1 + i32.const 1 + br_if 0 (;@1;) + drop + drop + end + i32.const 9) + (func (;12;) (type 1) (result i32) + block (result i32) ;; label = @1 + i32.const 3 + i64.const 1 + i32.const 9 + i32.const 1 + br_if 0 (;@1;) + drop + drop + end) + (func (;13;) (type 1) (result i32) + block ;; label = @1 + i32.const 3 + i64.const 1 + i32.const 0 + br_table 0 (;@1;) + end + i32.const 9) + (func (;14;) (type 1) (result i32) + block (result i32) ;; label = @1 + i32.const 3 + i64.const 1 + i32.const 9 + i32.const 0 + br_table 0 (;@1;) + end) + (func (;15;) (type 1) (result i32) + block (result i32) ;; label = @1 + i32.const 3 + i64.const 1 + i32.const 9 + return + end) + (func (;16;) (type 1) (result i32) + block (result i32) ;; label = @1 + i32.const 3 + block ;; label = @2 + i64.const 1 + unreachable + end + end) + (func (;17;) (type 1) (result i32) + block ;; label = @1 + i32.const 3 + block ;; label = @2 + i64.const 1 + br 1 (;@1;) + end + drop + end + i32.const 9) + (func (;18;) (type 1) (result i32) + block (result i32) ;; label = @1 + i32.const 3 + block ;; label = @2 + i64.const 1 + i32.const 9 + br 1 (;@1;) + end + end) + (func (;19;) (type 1) (result i32) + block ;; label = @1 + i32.const 3 + block ;; label = @2 + i64.const 1 + i32.const 1 + br_if 1 (;@1;) + drop + end + drop + end + i32.const 9) + (func (;20;) (type 1) (result i32) + block (result i32) ;; label = @1 + i32.const 3 + block ;; label = @2 + i64.const 1 + i32.const 9 + i32.const 1 + br_if 1 (;@1;) + drop + drop + end + end) + (func (;21;) (type 1) (result i32) + block ;; label = @1 + i32.const 3 + block ;; label = @2 + i64.const 1 + i32.const 1 + br_table 1 (;@1;) + end + drop + end + i32.const 9) + (func (;22;) (type 1) (result i32) + block (result i32) ;; label = @1 + i32.const 3 + block ;; label = @2 + i64.const 1 + i32.const 9 + i32.const 1 + br_table 1 (;@1;) + end + end) + (func (;23;) (type 1) (result i32) + block (result i32) ;; label = @1 + i32.const 3 + block ;; label = @2 + i64.const 1 + i32.const 9 + return + end + end) + (func (;24;) (type 1) (result i32) + f32.const 0x0p+0 (;=0;) + unreachable + i64.eqz) + (func (;25;) (type 1) (result i32) + block (result i32) ;; label = @1 + f32.const 0x0p+0 (;=0;) + i32.const 9 + br 0 (;@1;) + i64.eqz + end) + (func (;26;) (type 1) (result i32) + block (result i32) ;; label = @1 + i64.const 0 + i32.const 9 + i32.const 1 + br_if 0 (;@1;) + drop + i64.eqz + end) + (func (;27;) (type 1) (result i32) + block (result i32) ;; label = @1 + f32.const 0x0p+0 (;=0;) + i32.const 9 + i32.const 0 + br_table 0 (;@1;) 0 (;@1;) + i64.eqz + end) + (func (;28;) (type 1) (result i32) + f32.const 0x0p+0 (;=0;) + i32.const 9 + return + i64.eqz) + (func (;29;) (type 1) (result i32) + f32.const 0x0p+0 (;=0;) + f64.const 0x1p+0 (;=1;) + unreachable + i64.eq) + (func (;30;) (type 1) (result i32) + block (result i32) ;; label = @1 + f32.const 0x0p+0 (;=0;) + f64.const 0x1p+0 (;=1;) + i32.const 9 + br 0 (;@1;) + i64.eq + end) + (func (;31;) (type 1) (result i32) + block (result i32) ;; label = @1 + i64.const 0 + i64.const 1 + i32.const 9 + i32.const 1 + br_if 0 (;@1;) + drop + i64.eq + end) + (func (;32;) (type 1) (result i32) + block (result i32) ;; label = @1 + f32.const 0x0p+0 (;=0;) + f64.const 0x1p+0 (;=1;) + i32.const 9 + i32.const 0 + br_table 0 (;@1;) + i64.eq + end) + (func (;33;) (type 1) (result i32) + f32.const 0x0p+0 (;=0;) + f64.const 0x1p+0 (;=1;) + i32.const 9 + return + i64.eq) + (func (;34;) (type 1) (result i32) + f32.const 0x0p+0 (;=0;) + f64.const 0x1p+0 (;=1;) + i64.const 0 + unreachable + select) + (func (;35;) (type 1) (result i32) + block (result i32) ;; label = @1 + f32.const 0x0p+0 (;=0;) + f64.const 0x1p+0 (;=1;) + i64.const 0 + i32.const 9 + br 0 (;@1;) + select + end) + (func (;36;) (type 1) (result i32) + block (result i32) ;; label = @1 + i32.const 0 + i32.const 1 + i32.const 0 + i32.const 9 + i32.const 1 + br_if 0 (;@1;) + drop + select + end) + (func (;37;) (type 1) (result i32) + block (result i32) ;; label = @1 + f32.const 0x0p+0 (;=0;) + f64.const 0x1p+0 (;=1;) + i64.const 0 + i32.const 9 + i32.const 0 + br_table 0 (;@1;) + select + end) + (func (;38;) (type 1) (result i32) + f32.const 0x0p+0 (;=0;) + f64.const 0x1p+0 (;=1;) + i64.const 1 + i32.const 9 + return + select) + (func (;39;) (type 1) (result i32) + block (result i32) ;; label = @1 + f32.const 0x0p+0 (;=0;) + unreachable + end) + (func (;40;) (type 1) (result i32) + block (result i32) ;; label = @1 + f32.const 0x0p+0 (;=0;) + i32.const 9 + br 0 (;@1;) + end) + (func (;41;) (type 1) (result i32) + block (result i32) ;; label = @1 + i32.const 0 + i32.const 9 + i32.const 1 + br_if 0 (;@1;) + drop + end) + (func (;42;) (type 1) (result i32) + block (result i32) ;; label = @1 + f32.const 0x0p+0 (;=0;) + i32.const 9 + i32.const 0 + br_table 0 (;@1;) 0 (;@1;) + end) + (func (;43;) (type 1) (result i32) + block (result i32) ;; label = @1 + f32.const 0x0p+0 (;=0;) + i32.const 9 + return + end) + (func (;44;) (type 1) (result i32) + loop (result i32) ;; label = @1 + f32.const 0x0p+0 (;=0;) + unreachable + end) + (func (;45;) (type 1) (result i32) + block (result i32) ;; label = @1 + loop (result i32) ;; label = @2 + f32.const 0x0p+0 (;=0;) + i32.const 9 + br 1 (;@1;) + end + end) + (func (;46;) (type 1) (result i32) + block (result i32) ;; label = @1 + loop (result i32) ;; label = @2 + i32.const 0 + i32.const 9 + i32.const 1 + br_if 1 (;@1;) + drop + end + end) + (func (;47;) (type 1) (result i32) + block (result i32) ;; label = @1 + loop (result i32) ;; label = @2 + f32.const 0x0p+0 (;=0;) + i32.const 9 + i32.const 0 + br_table 1 (;@1;) 1 (;@1;) + end + end) + (func (;48;) (type 1) (result i32) + loop (result i32) ;; label = @1 + f32.const 0x0p+0 (;=0;) + i32.const 9 + return + end) + (export \"func-unwind-by-unreachable\" (func 0)) + (export \"func-unwind-by-br\" (func 1)) + (export \"func-unwind-by-br-value\" (func 2)) + (export \"func-unwind-by-br_if\" (func 3)) + (export \"func-unwind-by-br_if-value\" (func 4)) + (export \"func-unwind-by-br_table\" (func 5)) + (export \"func-unwind-by-br_table-value\" (func 6)) + (export \"func-unwind-by-return\" (func 7)) + (export \"block-unwind-by-unreachable\" (func 8)) + (export \"block-unwind-by-br\" (func 9)) + (export \"block-unwind-by-br-value\" (func 10)) + (export \"block-unwind-by-br_if\" (func 11)) + (export \"block-unwind-by-br_if-value\" (func 12)) + (export \"block-unwind-by-br_table\" (func 13)) + (export \"block-unwind-by-br_table-value\" (func 14)) + (export \"block-unwind-by-return\" (func 15)) + (export \"block-nested-unwind-by-unreachable\" (func 16)) + (export \"block-nested-unwind-by-br\" (func 17)) + (export \"block-nested-unwind-by-br-value\" (func 18)) + (export \"block-nested-unwind-by-br_if\" (func 19)) + (export \"block-nested-unwind-by-br_if-value\" (func 20)) + (export \"block-nested-unwind-by-br_table\" (func 21)) + (export \"block-nested-unwind-by-br_table-value\" (func 22)) + (export \"block-nested-unwind-by-return\" (func 23)) + (export \"unary-after-unreachable\" (func 24)) + (export \"unary-after-br\" (func 25)) + (export \"unary-after-br_if\" (func 26)) + (export \"unary-after-br_table\" (func 27)) + (export \"unary-after-return\" (func 28)) + (export \"binary-after-unreachable\" (func 29)) + (export \"binary-after-br\" (func 30)) + (export \"binary-after-br_if\" (func 31)) + (export \"binary-after-br_table\" (func 32)) + (export \"binary-after-return\" (func 33)) + (export \"select-after-unreachable\" (func 34)) + (export \"select-after-br\" (func 35)) + (export \"select-after-br_if\" (func 36)) + (export \"select-after-br_table\" (func 37)) + (export \"select-after-return\" (func 38)) + (export \"block-value-after-unreachable\" (func 39)) + (export \"block-value-after-br\" (func 40)) + (export \"block-value-after-br_if\" (func 41)) + (export \"block-value-after-br_table\" (func 42)) + (export \"block-value-after-return\" (func 43)) + (export \"loop-value-after-unreachable\" (func 44)) + (export \"loop-value-after-br\" (func 45)) + (export \"loop-value-after-br_if\" (func 46)) + (export \"loop-value-after-br_table\" (func 47)) + (export \"loop-value-after-return\" (func 48))) + "; + 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") +} + +fn start_module_1(result_object: &ResultObject) { + result_object.instance.start(); +} + +// Line 212 +fn c1_l212_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c1_l212_action_invoke"); + let func_index = match result_object.module.info.exports.get("func-unwind-by-unreachable") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + +} + +#[test] +fn c1_l212_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c1_l212_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 213 +fn c2_l213_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c2_l213_action_invoke"); + let func_index = match result_object.module.info.exports.get("func-unwind-by-br") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, ()); +} + +// Line 214 +fn c3_l214_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c3_l214_action_invoke"); + let func_index = match result_object.module.info.exports.get("func-unwind-by-br-value") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 215 +fn c4_l215_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c4_l215_action_invoke"); + let func_index = match result_object.module.info.exports.get("func-unwind-by-br_if") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, ()); +} + +// Line 216 +fn c5_l216_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c5_l216_action_invoke"); + let func_index = match result_object.module.info.exports.get("func-unwind-by-br_if-value") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 217 +fn c6_l217_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c6_l217_action_invoke"); + let func_index = match result_object.module.info.exports.get("func-unwind-by-br_table") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, ()); +} + +// Line 218 +fn c7_l218_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c7_l218_action_invoke"); + let func_index = match result_object.module.info.exports.get("func-unwind-by-br_table-value") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 219 +fn c8_l219_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c8_l219_action_invoke"); + let func_index = match result_object.module.info.exports.get("func-unwind-by-return") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 221 +fn c9_l221_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c9_l221_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-unwind-by-unreachable") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + +} + +#[test] +fn c9_l221_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c9_l221_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 222 +fn c10_l222_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c10_l222_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-unwind-by-br") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 223 +fn c11_l223_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c11_l223_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-unwind-by-br-value") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 224 +fn c12_l224_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c12_l224_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-unwind-by-br_if") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 225 +fn c13_l225_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c13_l225_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-unwind-by-br_if-value") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 226 +fn c14_l226_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c14_l226_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-unwind-by-br_table") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 227 +fn c15_l227_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c15_l227_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-unwind-by-br_table-value") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 228 +fn c16_l228_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c16_l228_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-unwind-by-return") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 230 +fn c17_l230_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c17_l230_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-nested-unwind-by-unreachable") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + +} + +#[test] +fn c17_l230_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c17_l230_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 231 +fn c18_l231_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c18_l231_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-nested-unwind-by-br") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 232 +fn c19_l232_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c19_l232_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-nested-unwind-by-br-value") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 233 +fn c20_l233_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c20_l233_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-nested-unwind-by-br_if") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 234 +fn c21_l234_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c21_l234_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-nested-unwind-by-br_if-value") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 235 +fn c22_l235_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c22_l235_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-nested-unwind-by-br_table") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 236 +fn c23_l236_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c23_l236_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-nested-unwind-by-br_table-value") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 237 +fn c24_l237_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c24_l237_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-nested-unwind-by-return") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 239 +fn c25_l239_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c25_l239_action_invoke"); + let func_index = match result_object.module.info.exports.get("unary-after-unreachable") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + +} + +#[test] +fn c25_l239_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c25_l239_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 240 +fn c26_l240_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c26_l240_action_invoke"); + let func_index = match result_object.module.info.exports.get("unary-after-br") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 241 +fn c27_l241_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c27_l241_action_invoke"); + let func_index = match result_object.module.info.exports.get("unary-after-br_if") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 242 +fn c28_l242_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c28_l242_action_invoke"); + let func_index = match result_object.module.info.exports.get("unary-after-br_table") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 243 +fn c29_l243_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c29_l243_action_invoke"); + let func_index = match result_object.module.info.exports.get("unary-after-return") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 245 +fn c30_l245_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c30_l245_action_invoke"); + let func_index = match result_object.module.info.exports.get("binary-after-unreachable") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + +} + +#[test] +fn c30_l245_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c30_l245_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 246 +fn c31_l246_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c31_l246_action_invoke"); + let func_index = match result_object.module.info.exports.get("binary-after-br") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 247 +fn c32_l247_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c32_l247_action_invoke"); + let func_index = match result_object.module.info.exports.get("binary-after-br_if") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 248 +fn c33_l248_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c33_l248_action_invoke"); + let func_index = match result_object.module.info.exports.get("binary-after-br_table") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 249 +fn c34_l249_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c34_l249_action_invoke"); + let func_index = match result_object.module.info.exports.get("binary-after-return") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 251 +fn c35_l251_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c35_l251_action_invoke"); + let func_index = match result_object.module.info.exports.get("select-after-unreachable") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + +} + +#[test] +fn c35_l251_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c35_l251_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 252 +fn c36_l252_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c36_l252_action_invoke"); + let func_index = match result_object.module.info.exports.get("select-after-br") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 253 +fn c37_l253_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c37_l253_action_invoke"); + let func_index = match result_object.module.info.exports.get("select-after-br_if") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 254 +fn c38_l254_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c38_l254_action_invoke"); + let func_index = match result_object.module.info.exports.get("select-after-br_table") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 255 +fn c39_l255_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c39_l255_action_invoke"); + let func_index = match result_object.module.info.exports.get("select-after-return") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 257 +fn c40_l257_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c40_l257_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-value-after-unreachable") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + +} + +#[test] +fn c40_l257_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c40_l257_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 258 +fn c41_l258_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c41_l258_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-value-after-br") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 259 +fn c42_l259_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c42_l259_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-value-after-br_if") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 260 +fn c43_l260_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c43_l260_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-value-after-br_table") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 261 +fn c44_l261_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c44_l261_action_invoke"); + let func_index = match result_object.module.info.exports.get("block-value-after-return") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 263 +fn c45_l263_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c45_l263_action_invoke"); + let func_index = match result_object.module.info.exports.get("loop-value-after-unreachable") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + +} + +#[test] +fn c45_l263_assert_trap() { + let result_object = create_module_1(); + let result = call_protected!(c45_l263_action_invoke(&result_object)); + assert!(result.is_err()); +} + +// Line 264 +fn c46_l264_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c46_l264_action_invoke"); + let func_index = match result_object.module.info.exports.get("loop-value-after-br") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 265 +fn c47_l265_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c47_l265_action_invoke"); + let func_index = match result_object.module.info.exports.get("loop-value-after-br_if") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 266 +fn c48_l266_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c48_l266_action_invoke"); + let func_index = match result_object.module.info.exports.get("loop-value-after-br_table") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +// Line 267 +fn c49_l267_action_invoke(result_object: &ResultObject) { + println!("Executing function {}", "c49_l267_action_invoke"); + let func_index = match result_object.module.info.exports.get("loop-value-after-return") { + Some(&Export::Function(index)) => index, + _ => panic!("Function not found"), + }; + let invoke_fn: fn(&Instance) -> i32 = get_instance_function!(result_object.instance, func_index); + let result = invoke_fn(&result_object.instance); + assert_eq!(result, 9 as i32); +} + +#[test] +fn test_module_1() { + let result_object = create_module_1(); + // We group the calls together + start_module_1(&result_object); + c2_l213_action_invoke(&result_object); + c3_l214_action_invoke(&result_object); + c4_l215_action_invoke(&result_object); + c5_l216_action_invoke(&result_object); + c6_l217_action_invoke(&result_object); + c7_l218_action_invoke(&result_object); + c8_l219_action_invoke(&result_object); + c10_l222_action_invoke(&result_object); + c11_l223_action_invoke(&result_object); + c12_l224_action_invoke(&result_object); + c13_l225_action_invoke(&result_object); + c14_l226_action_invoke(&result_object); + c15_l227_action_invoke(&result_object); + c16_l228_action_invoke(&result_object); + c18_l231_action_invoke(&result_object); + c19_l232_action_invoke(&result_object); + c20_l233_action_invoke(&result_object); + c21_l234_action_invoke(&result_object); + c22_l235_action_invoke(&result_object); + c23_l236_action_invoke(&result_object); + c24_l237_action_invoke(&result_object); + c26_l240_action_invoke(&result_object); + c27_l241_action_invoke(&result_object); + c28_l242_action_invoke(&result_object); + c29_l243_action_invoke(&result_object); + c31_l246_action_invoke(&result_object); + c32_l247_action_invoke(&result_object); + c33_l248_action_invoke(&result_object); + c34_l249_action_invoke(&result_object); + c36_l252_action_invoke(&result_object); + c37_l253_action_invoke(&result_object); + c38_l254_action_invoke(&result_object); + c39_l255_action_invoke(&result_object); + c41_l258_action_invoke(&result_object); + c42_l259_action_invoke(&result_object); + c43_l260_action_invoke(&result_object); + c44_l261_action_invoke(&result_object); + c46_l264_action_invoke(&result_object); + c47_l265_action_invoke(&result_object); + c48_l266_action_invoke(&result_object); + c49_l267_action_invoke(&result_object); +}