From d9cdd0b53c870bf7d9d69b854b8da2692d152871 Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Wed, 15 May 2024 13:38:13 +0200 Subject: feat: v0.7.0 (#13) * Remove all unsafe code * Refactor interpreter loop * Optimize Call-frames * Remove unnecessary reference counter data from store --------- Signed-off-by: Henry Gressmann --- examples/rust/Cargo.toml | 2 +- examples/rust/analyze.py | 9 ++++----- examples/rust/build.sh | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'examples/rust') diff --git a/examples/rust/Cargo.toml b/examples/rust/Cargo.toml index f3f475e..f88fde4 100644 --- a/examples/rust/Cargo.toml +++ b/examples/rust/Cargo.toml @@ -10,7 +10,7 @@ forced-target="wasm32-unknown-unknown" edition="2021" [dependencies] -tinywasm={path="../../crates/tinywasm", features=["parser", "std", "unsafe"]} +tinywasm={path="../../crates/tinywasm", features=["parser", "std", "nightly"]} argon2={version="0.5"} [[bin]] diff --git a/examples/rust/analyze.py b/examples/rust/analyze.py index a134a00..a813c1c 100644 --- a/examples/rust/analyze.py +++ b/examples/rust/analyze.py @@ -2,15 +2,14 @@ import re import sys from collections import Counter -seq_len = 5 - # Check if a file path was provided -if len(sys.argv) < 2: - print("Usage: python script.py path/to/yourfile.wat") +if len(sys.argv) < 3: + print("Usage: python script.py sequence_length path/to/yourfile.wat") sys.exit(1) # The first command line argument is the file path -file_path = sys.argv[1] +seq_len = int(sys.argv[1]) +file_path = sys.argv[2] # Regex to match WASM operators, adjust as necessary operator_pattern = re.compile(r"\b[a-z0-9_]+\.[a-z0-9_]+\b") diff --git a/examples/rust/build.sh b/examples/rust/build.sh index 5028741..9c1f77d 100755 --- a/examples/rust/build.sh +++ b/examples/rust/build.sh @@ -15,7 +15,7 @@ for bin in "${bins[@]}"; do RUSTFLAGS="-C target-feature=$features -C panic=abort" cargo build --target wasm32-unknown-unknown --package rust-wasm-examples --profile=wasm --bin "$bin" cp "$out_dir/$bin.wasm" "$dest_dir/" - wasm-opt "$dest_dir/$bin.wasm" -o "$dest_dir/$bin.wasm" -Oz --enable-bulk-memory --enable-reference-types --enable-mutable-globals + wasm-opt "$dest_dir/$bin.wasm" -o "$dest_dir/$bin.wasm" -O3 --enable-bulk-memory --enable-reference-types --enable-mutable-globals if [[ ! " ${exclude_wat[@]} " =~ " $bin " ]]; then wasm2wat "$dest_dir/$bin.wasm" -o "$dest_dir/$bin.wat" -- cgit v1.3.1