WebAssembly / WebAssembly/binaryen

Add helper `getSingleMemory`

Open
#4,915 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

I wonder if it's worth having a method like wasm.getOnlyMemory that asserts that there is exactly one memory and returns is. Then finding all the places that need to be updated to handle multi-memory could be found by searching for uses of that method.

Originally posted by @tlively in https://github.com/WebAssembly/binaryen/pull/4811#discussion_r938212968

This sounds like a good idea to me. I think getSingleMemory would be perhaps a better name given existing getSingle* stuff we have. Also the method could be on MemoryUtils.

Originally posted by @kripken in https://github.com/WebAssembly/binaryen/pull/4811#discussion_r946954463

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 MemoryUtils and existing getSingle* helpers in the Binaryen codebase, then review the linked discussion for the intended naming and behavior. Add a helper that asserts exactly one memory and returns it, and use its call sites to identify remaining multi-memory assumptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, wasm
Domain
compilers
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 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.