WebAssembly / WebAssembly/binaryen

Asyncify produces invalid IR for inner passes

Open
#8,753 0 comments 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

In https://github.com/WebAssembly/binaryen/pull/8738#discussion_r3282670237, we found that Asyncify creates calls to functions that don't exist, and then runs some inner passes. With the code from #8738, SimplifyLocals crashes when trying to lookup a function that doesn't exist (__asyncify_get_call_index in this case). We should add these functions as imports so that passes don't need to handle invalid IR.

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 in src/passes/Asyncify.cpp at the cited call-generation code around lines 1256 and 1864-1880, then inspect how the inner passes resolve functions. Reproduce the SimplifyLocals crash involving __asyncify_get_call_index. Done means Asyncify represents these generated functions as imports so its inner passes no longer process invalid IR.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, wasm
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.