Currently if there is a small section of WASM that needs to be conditionally generated (depending on flags, input types etc), it uses the pattern of wasm![...].into_iter().chain( if ... { wasm![...] } else { wasm![...] }).chain(...).collect(), which is fine but not amazing. Ideally we'd be able to write something like
wasm![
I32Const(0),
...,
@if(condition),
...
@else,
...
@endif,
...
]
which would desugar to iterator chaining.
The special instructions (@isnan, @box etc) should then also use this sort of pattern rather than if/else-ing the entire sequence of instructions with a strange bitmask, as I don't really know how the code works at the moment.
Currently if there is a small section of WASM that needs to be conditionally generated (depending on flags, input types etc), it uses the pattern of
wasm![...].into_iter().chain( if ... { wasm![...] } else { wasm![...] }).chain(...).collect(), which is fine but not amazing. Ideally we'd be able to write something likewhich would desugar to iterator chaining.
The special instructions (
@isnan,@boxetc) should then also use this sort of pattern rather than if/else-ing the entire sequence of instructions with a strange bitmask, as I don't really know how the code works at the moment.