diff --git a/crates/wasmparser/src/validator/component_types.rs b/crates/wasmparser/src/validator/component_types.rs index 9f77e58903..3dca94a3c6 100644 --- a/crates/wasmparser/src/validator/component_types.rs +++ b/crates/wasmparser/src/validator/component_types.rs @@ -1848,7 +1848,7 @@ impl ComponentDefinedType { .cases .values() .any(|case| case.ty.map(|ty| ty.contains_ptr(types)).unwrap_or(false)), - Self::List { .. } | Self::Map { .. } => true, + Self::List { .. } | Self::Map { .. } | Self::FixedLengthList { .. } => true, Self::Tuple(t) => t.types.iter().any(|ty| ty.contains_ptr(types)), Self::Flags(_) | Self::Enum(_) @@ -1856,9 +1856,7 @@ impl ComponentDefinedType { | Self::Borrow(_) | Self::Future { .. } | Self::Stream { .. } => false, - Self::Option { ty, .. } | Self::FixedLengthList { element: ty, .. } => { - ty.contains_ptr(types) - } + Self::Option { ty, .. } => ty.contains_ptr(types), Self::Result { ok, err, .. } => { ok.map(|ty| ty.contains_ptr(types)).unwrap_or(false) || err.map(|ty| ty.contains_ptr(types)).unwrap_or(false) @@ -1888,11 +1886,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-component/src/encoding.rs b/crates/wit-component/src/encoding.rs index 67439fff78..972bfe9437 100644 --- a/crates/wit-component/src/encoding.rs +++ b/crates/wit-component/src/encoding.rs @@ -401,7 +401,9 @@ impl TypeContents { TypeDefKind::Map(k, v) => { Self::for_type(resolve, k) | Self::for_type(resolve, v) | Self::NEEDS_MEMORY } - TypeDefKind::FixedLengthList(t, _elements) => Self::for_type(resolve, t), + TypeDefKind::FixedLengthList(t, _elements) => { + Self::for_type(resolve, t) | Self::NEEDS_MEMORY + } TypeDefKind::Type(t) => Self::for_type(resolve, t), TypeDefKind::Future(_) => Self::empty(), TypeDefKind::Stream(_) => Self::empty(), 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()) 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 6138b26ed2..17443b0405 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)) 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 ) )