WebAssembly / WebAssembly/binaryen

Provide a way to detect asyncified exports

Open
#2,322 1 comment 0 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

Currently, Asyncify pass transforms only functions that call into potentially asynchronous imports (directly or indirectly) and leaves others untouched.

However, from the JavaScript wrapper side, it's impossible to know which exports ended up being asyncified and which not, and so all exported functions end up being transformed into async ones even if it's unnecessary.

In order to improve efficiency and provide an async API only for exports that actually require it, Asyncify pass should somehow mark the transformed exports.

There are two potential ways to go about this: 1) add custom prefix or suffix to export names which would be detected as a marker and stripped by the JS wrapper or 2) add a custom section(s?) listing all such export names that could be read by JS wrapper using WebAssembly.customSections('asyncify').

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 with the Asyncify pass and the JavaScript wrapper described in the issue, then examine how WebAssembly customSections('asyncify') is exposed. Define a marker for exports that were asyncified and verify that the wrapper can use it to provide async behavior only for those exports.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.