Skip to content

Conversation

@alexcrichton
Copy link
Member

This commit updates wit-component to probe for the existence of post-return functions rather than asserting their existence. This enables moves some more ABI bits to wit-bindgen-core since they otherwise don't quite make sense here. This additionally fixes a longstanding issue with wit-component, although it's not one that's actually come up in practice yet.

@alexcrichton alexcrichton force-pushed the probe-for-post-return branch from b1f3970 to 8894db2 Compare August 7, 2023 17:48
This commit updates `wit-component` to probe for the existence of
post-return functions rather than asserting their existence. This
enables moves some more ABI bits to `wit-bindgen-core` since they
otherwise don't quite make sense here. This additionally fixes a
longstanding issue with `wit-component`, although it's not one that's
actually come up in practice yet.
@alexcrichton alexcrichton force-pushed the probe-for-post-return branch from 8894db2 to 1899fc6 Compare August 9, 2023 18:52
@alexcrichton alexcrichton requested a review from dicej August 10, 2023 15:39
func: &Function,
) -> Result<()> {
let mut sig = resolve.wasm_signature(AbiVariant::GuestExport, func);
sig.params = mem::take(&mut sig.results);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment here might be helpful -- took me a minute to realize this was because the parameters to a post-return function should match the results of the primary function.

@alexcrichton alexcrichton enabled auto-merge (squash) August 10, 2023 17:29
@alexcrichton alexcrichton merged commit a0c46a7 into bytecodealliance:main Aug 10, 2023
@alexcrichton alexcrichton deleted the probe-for-post-return branch August 18, 2023 14:50
alexcrichton added a commit to alexcrichton/wasm-tools that referenced this pull request Aug 18, 2023
Release latest changes such as:

* `wasm-tools compose` now supports `-t` (bytecodealliance#1148)
* The `abi` module is removed from the `wit-parser` crate (bytecodealliance#1149, bytecodealliance#1159)
* Fix validation of lowered functions in the component model (bytecodealliance#1150)
* Fix a panic decoding WIT from a component (bytecodealliance#1157)
* Add text format and printing support for `dylink.0` (bytecodealliance#1135)
* Support shared-everything linking in `wasm-tools component new` (bytecodealliance#1133)
* Printing a WIT document now prints comments as well (bytecodealliance#1167)
* Disallow `(borrow $t)` in component function results (bytecodealliance#1162)
peterhuene pushed a commit that referenced this pull request Aug 18, 2023
Release latest changes such as:

* `wasm-tools compose` now supports `-t` (#1148)
* The `abi` module is removed from the `wit-parser` crate (#1149, #1159)
* Fix validation of lowered functions in the component model (#1150)
* Fix a panic decoding WIT from a component (#1157)
* Add text format and printing support for `dylink.0` (#1135)
* Support shared-everything linking in `wasm-tools component new` (#1133)
* Printing a WIT document now prints comments as well (#1167)
* Disallow `(borrow $t)` in component function results (#1162)
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.

3 participants