We should have an add, edit, reorder, and remove mutator for each Wasm section (where it makes sense). This is a tracking issue for each of these things.
In general, removing an entity should be something done optimistically, but which can fail if the entity is referenced in other sections (e.g. if we are trying to remove a global, but a function uses it via global.get or global.set).
Custom Sections
Type Section
Import Section
Function Section
Table Section
Memory Section
Global Section
Export Section
Start Section
Element Section
Code Section
Peephole Mutations
Code Motion Mutations
Data Section
Data Count Section
Not really applicable. More of something we just have to keep up to date based on mutations of the data section.
We should have an add, edit, reorder, and remove mutator for each Wasm section (where it makes sense). This is a tracking issue for each of these things.
In general, removing an entity should be something done optimistically, but which can fail if the entity is referenced in other sections (e.g. if we are trying to remove a global, but a function uses it via
global.getorglobal.set).Custom Sections
Type Section
Import Section
Function Section
Table Section
Memory Section
Global Section
Export Section
Start Section
Element Section
ref.funcs referencing this function)Code Section
Peephole Mutations
(elem.drop.*) => (container)instead of(elem.drop.0) => (container)and(elem.drop.1) => (container), etc...)f64orf32value with NaN (when not preserving semantics)(i32.add ?x ?y)into(i32.mul ?x ?y), etc... (when not preserving semantics)Code Motion Mutations
if/else/loop/blockwithunreachable(if not preserving semantics)if .. else .. endwith just the consequent or just the alternative as ablock(if not preserving semantics)loopwithblockand vice versa (if not preserving semantics)if/else,block, orloop, dropping parameters and producing dummy value results as necessary (if not preserving semantics)block .. endas just the..part (will require checking that there are nobrinstructions targeting the block, as well as renumbering nestedbrs that jump to some label outside this block)Data Section
Data Count Section
Not really applicable. More of something we just have to keep up to date based on mutations of the data section.