diff options
author | Alon Zakai <azakai@google.com> | 2021-10-06 14:23:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-06 21:23:48 +0000 |
commit | 10efbdfbb39f3710a21746d28dbcf4aa7156f147 (patch) | |
tree | 5d20027e0be1b3840cd85ed9814d15b9c0527b0b /test/binaryen.js/functions.js | |
parent | 19a98619cbe402b39dc298604169f8dd994c082f (diff) | |
download | binaryen-10efbdfbb39f3710a21746d28dbcf4aa7156f147.tar.gz binaryen-10efbdfbb39f3710a21746d28dbcf4aa7156f147.tar.bz2 binaryen-10efbdfbb39f3710a21746d28dbcf4aa7156f147.zip |
[Wasm GC] GlobalTypeOptimization: Turn fields immutable when possible (#4213)
Add a new pass to perform global type optimization. So far this just
does one thing, to find fields with no struct.set and to turn them
immutable (where possible - sub and supertypes must agree).
To do that, this adds a GlobalTypeRewriter utility which rewrites
all the heap types in the module, allowing changes while doing so.
In this PR, the change is to flip the mutable field. Otherwise, the
utility handles all the boilerplate of creating temp heap types using
a TypeBuilder, and it handles replacing the types in every place
they are used in the module.
This is not enabled by default yet as I don't see enough of a benefit
on j2cl. This PR is basically the simplest thing to do in the space of
global type optimization, and the simplest way I can think of to
fully test the GlobalTypeRewriter (which can't be done as a unit
test, really, since we want to emit a full module and validate it etc.).
This PR builds the foundation for more complicated things like
removing unused fields, subtyping fields, and more.
Diffstat (limited to 'test/binaryen.js/functions.js')
0 files changed, 0 insertions, 0 deletions