You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wasm-mutate: Add a mutator to remove items in a module
This commit adds a new mutator to `wasm-mutate` which can remove any of
these items in a module:
* Functions
* Tables
* Memories
* Tags
* Globals
* Types
* Data
* Elements
This pass is not currently a "gc" pass where a set of used references is
generated, but rather the mutator considers itself applicable if a wasm
module contains any of the above items. If, during removal of an item,
the item is actually used then the mutation aborts with "not
applicable". It's expected that drivers like `wasm-shrink` will try
again with different seeds which will try a different mutator or will
otherwise try to remove a different item.
The main complexity in this mutator is that almost the entire module
(including the code section) is entirely rewritten. This is because item
references via index are everywhere in a wasm module and all of them are
candidate for being updated.
Overall my original test case for when `wasm-shrink` was first added
does indeed get successfully reduced down further from before, removing
extraneous functions and globals. The function-in-question still isn't
shrunk much but I believe that's because the peephole and code motion
mutator don't understand simd yet so those mutations are not applicable.
This commit also removes the recently added data segment and element
segment mutators. Their functionality is folded into this new
`RemoveItemMutator` mutator and the code section is now also updated to
account for updating `{elem,data}.drop` references.
0 commit comments