Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: Store raw intrinsics in vtables #1187

Merged

Conversation

alexcrichton
Copy link
Member

Instead of generating a wrapper-per-intrinsic try to instead store raw functions inside of vtables to push as much code as possible into mod async_support, as it's generally easier to grok code in one location rather than generated code.

Note that this does not update the read or write vtable functions as they're going to be trickier, if even possible, to expose the more raw version.

This shouldn't have any functional change, it's just a reorganizing. The cancel_* intrinsics are all marked with a TODO, however, to come back and reconsider the return value which is otherwise discarded right now.

Instead of generating a wrapper-per-intrinsic try to instead store raw
functions inside of vtables to push as much code as possible into `mod
async_support`, as it's generally easier to grok code in one location
rather than generated code.

Note that this does not update the `read` or `write` vtable functions as
they're going to be trickier, if even possible, to expose the more raw
version.

This shouldn't have any functional change, it's just a reorganizing.
The `cancel_*` intrinsics are all marked with a `TODO`, however, to come
back and reconsider the return value which is otherwise discarded right
now.
@alexcrichton alexcrichton requested a review from dicej March 3, 2025 22:03
@@ -84,7 +103,11 @@ impl<T> CancelableWrite<T> {
Handle::LocalReady(..) => {
entry.insert(Handle::LocalOpen);
}
Handle::Write => (writer.vtable.cancel_write)(writer.handle),
Handle::Write => unsafe {
// TODO: spec-wise this can return `BLOCKED` which seems
Copy link
Collaborator

Choose a reason for hiding this comment

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

It can only return BLOCKED if called with the async option enabled. As long as we don't try to import it using the [async] prefix, we should be good.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah ok, I'll leave this as a follow-up of #1188 to come back and fill in comments here.

@alexcrichton alexcrichton added this pull request to the merge queue Mar 4, 2025
Merged via the queue into bytecodealliance:main with commit a2d6b03 Mar 4, 2025
25 checks passed
@alexcrichton alexcrichton deleted the refactor-intrinsics branch March 4, 2025 16:10
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