Skip to content

Make async api work with JSPI under the hood for JavaScript backend#6011

Closed
syrusakbary wants to merge 93 commits intomainfrom
wasix-context-api
Closed

Make async api work with JSPI under the hood for JavaScript backend#6011
syrusakbary wants to merge 93 commits intomainfrom
wasix-context-api

Conversation

@syrusakbary
Copy link
Copy Markdown
Member

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)

Copilot AI review requested due to automatic review settings January 5, 2026 11:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread lib/api/tests/jspi_async.rs
Comment thread lib/wasix/tests/context_switching/wrong_entrypoint.c Outdated
Comment thread lib/wasix/tests/context_switching/function_args_preserved.c Outdated
Comment thread lib/wasix/tests/context_switching/switch_from_recursion.c Outdated
Comment thread lib/wasix/tests/context_switching/global_ctx_ids.c Outdated
@marxin
Copy link
Copy Markdown
Contributor

marxin commented Mar 27, 2026

Closing by creating an issue: #6359.

@marxin marxin closed this Mar 27, 2026
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