summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry <mail@henrygressmann.de>2026-09-14 11:14:37 +0200
committerHenry <mail@henrygressmann.de>2026-09-14 11:14:37 +0200
commit70b4ca7b8effb5b8f61c7a43ea15a77af0db0103 (patch)
tree747c29744b3afa3512c99ce17511dfffdb092506
parent437a77c8d9e9286a7ca7993b6c8b85e7feb6ebdd (diff)
chore: update changelog, fix clippy issues
Signed-off-by: Henry <mail@henrygressmann.de>
-rw-r--r--CHANGELOG.md64
-rw-r--r--crates/tinywasm/Cargo.toml2
-rw-r--r--crates/types/src/archive.rs4
-rw-r--r--examples/rust.rs14
-rw-r--r--examples/rust/Cargo.toml4
-rwxr-xr-xexamples/rust/build.sh4
-rw-r--r--examples/rust/src/print.twasmbin155 -> 155 bytes
7 files changed, 55 insertions, 37 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d674c30..a37655e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,23 +7,56 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+This release adds garbage collection and typed function reference support, single-pass parsing, and an optional tail-call dispatch backend. The internal instruction representation is now 8 bytes, down from 16, and pluggable memory backends were removed for performance reasons (however, `ResourceLimiter` was added to allow, reject, or trap memory allocation and growth requests).
+
+### Breaking Changes
+
+#### Functions and references
+
+- `Function::call` and `Function::call_resumable` now write to caller-provided result slices. Untyped host callbacks also receive a result slice and return `Result<()>`.
+- Creating a `HostFunction` no longer requires a `Store`. Definitions require `Send + Sync` and can be reused across stores.
+- Module instantiation now borrows `Imports`, allowing the same imports to be reused.
+- `HostFunction::ty` and `WasmFunction::ty` were removed. Use `Function::ty(&Store)` for runtime types.
+- Function and managed reference handles are tied to their originating `Store`. Managed references keep their referents live, so `WasmValue` is no longer `Copy`.
+- Nullable typed references use `Option<T>`, while bare typed references are non-null.
+- `WasmTupleChain` was removed. Use direct tuples up to arity 20 or untyped functions for larger signatures.
+- `ToWasmTypes` was renamed to `WasmTypes`, and `ToWasmType` was renamed to `WasmValueType`.
+- Conversion traits now include `WasmTypes`, and `FromWasmValues::from_wasm_values` rejects unconsumed values directly.
+
+#### Memory, tables, and stores
+
+- Pluggable memory backends and `Config::with_trap_on_oom` were removed for performance reasons. Linear memory is always `Vec`-backed. Use `ResourceLimiter` to allow, reject, or trap memory allocation and growth requests.
+- The `Memory`, `Table`, `Global`, and `Tag` constructors were renamed from `new` to `try_new`.
+- Element types now use `RefType`, and module definitions use `TableDefinition { ty, init }`.
+- `Table::grow` now returns `Result<Option<usize>>`, matching `Memory::grow`.
+- `Store::id` now returns `u32`, and `ModuleInstanceAddr` was renamed to `ModuleInstanceId`.
+
+#### Parser and archives
+
+- `Parser::new` now takes `ParserOptions`. Use `Parser::default()` for default settings.
+- `Parser::with_options` was removed.
+- `ParserOptions::optimize_rewrite` was renamed to `ParserOptions::optimize`.
+- `ParserOptions::parser_threads` was renamed to `ParserOptions::threads`.
+- The `.twasm` format changed. Regenerate archives created by earlier TinyWasm versions.
+
### Added
- Support for the typed function references, garbage collection, exception handling, and compact import section proposals.
-- `ResourceLimiter` callbacks for memory and table allocation or growth
-- A default `validate` Cargo feature & parser option to skip wasm validation
-- Optional parse-time operand deduplication to reduce `.twasm` archive size
-- Optional `send` support for moving stores and store-local handles across threads
-- Optional portable atomic shared pointers and counters for targets without native compare-and-swap
-- Optional `nightly-tail-calls` backend using Rust's unstable explicit tail calls for interpreter dispatch
+- `ResourceLimiter` callbacks for memory and table allocation or growth.
+- A default-enabled `validate` Cargo feature and a parser option to skip WebAssembly validation.
+- Optional parse-time operand deduplication to reduce `.twasm` archive size.
+- Optional `send` support for moving stores and store-local handles across threads.
+- Optional portable atomic shared pointers and counters for targets without native compare-and-swap.
+- Optional `nightly-tail-calls` backend using Rust's unstable explicit tail calls for interpreter dispatch.
### Changed
+- Parsing now uses a single pass.
- Typed functions now support tuples up to arity 20 and `[u8; 16]` values for `v128`.
-- Module types now use one recursive type space. Runtime function types are available through `Function::ty(&Store)`.
+- Module types now use one recursive type space.
- Linear memory now uses contiguous `Vec`-backed storage.
+- The internal instruction representation was reduced from 16 to 8 bytes.
- The minimum supported Rust version increased from 1.95 to 1.98.
-- The internal instruction represetaions size was reduced from 16 to 8 bytes.
### Fixed
@@ -33,21 +66,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `memory.init` now performs correct bounds checks and operand lowering.
- Memory64 now uses the correct default limits and host-size conversions, including on 32-bit targets.
-### Breaking Changes
-
-- `Function::call` and `Function::call_resumable` now write to caller-provided result slices. Untyped host callbacks also receive a result slice and return `Result<()>`.
-- Creating a `HostFunction` no longer requires a `Store`. Definitions require `Send + Sync` and can be reused across stores. Module instantiation now borrows `Imports` so the same imports can also be reused.
-- `HostFunction::ty` and `WasmFunction::ty` were removed. Use `Function::ty(&Store)` for runtime types.
-- Function and managed reference handles are tied to their originating `Store`. Managed references keep their referents live, so `WasmValue` is no longer `Copy`. Nullable typed references use `Option<T>`, while bare typed references are non-null.
-- The `Memory`, `Table`, `Global`, and `Tag` constructors were renamed from `new` to `try_new`.
-- `Store::id` now returns `u32`, and `ModuleInstanceAddr` was renamed to `ModuleInstanceId`.
-- Element types now use `RefType`, and module definitions use `TableDefinition { ty, init }`. `Table::grow` now returns `Result<Option<usize>>`, matching `Memory::grow`.
-- `Parser::new` now takes `ParserOptions`. Use `Parser::default()` for default settings. `Parser::with_options` was removed.
-- Pluggable memory backends and `Config::with_trap_on_oom` were removed for performance reasons. Linear memory is always `Vec`-backed. Use `ResourceLimiter` to allow, reject, or trap memory allocation and growth requests.
-- `WasmTupleChain` was removed. Use direct tuples up to arity 20 or untyped functions for larger signatures.
-- `ToWasmTypes` was renamed to `WasmTypes`, and `ToWasmType` was renamed to `WasmValueType`. Conversion traits now include `WasmTypes`, and `FromWasmValues::from_wasm_values` rejects unconsumed values directly.
-- The `.twasm` format changed. Regenerate archives created by earlier TinyWasm versions.
-
## [0.10.0] - 2026-07-24
**All Commits**: https://github.com/explodingcamera/tinywasm/compare/v0.9.1...v0.10.0
diff --git a/crates/tinywasm/Cargo.toml b/crates/tinywasm/Cargo.toml
index 15744a3..d59d3dd 100644
--- a/crates/tinywasm/Cargo.toml
+++ b/crates/tinywasm/Cargo.toml
@@ -90,7 +90,7 @@ wat.workspace = true
[features]
default = ["full", "std"]
-full = ["archive", "parallel-parser", "parser", "validate"]
+full = ["archive", "debug", "parallel-parser", "parser", "validate"]
log = ["dep:log", "tinywasm-parser?/log"]
std = ["tinywasm-parser?/std", "tinywasm-types/std"]
diff --git a/crates/types/src/archive.rs b/crates/types/src/archive.rs
index bdce379..6a03605 100644
--- a/crates/types/src/archive.rs
+++ b/crates/types/src/archive.rs
@@ -7,7 +7,7 @@ use crate::Module;
#[rustfmt::skip]
const TWASM_MAGIC: [u8; 16] = [ TWASM_MAGIC_PREFIX[0], TWASM_MAGIC_PREFIX[1], TWASM_MAGIC_PREFIX[2], TWASM_MAGIC_PREFIX[3], TWASM_VERSION[0], TWASM_VERSION[1], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
const TWASM_MAGIC_PREFIX: &[u8; 4] = b"TWAS";
-const TWASM_VERSION: &[u8; 2] = b"06";
+const TWASM_VERSION: &[u8; 2] = b"05";
fn validate_magic(wasm: &[u8]) -> Result<usize, TwasmError> {
if wasm.len() < TWASM_MAGIC.len() || &wasm[..TWASM_MAGIC_PREFIX.len()] != TWASM_MAGIC_PREFIX {
@@ -97,7 +97,7 @@ mod tests {
let module = Module::from(ModuleInner { funcs: Box::new([Shared::new(function)]), ..ModuleInner::default() });
let archive = module.serialize_twasm().expect("serialize archive");
- assert_eq!(&archive[..6], b"TWAS06");
+ assert_eq!(&archive[..6], b"TWAS05");
let decoded = Module::try_from_twasm(&archive).expect("deserialize archive");
let function = &decoded.funcs[0];
diff --git a/examples/rust.rs b/examples/rust.rs
index 24b3b73..77ba428 100644
--- a/examples/rust.rs
+++ b/examples/rust.rs
@@ -32,10 +32,10 @@ fn main() -> Result<()> {
println!("Available examples:");
println!(" hello");
println!(" printi32");
- println!(" host_fn");
+ println!(" host-fn");
println!(" fibonacci - calculate fibonacci(30)");
println!(" tinywasm - run printi32 inside of tinywasm inside of itself");
- println!(" tinywasm_no_std - run a precompiled module inside of no_std tinywasm");
+ println!(" tinywasm-no-std - run a precompiled module inside of no_std tinywasm");
println!(" argon2id - run argon2id(1000, 2, 1)");
return Ok(());
}
@@ -45,9 +45,9 @@ fn main() -> Result<()> {
"printi32" => printi32()?,
"fibonacci" => fibonacci()?,
"tinywasm" => tinywasm()?,
- "tinywasm_no_std" => tinywasm_no_std()?,
+ "tinywasm-no-std" => tinywasm_no_std()?,
"argon2id" => argon2id()?,
- "host_fn" => host_fn()?,
+ "host-fn" => host_fn()?,
"all" => {
println!("Running all examples");
println!("\nhello.wasm:");
@@ -58,11 +58,11 @@ fn main() -> Result<()> {
fibonacci()?;
println!("\ntinywasm.wasm:");
tinywasm()?;
- println!("\ntinywasm_no_std.wasm:");
+ println!("\ntinywasm-no-std.wasm:");
tinywasm_no_std()?;
println!("argon2id.wasm:");
argon2id()?;
- println!("\nhost_fn.wasm:");
+ println!("\nhost-fn.wasm:");
host_fn()?;
}
_ => {}
@@ -129,7 +129,7 @@ fn hello() -> Result<()> {
}
fn host_fn() -> Result<()> {
- let module = tinywasm::parse_file("./examples/rust/out/host_fn.opt.wasm")?;
+ let module = tinywasm::parse_file("./examples/rust/out/host-fn.opt.wasm")?;
let mut store = Store::default();
let bar = HostFunction::from(|_: FuncContext<'_>, (left, right): (i64, i32)| {
diff --git a/examples/rust/Cargo.toml b/examples/rust/Cargo.toml
index e0bdba6..74d38e7 100644
--- a/examples/rust/Cargo.toml
+++ b/examples/rust/Cargo.toml
@@ -11,7 +11,7 @@ name = "hello"
path = "src/hello.rs"
[[bin]]
-name = "host_fn"
+name = "host-fn"
path = "src/host_fn.rs"
[[bin]]
@@ -23,7 +23,7 @@ name = "tinywasm"
path = "src/tinywasm.rs"
[[bin]]
-name = "tinywasm_no_std"
+name = "tinywasm-no-std"
path = "src/tinywasm_no_std.rs"
[[bin]]
diff --git a/examples/rust/build.sh b/examples/rust/build.sh
index 873028f..aa60d33 100755
--- a/examples/rust/build.sh
+++ b/examples/rust/build.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
cd "$(dirname "$0")" || exit
-bins=("host_fn" "hello" "fibonacci" "print" "tinywasm" "argon2id")
+bins=("host-fn" "hello" "fibonacci" "print" "tinywasm" "argon2id")
exclude_wat=("tinywasm")
out_dir="./target/wasm32-unknown-unknown/wasm"
dest_dir="out"
@@ -17,7 +17,7 @@ cargo run --quiet --manifest-path "../../Cargo.toml" --package tinywasm-cli -- \
compile "src/print.wasm" --output "src/print.twasm" --force || exit
# build no_std
-RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none -C target-feature=$rust_features -C panic=abort" cargo build -Z build-std=core,alloc,panic_abort -Z build-std-features="optimize_for_size" --target wasm32-unknown-unknown --package rust-wasm-examples --profile=wasm --bin tinywasm_no_std --no-default-features
+RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none -C target-feature=$rust_features -C panic=abort" cargo build -Z build-std=core,alloc,panic_abort -Z build-std-features="optimize_for_size" --target wasm32-unknown-unknown --package rust-wasm-examples --profile=wasm --bin tinywasm-no-std --no-default-features
cp "$out_dir/tinywasm_no_std.wasm" "$dest_dir/"
wasm-opt "$dest_dir/tinywasm_no_std.wasm" -o "$dest_dir/tinywasm_no_std.opt.wasm" -O3 $wasmopt_features
diff --git a/examples/rust/src/print.twasm b/examples/rust/src/print.twasm
index 967eda1..8ad32e3 100644
--- a/examples/rust/src/print.twasm
+++ b/examples/rust/src/print.twasm
Binary files differ