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 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
|
Description: use older versions of wasm-tools crates
This essentially reverts upstream git commit 7c96aa1.
Author: Jonas Smedegaard <dr@jones.dk>
Bug-Debian: https://bugs.debian.org/1095699
Forwarded: not-needed
Last-Update: 2025-11-14
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/crates/cranelift/src/func_environ.rs
+++ b/crates/cranelift/src/func_environ.rs
@@ -17,7 +17,7 @@
use cranelift_frontend::Variable;
use smallvec::SmallVec;
use std::mem;
-use wasmparser::{Operator, WasmFeatures};
+use wasmparser::Operator;
use wasmtime_environ::{
BuiltinFunctionIndex, DataIndex, ElemIndex, EngineOrModuleTypeIndex, FuncIndex, GlobalIndex,
IndexType, Memory, MemoryIndex, Module, ModuleInternedTypeIndex, ModuleTranslation,
@@ -1317,7 +1317,6 @@
/// Do an indirect call through the given funcref table.
pub fn indirect_call(
mut self,
- features: &WasmFeatures,
table_index: TableIndex,
ty_index: TypeIndex,
sig_ref: ir::SigRef,
@@ -1325,7 +1324,6 @@
call_args: &[ir::Value],
) -> WasmResult<Option<ir::Inst>> {
let (code_ptr, callee_vmctx) = match self.check_and_load_code_and_callee_vmctx(
- features,
table_index,
ty_index,
callee,
@@ -1341,7 +1339,6 @@
fn check_and_load_code_and_callee_vmctx(
&mut self,
- features: &WasmFeatures,
table_index: TableIndex,
ty_index: TypeIndex,
callee: ir::Value,
@@ -1356,8 +1353,7 @@
);
// If necessary, check the signature.
- let check =
- self.check_indirect_call_type_signature(features, table_index, ty_index, funcref_ptr);
+ let check = self.check_indirect_call_type_signature(table_index, ty_index, funcref_ptr);
let trap_code = match check {
// `funcref_ptr` is checked at runtime that its type matches,
@@ -1391,7 +1387,6 @@
fn check_indirect_call_type_signature(
&mut self,
- features: &WasmFeatures,
table_index: TableIndex,
ty_index: TypeIndex,
funcref_ptr: ir::Value,
@@ -1423,40 +1418,33 @@
};
}
- if features.gc() {
- // If we are in the Wasm GC world, then we need to perform
- // an actual subtype check at runtime. Fall through to below
- // to do that.
- } else {
- // Otherwise if the types don't match then either (a) this
- // is a null pointer or (b) it's a pointer with the wrong
- // type. Figure out which and trap here.
- //
- // If it's possible to have a null here then try to load the
- // type information. If that fails due to the function being
- // a null pointer, then this was a call to null. Otherwise
- // if it succeeds then we know it won't match, so trap
- // anyway.
- if table.ref_type.nullable {
- if self.env.signals_based_traps() {
- let mem_flags = ir::MemFlags::trusted().with_readonly();
- self.builder.ins().load(
- sig_id_type,
- mem_flags.with_trap_code(Some(crate::TRAP_INDIRECT_CALL_TO_NULL)),
- funcref_ptr,
- i32::from(self.env.offsets.ptr.vm_func_ref_type_index()),
- );
- } else {
- self.env.trapz(
- self.builder,
- funcref_ptr,
- crate::TRAP_INDIRECT_CALL_TO_NULL,
- );
- }
+ // Otherwise if the types don't match then either (a) this is a
+ // null pointer or (b) it's a pointer with the wrong type.
+ // Figure out which and trap here.
+ //
+ // If it's possible to have a null here then try to load the
+ // type information. If that fails due to the function being a
+ // null pointer, then this was a call to null. Otherwise if it
+ // succeeds then we know it won't match, so trap anyway.
+ if table.ref_type.nullable {
+ if self.env.signals_based_traps() {
+ let mem_flags = ir::MemFlags::trusted().with_readonly();
+ self.builder.ins().load(
+ sig_id_type,
+ mem_flags.with_trap_code(Some(crate::TRAP_INDIRECT_CALL_TO_NULL)),
+ funcref_ptr,
+ i32::from(self.env.offsets.ptr.vm_func_ref_type_index()),
+ );
+ } else {
+ self.env.trapz(
+ self.builder,
+ funcref_ptr,
+ crate::TRAP_INDIRECT_CALL_TO_NULL,
+ );
}
- self.env.trap(self.builder, crate::TRAP_BAD_SIGNATURE);
- return CheckIndirectCallTypeSignature::StaticTrap;
}
+ self.env.trap(self.builder, crate::TRAP_BAD_SIGNATURE);
+ return CheckIndirectCallTypeSignature::StaticTrap;
}
// Tables of `nofunc` can only be inhabited by null, so go ahead and
@@ -1508,25 +1496,12 @@
self.env
.load_funcref_type_index(&mut self.builder.cursor(), mem_flags, funcref_ptr);
- // Check that they match: in the case of Wasm GC, this means doing a
- // full subtype check. Otherwise, we do a simple equality check.
- let matches = if features.gc() {
- #[cfg(feature = "gc")]
- {
- self.env
- .is_subtype(self.builder, callee_sig_id, caller_sig_id)
- }
- #[cfg(not(feature = "gc"))]
- {
- unreachable!()
- }
- } else {
- self.builder
- .ins()
- .icmp(IntCC::Equal, callee_sig_id, caller_sig_id)
- };
- self.env
- .trapz(self.builder, matches, crate::TRAP_BAD_SIGNATURE);
+ // Check that they match.
+ let cmp = self
+ .builder
+ .ins()
+ .icmp(IntCC::Equal, callee_sig_id, caller_sig_id);
+ self.env.trapz(self.builder, cmp, crate::TRAP_BAD_SIGNATURE);
CheckIndirectCallTypeSignature::Runtime
}
@@ -2596,21 +2571,13 @@
fn translate_call_indirect(
&mut self,
builder: &mut FunctionBuilder,
- features: &WasmFeatures,
table_index: TableIndex,
ty_index: TypeIndex,
sig_ref: ir::SigRef,
callee: ir::Value,
call_args: &[ir::Value],
) -> WasmResult<Option<ir::Inst>> {
- Call::new(builder, self).indirect_call(
- features,
- table_index,
- ty_index,
- sig_ref,
- callee,
- call_args,
- )
+ Call::new(builder, self).indirect_call(table_index, ty_index, sig_ref, callee, call_args)
}
fn translate_call(
@@ -2647,7 +2614,6 @@
fn translate_return_call_indirect(
&mut self,
builder: &mut FunctionBuilder,
- features: &WasmFeatures,
table_index: TableIndex,
ty_index: TypeIndex,
sig_ref: ir::SigRef,
@@ -2655,7 +2621,6 @@
call_args: &[ir::Value],
) -> WasmResult<()> {
Call::new_tail(builder, self).indirect_call(
- features,
table_index,
ty_index,
sig_ref,
--- a/crates/cranelift/src/translate/code_translator.rs
+++ b/crates/cranelift/src/translate/code_translator.rs
@@ -649,7 +649,6 @@
let call = environ.translate_call_indirect(
builder,
- validator.features(),
TableIndex::from_u32(*table_index),
TypeIndex::from_u32(*type_index),
sigref,
@@ -717,7 +716,6 @@
environ.translate_return_call_indirect(
builder,
- validator.features(),
TableIndex::from_u32(*table_index),
TypeIndex::from_u32(*type_index),
sigref,
--- a/crates/cranelift/src/translate/environ/spec.rs
+++ b/crates/cranelift/src/translate/environ/spec.rs
@@ -15,7 +15,7 @@
use cranelift_entity::PrimaryMap;
use cranelift_frontend::FunctionBuilder;
use smallvec::SmallVec;
-use wasmparser::{Operator, WasmFeatures};
+use wasmparser::Operator;
use wasmtime_environ::{
DataIndex, ElemIndex, FuncIndex, GlobalIndex, MemoryIndex, TableIndex, Tunables, TypeConvert,
TypeIndex, WasmHeapType, WasmRefType, WasmResult,
@@ -199,7 +199,6 @@
fn translate_call_indirect(
&mut self,
builder: &mut FunctionBuilder,
- features: &WasmFeatures,
table_index: TableIndex,
sig_index: TypeIndex,
sig_ref: ir::SigRef,
@@ -239,7 +238,6 @@
fn translate_return_call_indirect(
&mut self,
builder: &mut FunctionBuilder,
- features: &WasmFeatures,
table_index: TableIndex,
sig_index: TypeIndex,
sig_ref: ir::SigRef,
--- a/crates/wasmtime/src/runtime/vm/libcalls.rs
+++ b/crates/wasmtime/src/runtime/vm/libcalls.rs
@@ -1022,14 +1022,11 @@
let actual = VMSharedTypeIndex::from_u32(actual_engine_type);
let expected = VMSharedTypeIndex::from_u32(expected_engine_type);
- let is_subtype: bool = store
+ store
.engine()
.signatures()
.is_subtype(actual, expected)
- .into();
-
- log::trace!("is_subtype(actual={actual:?}, expected={expected:?}) -> {is_subtype}",);
- is_subtype
+ .into()
}
// Implementation of `memory.atomic.notify` for locally defined memories.
--- a/tests/wast.rs
+++ b/tests/wast.rs
@@ -60,6 +60,15 @@
trials.push(trial);
}
}
+ if unsupported_gc_tests.iter().any(|i| test.ends_with(i)) {
+ return true;
+ }
+ }
+
+ // Implementation of the GC proposal is a work-in-progress, this is
+ // a list of all currently known-to-fail tests.
+ if part == "gc" {
+ return unsupported_gc_tests.iter().any(|i| test.ends_with(i));
}
}
--- a/crates/wast-util/src/lib.rs
+++ b/crates/wast-util/src/lib.rs
@@ -407,6 +407,8 @@
}
}
+ let unsupported_gc_tests = ["type-subtyping.wast"];
+
for part in self.path.iter() {
// Not implemented in Wasmtime yet
if part == "exception-handling" {
|