Add async support to the component model C API#12973
Open
chaynabors wants to merge 1 commit intobytecodealliance:mainfrom
Open
Add async support to the component model C API#12973chaynabors wants to merge 1 commit intobytecodealliance:mainfrom
chaynabors wants to merge 1 commit intobytecodealliance:mainfrom
Conversation
405336c to
ab667f1
Compare
ab667f1 to
7784a33
Compare
alexcrichton
reviewed
Apr 7, 2026
Member
alexcrichton
left a comment
There was a problem hiding this comment.
Thanks for this! Just some minor stylistic comments below, but overall looks great.
There's currently no tests in this PR, and while I realize that we don't currently have tests for async in the C/C++ APIs, would you be up for adding some at least simple tests for calling functions/host functions/etc?
Comment on lines
+79
to
+83
| #ifdef WASMTIME_FEATURE_COMPONENT_MODEL_ASYNC | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif |
Member
There was a problem hiding this comment.
Could this go within the above WASMTIME_FEATURE_COMPONENT_MODEL block to avoid needing to redo the extern "C" bits?
| #ifdef WASMTIME_FEATURE_COMPONENT_MODEL_ASYNC | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { |
Member
There was a problem hiding this comment.
Similar to above, can this block move upwards to avoid duplicating the extern "C"?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #12955
Adds async equivalents of the component model C API, following the existing core module async patterns in
async.h.New functions:
wasm_component_model_asyncwasm_component_model_async_builtinswasm_component_model_async_stackfulwasmtime_component_func_call_asyncwasmtime_component_linker_instantiate_asyncwasmtime_component_linker_instance_add_func_asyncwasmtime_component_linker_add_wasip2_asyncwasmtime_component_linker_add_wasi_http_asyncA few notes on the design:
wasm_val_storage). The sync component model C API doesn't have it either, so this could be a follow-up for both sync and async.component-model-async, enabled by default in release builds. Should this be disabled by default?