Make async api work with JSPI under the hood for JavaScript backend#6011
Closed
syrusakbary wants to merge 93 commits intomainfrom
Closed
Make async api work with JSPI under the hood for JavaScript backend#6011syrusakbary wants to merge 93 commits intomainfrom
syrusakbary wants to merge 93 commits intomainfrom
Conversation
# Conflicts: # lib/wasix/src/bin_factory/exec.rs # lib/wasix/src/state/context_switching.rs # lib/wasix/src/syscalls/wasix/context_create.rs # lib/wasix/src/syscalls/wasix/context_destroy.rs # lib/wasix/src/syscalls/wasix/proc_fork.rs # lib/wasix/tests/context_switching.rs
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements JSPI-powered async API support for the JavaScript backend, building on prior work in PRs #5920 (async execution API) and #5881 (context switching). The changes enable async execution with context switching to work in JavaScript environments (browsers and Node.js).
Key Changes:
- Added 19 comprehensive C test files for context switching functionality covering various scenarios (recursion, state preservation, rapid switching, file I/O, heap allocations, etc.)
- Updated test infrastructure to support running tests in Node.js with experimental features
- Enhanced module debugging information to display import/function counts
- Moved futures dependency to support wasm32 targets
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/wasix/tests/context_switching/*.c | 19 new test files validating context switching behavior including recursion, state preservation, cleanup, and various edge cases |
| lib/wasix/src/lib.rs | Changed wasm test configuration from run_in_browser to run_in_node_experimental to support JSPI testing |
| lib/types/src/module.rs | Enhanced unnamed module debugging output to include counts of imported globals, functions, and total functions |
| lib/api/tests/simple_greenthread.rs | Migrated test to use universal_test macro and added wasm_bindgen_test support for cross-platform testing |
| lib/api/tests/jspi_async.rs | Added conditional compilation to exclude wasm32 targets (potential issue - see comments) |
| lib/api/Cargo.toml | Moved futures dependency from platform-specific to shared optional dependencies to support wasm32 |
| Makefile | Added experimental-async feature flag to JavaScript API test command |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
36169cc to
a14b791
Compare
Contributor
|
Closing by creating an issue: #6359. |
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.
In prior PRs ( #5920 #5881 ), we added support for Context Switching getting inspired by JSPI.
In this PR, we want to implement the new Wasmer async API powered by JSPI in browsers (and Node)