From ba241dd905835239d479326c77b89e76651a7ce2 Mon Sep 17 00:00:00 2001 From: Christof Petig Date: Sun, 26 Jul 2026 16:48:10 +0200 Subject: [PATCH 1/3] Pass flattened fixed-length lists as a pointer See https://github.com/WebAssembly/component-model/pull/640 for details. --- crates/wasmparser/src/validator/component_types.rs | 6 +----- crates/wit-parser/src/abi.rs | 4 +--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/crates/wasmparser/src/validator/component_types.rs b/crates/wasmparser/src/validator/component_types.rs index 67f73e2369..4ac9542cd8 100644 --- a/crates/wasmparser/src/validator/component_types.rs +++ b/crates/wasmparser/src/validator/component_types.rs @@ -1632,11 +1632,7 @@ impl ComponentDefinedType { lowered_types.try_push(ptr_size.core_type()) && lowered_types.try_push(ptr_size.core_type()) } - Self::FixedLengthList { - element: ty, - length, - .. - } => (0..*length).all(|_n| ty.push_wasm_types(ptr_size, types, lowered_types)), + Self::FixedLengthList { .. } => lowered_types.try_push(ptr_size.core_type()), Self::Tuple(t) => t .types .iter() diff --git a/crates/wit-parser/src/abi.rs b/crates/wit-parser/src/abi.rs index ef65a219d0..0b49b3228d 100644 --- a/crates/wit-parser/src/abi.rs +++ b/crates/wit-parser/src/abi.rs @@ -340,9 +340,7 @@ impl Resolve { result.push(WasmType::Pointer) && result.push(WasmType::Length) } - TypeDefKind::FixedLengthList(ty, size) => { - self.push_flat_list((0..*size).map(|_| ty), result) - } + TypeDefKind::FixedLengthList(_, _) => result.push(WasmType::Pointer), TypeDefKind::Variant(v) => { result.push(v.tag().into()) From 071641e9b62bd2f9f22c6a0c1c32e144d4b6af8b Mon Sep 17 00:00:00 2001 From: Christof Petig Date: Sun, 26 Jul 2026 17:13:38 +0200 Subject: [PATCH 2/3] fix the matching tests --- tests/cli/component-model/async/abi.wast | 2 +- tests/cli/component-model/async/stackful.wast | 2 +- tests/cli/component-model/fixed-length-lists.wast | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/cli/component-model/async/abi.wast b/tests/cli/component-model/async/abi.wast index 347a251eb5..0c5a6141e6 100644 --- a/tests/cli/component-model/async/abi.wast +++ b/tests/cli/component-model/async/abi.wast @@ -92,7 +92,7 @@ (memory (export "memory") 1) (func (export "cb") (param i32 i32 i32) (result i32) unreachable) (func (export "realloc") (param i32 i32 i32 i32) (result i32) unreachable) - (func (export "f") (param i32 i32 i32 i32 i32 i32 i32 i32) (result i32) unreachable)) + (func (export "f") (param i32) (result i32) unreachable)) (core instance $m6 (instantiate $m6)) (func async (param "x" (list string 4)) (canon lift (core func $m6 "f") async (callback (core func $m6 "cb")) diff --git a/tests/cli/component-model/async/stackful.wast b/tests/cli/component-model/async/stackful.wast index 0d5fe23f1b..8b33cf2ba6 100644 --- a/tests/cli/component-model/async/stackful.wast +++ b/tests/cli/component-model/async/stackful.wast @@ -115,7 +115,7 @@ (core module $m6 (memory (export "memory") 1) (func (export "realloc") (param i32 i32 i32 i32) (result i32) unreachable) - (func (export "f") (param i32 i32 i32 i32 i32 i32 i32 i32) unreachable)) + (func (export "f") (param i32) unreachable)) (core instance $m6 (instantiate $m6)) (func async (param "x" (list string 4)) (canon lift (core func $m6 "f") async diff --git a/tests/cli/component-model/fixed-length-lists.wast b/tests/cli/component-model/fixed-length-lists.wast index 63c1e19200..b780f6c910 100644 --- a/tests/cli/component-model/fixed-length-lists.wast +++ b/tests/cli/component-model/fixed-length-lists.wast @@ -14,7 +14,7 @@ (component (core module $m - (func (export "param-list") (param i32 i32 i32 i32) unreachable) + (func (export "param-list") (param i32) unreachable) ) (core instance $i (instantiate $m)) From c251fb40769755dc2cf0ff3e2495901dac16dcc2 Mon Sep 17 00:00:00 2001 From: Christof Petig Date: Sun, 26 Jul 2026 17:35:15 +0200 Subject: [PATCH 3/3] bless the new test results --- tests/snapshots/cli/component-model/async/abi.wast/1.print | 4 ++-- .../snapshots/cli/component-model/async/stackful.wast/6.print | 4 ++-- .../cli/component-model/fixed-length-lists.wast/1.print | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/snapshots/cli/component-model/async/abi.wast/1.print b/tests/snapshots/cli/component-model/async/abi.wast/1.print index 78fc5b6dd5..917f2cf525 100644 --- a/tests/snapshots/cli/component-model/async/abi.wast/1.print +++ b/tests/snapshots/cli/component-model/async/abi.wast/1.print @@ -96,7 +96,7 @@ (core module $m6 (;5;) (type (;0;) (func (param i32 i32 i32) (result i32))) (type (;1;) (func (param i32 i32 i32 i32) (result i32))) - (type (;2;) (func (param i32 i32 i32 i32 i32 i32 i32 i32) (result i32))) + (type (;2;) (func (param i32) (result i32))) (memory (;0;) 1) (export "memory" (memory 0)) (export "cb" (func 0)) @@ -108,7 +108,7 @@ (func (;1;) (type 1) (param i32 i32 i32 i32) (result i32) unreachable ) - (func (;2;) (type 2) (param i32 i32 i32 i32 i32 i32 i32 i32) (result i32) + (func (;2;) (type 2) (param i32) (result i32) unreachable ) ) diff --git a/tests/snapshots/cli/component-model/async/stackful.wast/6.print b/tests/snapshots/cli/component-model/async/stackful.wast/6.print index 23aef68447..b64c00be23 100644 --- a/tests/snapshots/cli/component-model/async/stackful.wast/6.print +++ b/tests/snapshots/cli/component-model/async/stackful.wast/6.print @@ -65,7 +65,7 @@ (func (;4;) (type 4) (canon lift (core func 4) async (memory 0) (realloc 5))) (core module $m6 (;5;) (type (;0;) (func (param i32 i32 i32 i32) (result i32))) - (type (;1;) (func (param i32 i32 i32 i32 i32 i32 i32 i32))) + (type (;1;) (func (param i32))) (memory (;0;) 1) (export "memory" (memory 0)) (export "realloc" (func 0)) @@ -73,7 +73,7 @@ (func (;0;) (type 0) (param i32 i32 i32 i32) (result i32) unreachable ) - (func (;1;) (type 1) (param i32 i32 i32 i32 i32 i32 i32 i32) + (func (;1;) (type 1) (param i32) unreachable ) ) diff --git a/tests/snapshots/cli/component-model/fixed-length-lists.wast/1.print b/tests/snapshots/cli/component-model/fixed-length-lists.wast/1.print index ee75456d39..2eed15ca89 100644 --- a/tests/snapshots/cli/component-model/fixed-length-lists.wast/1.print +++ b/tests/snapshots/cli/component-model/fixed-length-lists.wast/1.print @@ -1,8 +1,8 @@ (component (core module $m (;0;) - (type (;0;) (func (param i32 i32 i32 i32))) + (type (;0;) (func (param i32))) (export "param-list" (func 0)) - (func (;0;) (type 0) (param i32 i32 i32 i32) + (func (;0;) (type 0) (param i32) unreachable ) )