This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redesign top-level export implementation to handle mutable vars.
The previous strategy for top-level export could not lead to any workable support of mutable vars. We now follow a strategy similar to what the JS backend uses in its NoModule configuration. Previously, we compiled top-level exports as Wasm global exports. We then had a postprocessing step in the loader to extract the `.value` of the `WAGlobal` instances. This correctly captured the exported value right after the start function has finished. However, it could not update the exported value after a mutable static field was reassigned. Now, we turn everything everything around. Instead of the JS loader and wrapper *pulling* values from Wasm, the Wasm code *pushes* updates to top-level exports to JavaScript. That means we declare setter functions from JavaScript, and that we (counter-intuitively) *import* those setters into Wasm. Wasm calls the setters in the start function for all top-level exports, and again when assigning static fields that are exported.
- Loading branch information
Showing
7 changed files
with
83 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters