From 68f85f6d2ed5870e497a5e87a40ec4e3f440984f Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 12 Aug 2026 18:10:07 +0200 Subject: chore: simplify validator feature set, allow compact imports Signed-off-by: Henry --- CHANGELOG.md | 1 + crates/parser/src/lib.rs | 26 +++++--------------------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64366f4..51f68d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added support for the WebAssembly function-references proposal - Added basic support for the WebAssembly garbage-collection proposal - Added support for the WebAssembly exception-handling proposal, including tags, `try_table`, `throw`, and `throw_ref` +- Added support for the WebAssembly compact-imports proposal - Added `WasmValue::ty` and `WasmValue::matches_type` - Added `ValueLane` for mapping WebAssembly value types to their physical 32-bit, 64-bit, or 128-bit storage lane. - Added a `validate` feature to `tinywasm` and `tinywasm-parser` (enabled by default) to optionally skip wasmparser validation for faster parsing of trusted modules. diff --git a/crates/parser/src/lib.rs b/crates/parser/src/lib.rs index 8b6cb39..8db7920 100644 --- a/crates/parser/src/lib.rs +++ b/crates/parser/src/lib.rs @@ -170,27 +170,11 @@ impl Parser { fn validator(&self) -> Option { #[cfg(feature = "validate")] { - let features = WasmFeatures::CALL_INDIRECT_OVERLONG - | WasmFeatures::BULK_MEMORY_OPT - | WasmFeatures::RELAXED_SIMD - | WasmFeatures::GC_TYPES - | WasmFeatures::GC - | WasmFeatures::REFERENCE_TYPES - | WasmFeatures::MUTABLE_GLOBAL - | WasmFeatures::MULTI_VALUE - | WasmFeatures::FLOATS - | WasmFeatures::BULK_MEMORY - | WasmFeatures::SATURATING_FLOAT_TO_INT - | WasmFeatures::SIGN_EXTENSION - | WasmFeatures::EXTENDED_CONST - | WasmFeatures::FUNCTION_REFERENCES - | WasmFeatures::TAIL_CALL - | WasmFeatures::MULTI_MEMORY - | WasmFeatures::SIMD - | WasmFeatures::MEMORY64 - | WasmFeatures::CUSTOM_PAGE_SIZES - | WasmFeatures::EXCEPTIONS - | WasmFeatures::WIDE_ARITHMETIC; + let features = WasmFeatures::WASM3 + .difference(WasmFeatures::THREADS) + .union(WasmFeatures::CUSTOM_PAGE_SIZES) + .union(WasmFeatures::WIDE_ARITHMETIC) + .union(WasmFeatures::COMPACT_IMPORTS); self.options.validation().then(|| Validator::new_with_features(features)) } #[cfg(not(feature = "validate"))] -- cgit v1.3.1