diff --git a/crates/wasmparser/src/validator/component_types.rs b/crates/wasmparser/src/validator/component_types.rs index 17fc6ffb5d..e968fbcd40 100644 --- a/crates/wasmparser/src/validator/component_types.rs +++ b/crates/wasmparser/src/validator/component_types.rs @@ -1250,7 +1250,7 @@ impl ComponentFuncType { // Function will have a single pointer parameter to pass the arguments // via linear memory sig.params.clear(); - assert!(sig.params.try_push(ValType::I32)); + assert!(sig.params.try_push(ptr_size.core_type())); options.require_memory(offset)?; // We need realloc as well when lifting a function @@ -1281,10 +1281,10 @@ impl ComponentFuncType { match abi { Abi::Lower => { sig.params.max = MAX_LOWERED_TYPES; - assert!(sig.params.try_push(ValType::I32)); + assert!(sig.params.try_push(ptr_size.core_type())); } Abi::Lift => { - assert!(sig.results.try_push(ValType::I32)); + assert!(sig.results.try_push(ptr_size.core_type())); } } } diff --git a/tests/cli/component-model/memory64/list.wast b/tests/cli/component-model/memory64/list.wast index 31e82e7371..1dd86f61c2 100644 --- a/tests/cli/component-model/memory64/list.wast +++ b/tests/cli/component-model/memory64/list.wast @@ -2,12 +2,12 @@ (component (core module $m - (func (export "f") (param i64 i64)) + (func (export "f") (param i64 i64) (result i64) unreachable) (func (export "realloc") (param i64 i64 i64 i64) (result i64) i64.const 0) (memory (export "memory") i64 1) ) (core instance $m (instantiate $m)) - (func (export "a") (param "a" (list u8)) + (func (export "a") (param "a" (list u8)) (result (list u8)) (canon lift (core func $m "f") (realloc (func $m "realloc")) (memory $m "memory")) ) ) diff --git a/tests/cli/component-model/memory64/realloc.wast b/tests/cli/component-model/memory64/realloc.wast index 12fc13d71c..04249e8a97 100644 --- a/tests/cli/component-model/memory64/realloc.wast +++ b/tests/cli/component-model/memory64/realloc.wast @@ -3,7 +3,7 @@ (component (core module $m (memory (export "m") i64 1) - (func (export "f") (result i32) unreachable) + (func (export "f") (result i64) unreachable) (func (export "realloc") (param i64 i64 i64 i64) (result i64) unreachable) ) (core instance $i (instantiate $m)) @@ -47,4 +47,4 @@ ) ) ) - "canonical option `realloc` uses a core function with an incorrect signature") \ No newline at end of file + "canonical option `realloc` uses a core function with an incorrect signature") diff --git a/tests/cli/component-model/memory64/string.wast b/tests/cli/component-model/memory64/string.wast index c15071ed4f..12de7c8d9f 100644 --- a/tests/cli/component-model/memory64/string.wast +++ b/tests/cli/component-model/memory64/string.wast @@ -2,12 +2,12 @@ (component (core module $m - (func (export "f") (param i64 i64)) + (func (export "f") (param i64 i64) (result i64) unreachable) (func (export "realloc") (param i64 i64 i64 i64) (result i64) i64.const 0) (memory (export "memory") i64 1) ) (core instance $m (instantiate $m)) - (func (export "a") (param "a" string) + (func (export "a") (param "a" string) (result string) (canon lift (core func $m "f") (realloc (func $m "realloc")) (memory $m "memory")) ) ) diff --git a/tests/snapshots/cli/component-model/memory64/list.wast/0.print b/tests/snapshots/cli/component-model/memory64/list.wast/0.print index 109d46d167..6ea9aa40f0 100644 --- a/tests/snapshots/cli/component-model/memory64/list.wast/0.print +++ b/tests/snapshots/cli/component-model/memory64/list.wast/0.print @@ -1,22 +1,25 @@ (component (core module $m (;0;) - (type (;0;) (func (param i64 i64))) + (type (;0;) (func (param i64 i64) (result i64))) (type (;1;) (func (param i64 i64 i64 i64) (result i64))) (memory (;0;) i64 1) (export "f" (func 0)) (export "realloc" (func 1)) (export "memory" (memory 0)) - (func (;0;) (type 0) (param i64 i64)) + (func (;0;) (type 0) (param i64 i64) (result i64) + unreachable + ) (func (;1;) (type 1) (param i64 i64 i64 i64) (result i64) i64.const 0 ) ) (core instance $m (;0;) (instantiate $m)) (type (;0;) (list u8)) - (type (;1;) (func (param "a" 0))) + (type (;1;) (list u8)) + (type (;2;) (func (param "a" 0) (result 1))) (alias core export $m "f" (core func (;0;))) (alias core export $m "realloc" (core func (;1;))) (alias core export $m "memory" (core memory (;0;))) - (func (;0;) (type 1) (canon lift (core func 0) (realloc 1) (memory 0))) + (func (;0;) (type 2) (canon lift (core func 0) (realloc 1) (memory 0))) (export (;1;) "a" (func 0)) ) diff --git a/tests/snapshots/cli/component-model/memory64/realloc.wast/0.print b/tests/snapshots/cli/component-model/memory64/realloc.wast/0.print index 6b1f904c64..e2b67be934 100644 --- a/tests/snapshots/cli/component-model/memory64/realloc.wast/0.print +++ b/tests/snapshots/cli/component-model/memory64/realloc.wast/0.print @@ -1,12 +1,12 @@ (component (core module $m (;0;) - (type (;0;) (func (result i32))) + (type (;0;) (func (result i64))) (type (;1;) (func (param i64 i64 i64 i64) (result i64))) (memory (;0;) i64 1) (export "m" (memory 0)) (export "f" (func 0)) (export "realloc" (func 1)) - (func (;0;) (type 0) (result i32) + (func (;0;) (type 0) (result i64) unreachable ) (func (;1;) (type 1) (param i64 i64 i64 i64) (result i64) diff --git a/tests/snapshots/cli/component-model/memory64/string.wast/0.print b/tests/snapshots/cli/component-model/memory64/string.wast/0.print index b0b211c567..9c412cf845 100644 --- a/tests/snapshots/cli/component-model/memory64/string.wast/0.print +++ b/tests/snapshots/cli/component-model/memory64/string.wast/0.print @@ -1,18 +1,20 @@ (component (core module $m (;0;) - (type (;0;) (func (param i64 i64))) + (type (;0;) (func (param i64 i64) (result i64))) (type (;1;) (func (param i64 i64 i64 i64) (result i64))) (memory (;0;) i64 1) (export "f" (func 0)) (export "realloc" (func 1)) (export "memory" (memory 0)) - (func (;0;) (type 0) (param i64 i64)) + (func (;0;) (type 0) (param i64 i64) (result i64) + unreachable + ) (func (;1;) (type 1) (param i64 i64 i64 i64) (result i64) i64.const 0 ) ) (core instance $m (;0;) (instantiate $m)) - (type (;0;) (func (param "a" string))) + (type (;0;) (func (param "a" string) (result string))) (alias core export $m "f" (core func (;0;))) (alias core export $m "realloc" (core func (;1;))) (alias core export $m "memory" (core memory (;0;)))