Skip to content

Implement a C ABI for async import/export communication#1254

Merged
alexcrichton merged 6 commits into
bytecodealliance:mainfrom
alexcrichton:async-libc-interface
Apr 3, 2025
Merged

Implement a C ABI for async import/export communication#1254
alexcrichton merged 6 commits into
bytecodealliance:mainfrom
alexcrichton:async-libc-interface

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This commit is an implementation of a solution for WebAssembly/component-model#485 for Rust. This should enable releasing multiple versions of wit-bindgen into the wild and have them all work together for now. Integration with wasi-libc will come in the future in theory.

This commit is an implementation of a solution for
WebAssembly/component-model#485 for Rust. This should enable releasing
multiple versions of `wit-bindgen` into the wild and have them all work
together for now. Integration with `wasi-libc` will come in the future
in theory.
@alexcrichton alexcrichton requested a review from dicej April 2, 2025 18:24
Copy link
Copy Markdown
Collaborator

@dicej dicej left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

Comment thread crates/guest-rust/rt/src/async_support/waitable.rs Outdated
alexcrichton and others added 3 commits April 2, 2025 12:13
Try to work around symbol/export trickery
Co-authored-by: Joel Dice <joel.dice@fermyon.com>
Comment thread crates/guest-rust/rt/src/async_support/cabi.rs Outdated
Comment thread crates/guest-rust/rt/src/async_support/cabi.rs Outdated
Comment thread crates/guest-rust/rt/src/async_support/cabi.rs Outdated
Comment thread crates/guest-rust/rt/src/async_support/cabi.rs

/// Indirect "vtable" used to connect imported functions and exported tasks.
/// Executors (e.g. exported functions) define and manage this while imports
/// use it.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note to self. Why am I making comments when I can't even visual what is meant by exporting a task?

Comment thread crates/guest-rust/rt/src/async_support/cabi.rs Outdated
Comment thread crates/guest-rust/rt/src/async_support/waitable.rs Outdated
@alexcrichton alexcrichton enabled auto-merge April 3, 2025 15:29
@alexcrichton
Copy link
Copy Markdown
Member Author

@FrankReh I've edited a few comments as you suggested, and while I'm going to flag this for merge I'm happy to follow-up with anything.

As you can see I'm not really high on the list to get any sort of literary award any time soon. My prose is definitely pretty ad-hoc and mostly referencing concepts in my head (e.g. "exported tasks") which are not official parts of the spec and while it makes sense to me we should update it to have something more official in the spec. That being said this is all in-flux as well as we figure out everything, so it's unlikely there's going to be a level of rigor in this documentation you, for example, might find with POSIX APIs. My hope is that this is mostly sufficient for now (at least I took the time to write something down?) and will be able to carry the implementation to the next iteration of everything.

@FrankReh
Copy link
Copy Markdown
Contributor

FrankReh commented Apr 3, 2025

@alexcrichton As always, you surprise on the positive side. It is a pleasure to watch the spiral of ideas and implementations and concerns and stop-gap measures get tighter and tighter as wasi-preview3 takes shape.

@alexcrichton alexcrichton added this pull request to the merge queue Apr 3, 2025
Merged via the queue into bytecodealliance:main with commit 80f46dd Apr 3, 2025
18 checks passed
@alexcrichton alexcrichton deleted the async-libc-interface branch April 3, 2025 16:59
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.

4 participants