Skip to content

wasm_gen macros should support conditionals inside them #47

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Fields

    Priority

    priority: medium

    Effort

    effort: high

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions