WebAssembly / WebAssembly/binaryen

Missed opportunity to merge private types into public supertypes

Open
#7,120 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

MergeTypes currently treats all public types as terminal DFA states, meaning they have no successors. This can prevent private subtypes of public types from being merged into the public supertypes because their states have different behavior.

The types in this test case are currently not merged, but they should be:

(module
 (type $public (sub (struct (field (ref null $public)))))
 (type $sub (sub $public (struct (field (ref null $public)))))

 (global $g (export "g") (ref null $public) (ref.null none))

 (func $test
  (local (ref $public))
  (local (ref $sub))
 )
)

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 locating MergeTypes in Binaryen and reproduce the issue with the WebAssembly module in the report. Trace how public types are treated as terminal DFA states, then verify the private subtype and public supertype are merged for this case. Done means the supplied test case merges the types without regressing existing behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.