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
6 changes: 3 additions & 3 deletions crates/wasmparser/src/validator/component_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/component-model/memory64/list.wast
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
)
)
4 changes: 2 additions & 2 deletions tests/cli/component-model/memory64/realloc.wast
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -47,4 +47,4 @@
)
)
)
"canonical option `realloc` uses a core function with an incorrect signature")
"canonical option `realloc` uses a core function with an incorrect signature")
4 changes: 2 additions & 2 deletions tests/cli/component-model/memory64/string.wast
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
)
)
11 changes: 7 additions & 4 deletions tests/snapshots/cli/component-model/memory64/list.wast/0.print
Original file line number Diff line number Diff line change
@@ -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))
)
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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;)))
Expand Down
Loading