Skip to content

Conversation

@alexcrichton
Copy link
Member

This commit fixes an issue for imported functions taking list<borrow<T>> arguments. Previously they were erroneously passed through as lists-of-pointers and now they're correctly mapped to list-of-handle-indexes in the ABI. This required rejiggering a bit how types are generated and what's considered owned when, namely requiring that all own handles use Vec<T> at the boundary since they need to take ownership.

This commit fixes an issue for imported functions taking
`list<borrow<T>>` arguments. Previously they were erroneously passed
through as lists-of-pointers and now they're correctly mapped to
list-of-handle-indexes in the ABI. This required rejiggering a bit how
types are generated and what's considered owned when, namely requiring
that all own handles use `Vec<T>` at the boundary since they need to
take ownership.
@alexcrichton
Copy link
Member Author

I'll note that testing-wise the existing codegen tests cover a good deal, and otherwise tests for resources are not present at the moment as this requires wasmtime support which is still nascent.

@sunfishcode
Copy link
Member

I tested this by copying the bindings generated with this patch into bytecodealliance/wasmtime#7029 and it fixes the bug I was seeing.

@sunfishcode sunfishcode merged commit 0b19bc3 into bytecodealliance:main Sep 18, 2023
sunfishcode added a commit to sunfishcode/wit-abi-up-to-date that referenced this pull request Sep 29, 2023
In particular, this has bytecodealliance/wit-bindgen#670, which fixes a
bug hit by `poll-list`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants