Skip to content

Support block-type parameters #6407

Closed

Description

@wingo

Binaryen does not currently support block / if / loop / try parameters, which were added to the standard a few years ago via the multi-value proposal.

The Hoot Scheme compiler emits blocks with parameters, which works fine in browsers, but we cannot use wasm-opt on our binaries for this reason:

$ bin/wasm-opt --all-features ~/src/guile-hoot/out.wasm
[parse exception: control flow inputs are not supported yet (at 0:83175)]
Fatal: error parsing wasm (try --debug for more info)

See also #5962 and #5950.

Activity

  1. tlively commented on Mar 18, 2024

    @tlively
    Member

    Thankfully once we switch to the new wat parser (and also rewrite the binary parser to use the new IRBuilder utility), it will be easy to add support for block parameters by having the parsers implicitly lower them away and use locals instead.

    Unfortunately having more in-depth support for block parameters than that is not really feasible with the structure of Binaryen IR, but it's plausible that in the future we could use an alternative IR to do late-stage optimizations that could reintroduce them before module writing.

  2. jayphelps commented on Apr 21, 2024

    @jayphelps
    Contributor

    Moonbit compiler also emits these. Btw I much appreciate that you all added error checking for this situation and now emit a clear error when encountered. I was at first using an old version of wasm-opt that didn't emit that error and I was confused what was wrong, but once I updated I was happy to at least see a clear answer.

  3. added a commit that references this issue on Dec 13, 2024
    abba33d
  4. added a commit that references this issue on Dec 14, 2024
    8a88ba2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions