A tiny WebAssembly runtime written in safe Rust
Repo explodingcamera/tinywasm, read from GitHub 1 min ago. explodingcamera has not joined Take My Repo.
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).
Function::call and Function::call_resumable now write to caller-provided result slices. Untyped host callbacks also receive a result slice and return Result<()>.HostFunction no longer requires a Store. Definitions require Send + Sync and can be reused across stores.Imports, allowing the same imports to be reused.HostFunction::ty and WasmFunction::ty were removed. Use Function::ty(&Store) for runtime types.Store. Managed references keep their referents live, so WasmValue is no longer Copy.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.WasmTypes, and FromWasmValues::from_wasm_values rejects unconsumed values directly.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.Memory, Table, Global, and Tag constructors were renamed from new to try_new.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::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..twasm format changed. Regenerate archives created by earlier TinyWasm versions.Store::with_state, Store::state, and Store::state_mut.ResourceLimiter callbacks for memory and table allocation or growth.validate Cargo feature and a parser option to skip WebAssembly validation..twasm archive size.send support for moving stores and store-local handles across threads.nightly-tail-calls backend using Rust's unstable explicit tail calls for interpreter dispatch.[u8; 16] values for v128.Vec-backed storage.Store.memory.init now performs correct bounds checks and operand lowering.See CHANGELOG
All Commits: v0.9.1...v0.10.0
ParserOptions::validation to optionally skip wasmparser validation.instantiate / start / start_func no longer fall back to _start if the module has no start section. The CLI still uses _start as its default entry point (fixes #46).optimize_remove_nop option and accessors.Instruction variants and the .twasm format. Existing archives must be regenerated.TableType limits now use u64. Use TableType::new or TableType::new64 instead of struct literals.ToWasmTypes now uses an associated constant, and wasm_types returns Cow.LinearMemory now uses a single usize address and changed its fixed-width read/write signatures.FuncContext::call and FuncContext::call_untyped.Function::call and Function::call_resumable calls during an active invocation now trap instead of corrupting the active call/value stacks. While this is technically a breaking change, it prevents stack corruption and is a necessary safety fix. Use FuncContext::call or FuncContext::call_untyped for reentrant calls instead.All Commits: v0.8.0...v0.9.0
This release is a major runtime and API rework. It adds support for several newer WebAssembly proposals, introduces the new Engine configuration API, rewrites large parts of execution and validation, and changes the internal twasm archive format. Benchmarks in the repository currently show roughly 30-90% improvement over 0.8.0 depending on workload and execution mode.
custom_page_sizes proposal (#22 by @danielstuart14)tail_call, memory64, simd, relaxed_simd, wide_arithmetic, and extended_const proposals (#37, #38, #39)Engine API (tinywasm::Engine and engine::Config) for runtime configurationcall_resumable, resume_with_fuel, resume_with_time_budget, and ExecProgressFuncContext::charge_fuel and FuncContext::remaining_fuelengine::Config support for fuel policy, stack sizing, memory backend selection, and trap-on-OOM behaviorcanonicalize-nans, simd-x86, guest-debug, debug, and parallel-parserparser feature: parse_bytes, parse_file, and parse_streamtinywasm cliStore::new now takes an Engine, use Store::default() for default settings.ModuleInstance::func now validates exact Wasm signatures at lookup time and fails immediately on mismatches.engine::Configguest-debugDebug implementations are now gated behind debug.Error, Trap, and LinkingError are now #[non_exhaustive].HostFunction::new, HostFunction::func, and HostFunction::typed now require &mut Store, and Imports::link_module now takes a ModuleInstance instead of a raw module instance id.tinywasm-parser to parser and from logging to log.Error::ParseError was renamed to Error::Parser, and Error::Twasm was added.FuncHandle and FuncHandleTyped were renamed to Function and FunctionTyped, and module export lookups moved from exported_* to func_untyped, func, and memory.twasm archive format is now based on postcard (backwards-incompatible with previous versions) (thanks @dragonnn).simd was removed.RefNull was removed and replaced with FuncRef and ExternRef.tinywasm::interpreter is no longer a public module.InterpreterRuntime and TinyWasmValue are no longer public API.FuncHandle::name was removed.ModuleInstance export lookup variants memory_mut, table_mut, global_mut, and extern_item_mut were removed.ModuleInstance::memory and FuncContext::memory now take a non-mut reference to self (#41).MemoryRefMut::copy_within(src, dst, len) now follows its documented argument order.Extern::table(ty, init) now honor the provided init value.Store::new() with Store::default() for default settings, or Store::new(Engine::new(config)) for custom runtime configuration.tinywasm-parser to parser and logging to log.FuncHandle to Function and FuncHandleTyped to FunctionTyped.exported_* methods to func, func_untyped, and memory.twasm archives, the format is not backwards compatible with earlier releases.See CHANGELOG.md