Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Embedding API changes

Open
#77 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
wasm
Domain
compilers

Research direction

The requested work is an update to the explainer's appendix; start by reading the existing embedding API and exception-handling extension described there. Done means the appendix sketches SUSPEND, cont_resume, host-function suspensions, payload and parameter-type requirements, and the stated JS API and JSPI consequences.

Written by the indexing model from the issue text.

Description

It would be good to update the explainer with a sketch of how we expect the embedding API given in the appendix to be extended.

Taking inspiration from how the embedding API is extended for exception handling, we can add a new kind of result from func_invoke, SUSPEND a, where a is a continuation address. We can also add a new function cont_resume that behaves exactly like func_invoke, except that it takes a continuation address instead of a function address. Finally, we can allow host functions to result in suspensions, just like we allow them to result in throws. The suspensions need to be able to carry payloads and need to record the types of the parameters necessary to resume the suspending continuation.

This set of changes are sufficient to allow the JS API spec to specify that an error should be thrown when calling an export results in SUSPEND a. It is also sufficient to specify JSPI in terms of core stack switching by having JSPI suspending import wrappers return suspensions to Wasm carrying the suspending promises as payloads and having JSPI promising export wrappers call func_invoke, receive SUSPEND a, then schedule the future resumption of the continuation via cont_resume once the extracted suspending promise is resolved.

Dominant language
WebAssembly
Stars
216
Forks
19
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from WebAssembly/stack-switching

All issues in WebAssembly/stack-switching

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.