Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 126 additions & 54 deletions Cargo.lock

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -372,18 +372,18 @@ wit-bindgen = { version = "0.63.0", default-features = false }
wit-bindgen-rust-macro = { version = "0.63.0", default-features = false }

# wasm-tools family:
wasmparser = { version = "0.262.0", default-features = false, features = ['simd'] }
wat = "1.262.0"
wast = "262.0.0"
wasmprinter = "0.262.0"
wasm-encoder = "0.262.0"
wasm-smith = "0.262.0"
wasm-mutate = "0.262.0"
wit-parser = "0.262.0"
wit-component = "0.262.0"
wasm-wave = "0.262.0"
wasm-compose = { version = "0.262.0", default-features = false }
json-from-wast = "0.262.0"
wasmparser = { version = "0.263.0", default-features = false, features = ['simd'] }
wat = "1.263.0"
wast = "263.0.0"
wasmprinter = "0.263.0"
wasm-encoder = "0.263.0"
wasm-smith = "0.263.0"
wasm-mutate = "0.263.0"
wit-parser = "0.263.0"
wit-component = "0.263.0"
wasm-wave = "0.263.0"
wasm-compose = { version = "0.263.0", default-features = false }
json-from-wast = "0.263.0"

wstd = "0.6.5"
wasip2 = "1.0"
Expand Down
25 changes: 20 additions & 5 deletions crates/cranelift/src/translate/code_translator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ use itertools::Itertools;
use smallvec::{SmallVec, ToSmallVec};
use std::collections::{HashMap, hash_map};
use std::vec::Vec;
use wasmparser::{FuncValidator, MemArg, Operator, WasmModuleResources};
use wasmparser::{FuncValidator, MemArg, MemArgTarget, Operator, Ordering, WasmModuleResources};
use wasmtime_environ::{
DataIndex, ElemIndex, FuncIndex, GlobalIndex, MemoryIndex, TableIndex, TagIndex, TypeConvert,
TypeIndex, WasmHeapType, WasmRefType, WasmResult, WasmValType, wasm_unsupported,
Expand Down Expand Up @@ -1431,7 +1431,10 @@ pub fn translate_operator(
Operator::MemoryAtomicWait32 { .. } => I32,
_ => unreachable!(),
};
let memory_index = MemoryIndex::from_u32(memarg.memory);
let memory_index = match memarg.target {
MemArgTarget::Memory(index) => MemoryIndex::from_u32(index),
MemArgTarget::Array(_) => return Err(wasm_unsupported!("should not be valid")),
};
let heap = environ.get_or_create_heap(builder.func, memory_index);
let timeout = environ.stacks.pop1(); // 64 (fixed)
let expected = environ.stacks.pop1(); // 32 or 64 (per the `Ixx` in `IxxAtomicWait`)
Expand All @@ -1457,7 +1460,10 @@ pub fn translate_operator(
environ.stacks.push1(res);
}
Operator::MemoryAtomicNotify { memarg } => {
let memory_index = MemoryIndex::from_u32(memarg.memory);
let memory_index = match memarg.target {
MemArgTarget::Memory(index) => MemoryIndex::from_u32(index),
MemArgTarget::Array(_) => return Err(wasm_unsupported!("should not be valid")),
};
let heap = environ.get_or_create_heap(builder.func, memory_index);
let count = environ.stacks.pop1(); // 32 (fixed)
let addr = environ.stacks.pop1();
Expand Down Expand Up @@ -1675,7 +1681,10 @@ pub fn translate_operator(
translate_atomic_cas(I64, I32, memarg, builder, environ)?
}

Operator::AtomicFence { .. } => {
Operator::AtomicFence { ordering } => {
if *ordering != Ordering::SeqCst {
return Err(wasm_unsupported!("acquire-release-atomics"));
}
builder.ins().fence();
}
Operator::MemoryCopy { src_mem, dst_mem } => {
Expand Down Expand Up @@ -3619,7 +3628,10 @@ fn prepare_addr(
) -> WasmResult<Reachability<(MemFlagsData, Value, Value)>> {
let index = environ.stacks.pop1();

let memory_index = MemoryIndex::from_u32(memarg.memory);
let memory_index = match memarg.target {
MemArgTarget::Memory(index) => MemoryIndex::from_u32(index),
MemArgTarget::Array(_) => return Err(wasm_unsupported!("multibyte-array-access proposal")),
};
let heap = environ.get_or_create_heap(builder.func, memory_index);

// How exactly the bounds check is performed here and what it's performed
Expand Down Expand Up @@ -3820,6 +3832,9 @@ fn prepare_atomic_addr(
builder: &mut FunctionBuilder,
environ: &mut FuncEnvironment<'_>,
) -> WasmResult<Reachability<(MemFlagsData, Value, Value)>> {
if memarg.ordering.is_some() {
return Err(wasm_unsupported!("acquire-release-atomics"));
}
align_atomic_addr(memarg, loaded_bytes, builder, environ);
prepare_addr(memarg, loaded_bytes, builder, environ)
}
Expand Down
7 changes: 5 additions & 2 deletions crates/environ/src/fact/trampoline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ use crate::{FuncIndex, GlobalIndex, IndexType, NUM_COMPONENT_CONTEXT_SLOTS, Trap
use std::collections::HashMap;
use std::mem;
use std::ops::Range;
use wasm_encoder::{BlockType, Catch, Encode, Instruction, Instruction::*, MemArg, ValType};
use wasm_encoder::{
BlockType, Catch, Encode, Instruction, Instruction::*, MemArg, MemArgTarget, ValType,
};
use wasmtime_component_util::{DiscriminantSize, FlagsSize};

use super::DataModel;
Expand Down Expand Up @@ -4506,7 +4508,8 @@ impl<'a> Memory<'a> {
MemArg {
offset: u64::from(self.offset),
align,
memory_index: self.mem_opts().memory.unwrap().0.as_u32(),
target: MemArgTarget::Memory(self.mem_opts().memory.unwrap().0.as_u32()),
ordering: None,
}
}

Expand Down
5 changes: 3 additions & 2 deletions crates/fuzzing/src/generators/stacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::mem;
use std::num::NonZeroUsize;

use arbitrary::{Arbitrary, Result, Unstructured};
use wasm_encoder::{Instruction, ValType};
use wasm_encoder::{Instruction, MemArgTarget, ValType};

const MAX_FUNCS: u32 = 20;
const MAX_OPS: usize = 1_000;
Expand Down Expand Up @@ -260,7 +260,8 @@ impl Stacks {
.instruction(&Instruction::I32Store(wasm_encoder::MemArg {
offset: 0,
align: 0,
memory_index: memory,
target: MemArgTarget::Memory(memory),
ordering: None,
}))
.instruction(&Instruction::GlobalGet(stack_len_global))
.instruction(&Instruction::I32Const(mem::size_of::<i32>() as i32))
Expand Down
12 changes: 8 additions & 4 deletions crates/fuzzing/src/oracles/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ fn build_wasm(image: &HeapImage, offset: u32) -> Vec<u8> {
wasm_encoder::MemArg {
offset: u64::from(offset),
align: 0,
memory_index: 0,
target: Default::default(),
ordering: None,
},
));
func.instruction(&wasm_encoder::Instruction::End);
Expand All @@ -328,7 +329,8 @@ fn build_wasm(image: &HeapImage, offset: u32) -> Vec<u8> {
wasm_encoder::MemArg {
offset: u64::from(offset),
align: 0,
memory_index: 0,
target: Default::default(),
ordering: None,
},
));
func.instruction(&wasm_encoder::Instruction::End);
Expand All @@ -343,7 +345,8 @@ fn build_wasm(image: &HeapImage, offset: u32) -> Vec<u8> {
func.instruction(&wasm_encoder::Instruction::I32Load(wasm_encoder::MemArg {
offset: u64::from(offset),
align: 0,
memory_index: 0,
target: Default::default(),
ordering: None,
}));
func.instruction(&wasm_encoder::Instruction::End);
code.function(&func);
Expand All @@ -357,7 +360,8 @@ fn build_wasm(image: &HeapImage, offset: u32) -> Vec<u8> {
func.instruction(&wasm_encoder::Instruction::I64Load(wasm_encoder::MemArg {
offset: u64::from(offset),
align: 0,
memory_index: 0,
target: Default::default(),
ordering: None,
}));
func.instruction(&wasm_encoder::Instruction::End);
code.function(&func);
Expand Down
33 changes: 32 additions & 1 deletion crates/wast/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ pub fn val(v: &ComponentConst<'_>) -> Result<Val> {
Err(v) => Err(payload_val(v.as_deref())?),
}),
ComponentConst::Flags(v) => Val::Flags(v.iter().map(|s| s.to_string()).collect()),
ComponentConst::Map(entries) => {
let mut pairs = Vec::new();
for (k, v) in entries {
pairs.push((val(k)?, val(v)?));
}
Val::Map(pairs)
}
})
}

Expand Down Expand Up @@ -132,7 +139,7 @@ pub fn match_val(expected: &ComponentConst<'_>, actual: &Val) -> Result<()> {
},
ComponentConst::Record(e) => match actual {
Val::Record(a) => {
if e.len() != e.len() {
if e.len() != a.len() {
bail!("mismatched number of record fields");
}
for ((e_name, e_val), (a_name, a_val)) in e.iter().zip(a.iter()) {
Expand Down Expand Up @@ -207,6 +214,29 @@ pub fn match_val(expected: &ComponentConst<'_>, actual: &Val) -> Result<()> {
}
_ => mismatch(expected, actual),
},
ComponentConst::Map(e) => match actual {
Val::Map(a) => {
if e.len() != a.len() {
bail!("expected {} map entries got {}", e.len(), a.len());
}
let mut used = vec![false; a.len()];
for (e_key, e_val) in e {
let found = a.iter().enumerate().position(|(i, (a_key, a_val))| {
!used[i]
&& match_val(e_key, a_key).is_ok()
&& match_val(e_val, a_val).is_ok()
});
match found {
Some(i) => used[i] = true,
None => bail!(
"expected map entry ({e_key:?}, {e_val:?}) not found in {actual:?}"
),
}
}
Ok(())
}
_ => mismatch(expected, actual),
},
}
}

Expand Down Expand Up @@ -263,6 +293,7 @@ fn mismatch(expected: &ComponentConst<'_>, actual: &Val) -> Result<()> {
ComponentConst::Option(..) => "option",
ComponentConst::Result(..) => "result",
ComponentConst::Flags(..) => "flags",
ComponentConst::Map(..) => "map",
};
let actual = match actual {
Val::Bool(..) => "bool",
Expand Down
4 changes: 3 additions & 1 deletion crates/wizer/src/component/instrument.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::ModuleContext;
use crate::component::info::{Accessor, RawSection};
use crate::component::{ComponentContext, WIZER_INSTANCE};
use wasm_encoder::MemArgTarget;
use wasm_encoder::reencode::{Reencode, RoundtripReencoder};
use wasmtime::{Result, bail};

Expand Down Expand Up @@ -248,7 +249,8 @@ impl AccessorBuilder<'_> {
let memarg = |offset| wasm_encoder::MemArg {
align: 2,
offset,
memory_index: self.accessor_nmemories,
target: MemArgTarget::Memory(self.accessor_nmemories),
ordering: None,
};
// Store the ptr/len into the page that was just allocated
ins.local_get(0);
Expand Down
49 changes: 37 additions & 12 deletions supply-chain/imports.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1146,8 +1146,8 @@ user-login = "alexcrichton"
user-name = "Alex Crichton"

[[publisher.json-from-wast]]
version = "0.262.0"
when = "2026-10-13"
version = "0.263.0"
when = "2026-10-30"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.libc]]
Expand Down Expand Up @@ -1633,8 +1633,8 @@ user-login = "alexcrichton"
user-name = "Alex Crichton"

[[publisher.wasm-compose]]
version = "0.262.0"
when = "2026-10-13"
version = "0.263.0"
when = "2026-10-30"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasm-encoder]]
Expand All @@ -1647,6 +1647,11 @@ version = "0.262.0"
when = "2026-10-13"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasm-encoder]]
version = "0.263.0"
when = "2026-10-30"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasm-metadata]]
version = "0.236.0"
when = "2025-07-28"
Expand All @@ -1658,9 +1663,14 @@ version = "0.262.0"
when = "2026-10-13"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasm-metadata]]
version = "0.263.0"
when = "2026-10-30"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasm-wave]]
version = "0.262.0"
when = "2026-10-13"
version = "0.263.0"
when = "2026-10-30"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasmparser]]
Expand All @@ -1673,9 +1683,14 @@ version = "0.262.0"
when = "2026-10-13"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasmparser]]
version = "0.263.0"
when = "2026-10-30"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasmprinter]]
version = "0.262.0"
when = "2026-10-13"
version = "0.263.0"
when = "2026-10-30"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wasmtime]]
Expand Down Expand Up @@ -1829,13 +1844,13 @@ when = "2026-10-02"
trusted-publisher = "github:bytecodealliance/wasmtime"

[[publisher.wast]]
version = "262.0.0"
when = "2026-10-13"
version = "263.0.0"
when = "2026-10-30"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wat]]
version = "1.262.0"
when = "2026-10-13"
version = "1.263.0"
when = "2026-10-30"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wiggle]]
Expand Down Expand Up @@ -2053,6 +2068,11 @@ version = "0.262.0"
when = "2026-10-13"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wit-component]]
version = "0.263.0"
when = "2026-10-30"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wit-parser]]
version = "0.244.0"
when = "2026-01-06"
Expand All @@ -2063,6 +2083,11 @@ version = "0.262.0"
when = "2026-10-13"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.wit-parser]]
version = "0.263.0"
when = "2026-10-30"
trusted-publisher = "github:bytecodealliance/wasm-tools"

[[publisher.witx]]
version = "0.9.1"
when = "2021-06-22"
Expand Down
Loading
Loading