WebAssembly / WebAssembly/binaryen

Add Asyncify mode that uses "native" stack

Open
#2,934 10 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 19h
Merged PRs (30d)
69

Description

Something I mentioned in personal discussions with @kripken, posting here for tracking.

Low-level Asyncify API is flexible enough to support arbitrary suspend/resume use-cases, including coroutines. However, many applications don't really care about those and want to only suspend/resume the whole app on an external I/O.

For such cases, it could be nice to avoid having to allocate a separate "scratch space" for Asyncify, and instead push values directly onto the shadow stack behind __stack_pointer as defined by Tool Conventions. Semantically, those stored values are the spilled stack, so it only makes sense to store them there.

This would, in particular, simplify integrations like https://github.com/GoogleChromeLabs/asyncify, which currently have to make guesses about a free space area in a Wasm file where they could store Asyncify data, and would centralise stack size management for both Asyncify and regular stack in a single place.

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.

Research direction

Start by reading the low-level Asyncify API and the Tool Conventions definition of __stack_pointer, then compare how the GoogleChromeLabs/asyncify integration currently allocates scratch space. Done means Asyncify can store spilled values on the native shadow stack and share stack-size management with the regular stack.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.