1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
|
Description: use older versions of wasm-tools crates
This essentially reverts upstream git commit 1256cfa.
Author: Jonas Smedegaard <dr@jones.dk>
Bug-Debian: https://bugs.debian.org/1095699
Forwarded: not-needed
Last-Update: 2025-11-20
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -269,16 +269,16 @@
wit-bindgen-rust-macro = { version = "0.35.0", default-features = false }
# wasm-tools family:
-wasmparser = { version = "0.221.2", default-features = false, features = ['simd'] }
-wat = "1.221.2"
-wast = "221.0.2"
-wasmprinter = "0.221.2"
-wasm-encoder = "0.221.2"
-wasm-smith = "0.221.2"
-wasm-mutate = "0.221.2"
-wit-parser = "0.221.2"
-wit-component = "0.221.2"
-wasm-wave = "0.221.2"
+wasmparser = { version = "0.220.0", default-features = false }
+wat = "1.220.0"
+wast = "220.0.0"
+wasmprinter = "0.220.0"
+wasm-encoder = "0.220.0"
+wasm-smith = "0.220.0"
+wasm-mutate = "0.220.0"
+wit-parser = "0.220.0"
+wit-component = "0.220.0"
+wasm-wave = "0.220.0"
# Non-Bytecode Alliance maintained dependencies:
# --------------------------
--- a/crates/cranelift/src/translate/code_translator.rs
+++ b/crates/cranelift/src/translate/code_translator.rs
@@ -2944,9 +2944,6 @@
let (res1, res2) = builder.ins().isplit(result);
state.push2(res1, res2);
}
-
- // catch-all as `Operator` is `#[non_exhaustive]`
- op => return Err(wasm_unsupported!("operator {op:?}")),
};
Ok(())
}
--- a/crates/wast-util/src/lib.rs
+++ b/crates/wast-util/src/lib.rs
@@ -320,11 +320,14 @@
"spec_testsuite/ref_is_null.wast",
"spec_testsuite/ref_null.wast",
"spec_testsuite/select.wast",
+ "spec_testsuite/table-sub.wast",
"spec_testsuite/table_fill.wast",
"spec_testsuite/table_get.wast",
"spec_testsuite/table_grow.wast",
"spec_testsuite/table_set.wast",
"spec_testsuite/table_size.wast",
+ "spec_testsuite/unreached-invalid.wast",
+ "spec_testsuite/call_indirect.wast",
// simd-related failures
"annotations/simd_lane.wast",
"memory64/simd.wast",
@@ -405,7 +408,7 @@
for part in self.path.iter() {
// Not implemented in Wasmtime yet
if part == "exception-handling" {
- return !self.path.ends_with("binary.wast") && !self.path.ends_with("exports.wast");
+ return !self.path.ends_with("binary.wast");
}
if part == "memory64" {
@@ -413,6 +416,7 @@
// wasmtime doesn't implement exceptions yet
"imports.wast",
"ref_null.wast",
+ "exports.wast",
"throw.wast",
"throw_ref.wast",
"try_table.wast",
--- a/crates/wast/src/wast.rs
+++ b/crates/wast/src/wast.rs
@@ -523,7 +523,7 @@
Err(e) => e,
};
let error_message = format!("{err:?}");
- if !is_matching_assert_invalid_error_message(filename, &message, &error_message) {
+ if !is_matching_assert_invalid_error_message(&message, &error_message) {
bail!(
"assert_invalid: expected \"{}\", got \"{}\"",
message,
@@ -612,23 +612,19 @@
}
}
-fn is_matching_assert_invalid_error_message(test: &str, expected: &str, actual: &str) -> bool {
- if actual.contains(expected) {
- return true;
- }
-
- // Historically wasmtime/wasm-tools tried to match the upstream error
- // message. This generally led to a large sequence of matches here which is
- // not easy to maintain and is particularly difficult when test suites and
- // proposals conflict with each other (e.g. one asserts one error message
- // and another asserts a different error message). Overall we didn't benefit
- // a whole lot from trying to match errors so just assume the error is
- // roughly the same and otherwise don't try to match it.
- if Path::new(test).starts_with("./tests/spec_testsuite") {
- return true;
- }
-
- // we are in control over all non-spec tests so all the error messages
- // there should exactly match the `assert_invalid` or such
- false
+fn is_matching_assert_invalid_error_message(expected: &str, actual: &str) -> bool {
+ actual.contains(expected)
+ // slight difference in error messages
+ || (expected.contains("unknown elem segment") && actual.contains("unknown element segment"))
+ || (expected.contains("type mismatch") && actual.contains("indirect calls must go through a table with type <= funcref"))
+ // The same test here is asserted to have one error message in
+ // `memory.wast` and a different error message in
+ // `memory64/memory.wast`, so we equate these two error messages to get
+ // the memory64 tests to pass.
+ || (expected.contains("memory size must be at most 65536 pages") && actual.contains("invalid u32 number"))
+ // the spec test suite asserts a different error message than we print
+ // for this scenario
+ || (expected == "unknown global" && actual.contains("global.get of locally defined global"))
+ || (expected == "immutable global" && actual.contains("global is immutable: cannot modify it with `global.set`"))
+ || (expected == "table size must be at most 2^32-1" && actual.contains("invalid u32 number: constant out of range"))
}
--- a/winch/codegen/src/codegen/mod.rs
+++ b/winch/codegen/src/codegen/mod.rs
@@ -16,7 +16,6 @@
use std::marker::PhantomData;
use wasmparser::{
BinaryReader, FuncValidator, MemArg, Operator, ValidatorResources, VisitOperator,
- VisitSimdOperator,
};
use wasmtime_cranelift::{TRAP_BAD_SIGNATURE, TRAP_TABLE_OUT_OF_BOUNDS};
use wasmtime_environ::{
@@ -297,7 +296,7 @@
while !body.eof() {
let offset = body.original_position();
body.visit_operator(&mut ValidateThenVisit(
- validator.simd_visitor(offset),
+ validator.visitor(offset),
self,
offset,
))??;
@@ -382,31 +381,13 @@
impl<'a, T, U> VisitOperator<'a> for ValidateThenVisit<'_, T, U>
where
- T: VisitSimdOperator<'a, Output = wasmparser::Result<()>>,
- U: VisitSimdOperator<'a> + VisitorHooks,
+ T: VisitOperator<'a, Output = wasmparser::Result<()>>,
+ U: VisitOperator<'a> + VisitorHooks,
U::Output: Default,
{
type Output = Result<U::Output>;
- fn simd_visitor(
- &mut self,
- ) -> Option<&mut dyn VisitSimdOperator<'a, Output = Self::Output>>
- where
- T:,
- {
- Some(self)
- }
-
- wasmparser::for_each_visit_operator!(validate_then_visit);
- }
-
- impl<'a, T, U> VisitSimdOperator<'a> for ValidateThenVisit<'_, T, U>
- where
- T: VisitSimdOperator<'a, Output = wasmparser::Result<()>>,
- U: VisitSimdOperator<'a> + VisitorHooks,
- U::Output: Default,
- {
- wasmparser::for_each_visit_simd_operator!(validate_then_visit);
+ wasmparser::for_each_operator!(validate_then_visit);
}
}
--- a/winch/codegen/src/visitor.rs
+++ b/winch/codegen/src/visitor.rs
@@ -14,9 +14,7 @@
use crate::stack::{TypedReg, Val};
use regalloc2::RegClass;
use smallvec::SmallVec;
-use wasmparser::{
- BlockType, BrTable, Ieee32, Ieee64, MemArg, VisitOperator, VisitSimdOperator, V128,
-};
+use wasmparser::{BlockType, BrTable, Ieee32, Ieee64, MemArg, VisitOperator, V128};
use wasmtime_cranelift::TRAP_INDIRECT_CALL_TO_NULL;
use wasmtime_environ::{
FuncIndex, GlobalIndex, MemoryIndex, TableIndex, TypeIndex, WasmHeapType, WasmValType,
@@ -275,6 +273,10 @@
self.context.stack.push(Val::f64(val));
}
+ fn visit_v128_const(&mut self, val: V128) {
+ self.context.stack.push(Val::v128(val.i128()))
+ }
+
fn visit_f32_add(&mut self) {
self.context.binop(
self.masm,
@@ -2055,6 +2057,14 @@
self.emit_wasm_store(&memarg, OperandSize::S64)
}
+ fn visit_v128_load(&mut self, memarg: MemArg) {
+ self.emit_wasm_load(&memarg, WasmValType::V128, OperandSize::S128, None)
+ }
+
+ fn visit_v128_store(&mut self, memarg: MemArg) {
+ self.emit_wasm_store(&memarg, OperandSize::S128)
+ }
+
fn visit_i32_trunc_sat_f32_s(&mut self) {
use OperandSize::*;
@@ -2209,27 +2219,7 @@
self.masm.mul_wide(&mut self.context, MulWideKind::Unsigned);
}
- wasmparser::for_each_visit_operator!(def_unsupported);
-}
-
-impl<'a, 'translation, 'data, M> VisitSimdOperator<'a>
- for CodeGen<'a, 'translation, 'data, M, Emission>
-where
- M: MacroAssembler,
-{
- fn visit_v128_const(&mut self, val: V128) {
- self.context.stack.push(Val::v128(val.i128()))
- }
-
- fn visit_v128_load(&mut self, memarg: MemArg) {
- self.emit_wasm_load(&memarg, WasmValType::V128, OperandSize::S128, None)
- }
-
- fn visit_v128_store(&mut self, memarg: MemArg) {
- self.emit_wasm_store(&memarg, OperandSize::S128)
- }
-
- wasmparser::for_each_visit_simd_operator!(def_unsupported);
+ wasmparser::for_each_operator!(def_unsupported);
}
impl<'a, 'translation, 'data, M> CodeGen<'a, 'translation, 'data, M, Emission>
|