Skip to content

wasm_gen macros should support conditionals inside them #47

@pufferfish101007

Description

@pufferfish101007

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions