WebAssembly / WebAssembly/binaryen
Add option to force table elements to be considered immutable
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 69
Description
Binaryen has some optization that is unlocked when the table is immutable:
With emscripten however, the table is always either imported or exported so this optimization is never enabled in practice.
However, emscripten usage of the table from JS never actually mutates existing table elements. It will read from the table and add new elements but it will never mutate of remove table elements generated by C/C++ (wsam-ld).
Perhaps we could have an options such as --immutable-table-elems which would force binaryen to consider static table elements to be immutable? We should run some benchmarks to see if this is worth while.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the referenced Directize.cpp optimization and how Emscripten tables are imported or exported. Investigate whether static table elements can safely be treated as immutable despite JavaScript adding elements, then benchmark the relevant workloads. Done means a validated option such as --immutable-table-elems with evidence that the optimization is worthwhile.
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
- Mostly clear
- Newbie friendliness
- 25/100