interactive-examples icon indicating copy to clipboard operation
interactive-examples copied to clipboard

Add return_call example for WASM

Open pepelsbey opened this issue 8 months ago • 6 comments

Description

Adds example for return_call, tail call version of the call. I took it from the explainer.

But there’s a catch: the playground shows an error when I try to run the code. There might be two reasons for that:

  • I don’t fully understand what I’m doing (first time looking at WASM)
  • Playground doesn’t support return_call, see the error below

Motivation

To support enabled tail calls in Firefox 121.

Additional details

> Error: parseWat failed:
3:6: error: opcode not allowed: return_call
    (return_call $fac-aux (local.get $x) (i32.const 1))
     ^^^^^^^^^^^
10:10: error: opcode not allowed: return_call
        (return_call $fac-aux
         ^^^^^^^^^^^

Related issues and pull requests

https://github.com/mdn/content/issues/30333

pepelsbey avatar Dec 15 '23 15:12 pepelsbey