-
Notifications
You must be signed in to change notification settings - Fork 11
Add import/export mutable globals #329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
tolauwae
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, I made a few comments.
However, I realised while reviewing that we can't properly test this without multiple module support (#27), right?
It is possible to test this since globals cannot only be shared between modules but also between a module and the host. |
This still doesn't cover all use cases, but it should suffice for now indeed. |
Checking whether the global.set target is mutable is a validation check that is therefore redundant to perform at runtime (and only slows down execution).
2dd47af to
6b1e1ed
Compare
Closes #299.
This extends the implementation of global variables in the VM with mutability and import / export semantics.
It provides encapsulation of globals, mutability checks and import resolution.
This change restructures the global variable to align with the accepted proposal https://github.com/WebAssembly/mutable-global/blob/master/proposals/mutable-global/Overview.md.
The host program can now define globals for import in the module as follows:
Conversely, the host can also access globals exported in the module: