Skip to content

Split Wasm mutable globals into specific features - #29503

Merged
caugner merged 11 commits into
mdn:mainfrom
chrisdavidmills:wasm-mutable-globals
May 15, 2026
Merged

caugner merged 11 commits into
mdn:mainfrom
chrisdavidmills:wasm-mutable-globals

Conversation

@chrisdavidmills

Copy link
Copy Markdown
Contributor

Summary

As part of my mission to document all the missing Wasm features, I am working on making sure Wasm mutable globals are properly documented. We previously had a webassembly.mutable-globals data point, but this was just describing the overall feature itself, rather than the specific parts of the tech that comprise the feature. And it was only used to show a BCD table on the WebAssembly main landing page — having this many BCD tables on the same page is not a great user experience, so I have decided to start removing them and showing the information elsewhere.

I have updated the BCD to get rid of that, and:

  • Add a specific subfeature for the mutable option of the WebAssembly.Global() constructor.
  • Add separate data points for the global, global.get, and global.set Wasm text format instructions. I've put these in an instructions directory, and I could also see us adding further directories for definitions, types, etc.

This is not ready to merge yet. The main outstanding issues are as follows, which I am hoping @eqrion and colleagues can weigh in here and advise, as well as the BCD folks:

  • I have no idea if the browser support versions are correct. For now, I've just copied the mutable_globals support versions. I'm not really sure how to find all this information (for Wasm instructions in general, not just these few instructions) without it being hugely time-consuming. Any thoughts?
  • We need to get agreement on whether this kind of structure is appropriate and will work for Wasm?

Test results and supporting details

Related issues

@chrisdavidmills
chrisdavidmills marked this pull request as draft April 17, 2026 11:53
@github-actions github-actions Bot added the data:wasm Compatibility data for WebAssembly features. https://developer.mozilla.org/docs/WebAssembly label Apr 17, 2026
@chrisdavidmills
chrisdavidmills requested a review from caugner April 17, 2026 11:54
@github-actions github-actions Bot added the size:l Pull request changing 101-1,000 lines of code. label Apr 17, 2026
@github-actions

github-actions Bot commented Apr 17, 2026 •

Copy link
Copy Markdown
Contributor

Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).

@eqrion eqrion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasm 1.0 shipped in Firefox 55, Chrome 57, and Safari 11. You can use those version numbers for any instruction/definition that wasn't in a wasm proposal.

I also double checked the versions for the mutable globals proposal.

[1] https://www.firefox.com/en-US/firefox/52.0/releasenotes/?redirect_source=mozilla-org
[2] https://chromestatus.com/feature/5453022515691520
[3] https://developer.apple.com/library/archive/releasenotes/General/WhatsNewInSafari/Articles/Safari_11_0.html

Comment thread webassembly/instructions/global.json Outdated
Comment thread webassembly/instructions/global.json Outdated
@eqrion

eqrion commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

For wasm proposals, feature status is where browsers announce their support for a proposal.

@eqrion

eqrion commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

We need to get agreement on whether this kind of structure is appropriate and will work for Wasm?

I don't know much about how browser compat data works. The data in this PR seems reasonable, but also probably very repetitive? It'd be nice to automate or simplify it so it doesn't need to be per-function or per-definition.

chrisdavidmills and others added 3 commits April 21, 2026 10:32
@chrisdavidmills

Copy link
Copy Markdown
Contributor Author

The linter is currently failing because it doesn't recognise https://webassembly.github.io/spec/core/ as a valid spec. I've requested it be added in w3c/browser-specs#2449.

@chrisdavidmills

Copy link
Copy Markdown
Contributor Author

For wasm proposals, feature status is where browsers announce their support for a proposal.

Ah ha, this is really useful.

@chrisdavidmills

Copy link
Copy Markdown
Contributor Author

We need to get agreement on whether this kind of structure is appropriate and will work for Wasm?

I don't know much about how browser compat data works. The data in this PR seems reasonable, but also probably very repetitive? It'd be nice to automate or simplify it so it doesn't need to be per-function or per-definition.

Generally, what we do is record browser compat data as granularly as possible. This has many advantages in terms of flexibility:

  • You can refer to individual features, or group them to provide an overall sentiment of support for an entire spec or API, which is what we do with the baseline project
  • If a bug is found with a particular feature, or a new option (or whatever) is introduced, we can easily add that.
  • Generally, it is rare that an entire spec or featureset will have exactly the same browser support, so we need to be able to expose those differences.

So yes, it is pretty repetitive, but we can use a script to generate lots of BCD support files pretty quickly, provided the support data is the same. This is what I'm intending to do for the SIMD stuff I've just added. I'm assuming all the fixed-width SIMD instructions were supported at the same time (in the versions referred to on https://webassembly.org/features/?categories=browsers)?

@chrisdavidmills

Copy link
Copy Markdown
Contributor Author

The linter is currently failing because it doesn't recognise https://webassembly.github.io/spec/core/ as a valid spec. I've requested it be added in w3c/browser-specs#2449.

OK, scratch that. The bikeshed version of the spec is already in the system, so I'm using that instead. It is more searchable than the other version anyway.

@chrisdavidmills
chrisdavidmills marked this pull request as ready for review April 22, 2026 09:32
@eqrion

eqrion commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

So yes, it is pretty repetitive, but we can use a script to generate lots of BCD support files pretty quickly, provided the support data is the same. This is what I'm intending to do for the SIMD stuff I've just added. I'm assuming all the fixed-width SIMD instructions were supported at the same time (in the versions referred to on https://webassembly.org/features/?categories=browsers)?

Yes, all the fixed-width SIMD stuff was added in the same version. AFAIK, every wasm proposal has shipped as a unit in the same release. There may be some odd exceptions for a bug like you say, but I'd assume by default everything shipped together.

@caugner

caugner commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

@chrisdavidmills I was loosely following the conversation and was under the impression that this PR is not yet ready for review, but I might be wrong. Are you able to confirm?

@chrisdavidmills

Copy link
Copy Markdown
Contributor Author

@chrisdavidmills I was loosely following the conversation and was under the impression that this PR is not yet ready for review, but I might be wrong. Are you able to confirm?

@caugner yes, this is ready for review now.

This may require a bit more back and forth than the average review, as I am proposing a new data structure for Wasm features, so that we can have per-instruction/type/definition/whatever BCD rather than the really high-level ones that we had previously. Obviously, it would be good to get your input on the proposed structure.

I'm also thinking that, for BCD on the main WebAssembly landing page, it would be good to link to https://webassembly.org/features/?categories=browsers rather than showing a million different compatibility tables, which is pretty messy.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would opt to merge webassembly.instructions.global_{get,set} into webassembly/instructions.json. No need for per-feature JSON files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caugner, there are hundreds of instructions overall, especially when you start to consider the Wasm SIMD instructions. I can see how the single file would lead to a neater repo, but wouldn't it become a bit unwieldy?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If more instructions will be added, then this indeed makes sense.

@caugner caugner changed the title Add more accurate/specific BCD for Wasm mutable globals Split Wasm mutable globals into specific features May 15, 2026
@caugner
caugner merged commit f14ff99 into mdn:main May 15, 2026
9 checks passed
@mdn-bot mdn-bot mentioned this pull request May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:wasm Compatibility data for WebAssembly features. https://developer.mozilla.org/docs/WebAssembly size:l Pull request changing 101-1,000 lines of code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants