- From: Luke Wagner <lwagner@mozilla.com>
- Date: Mon, 14 Sep 2015 10:16:50 -0500
- To: Mariano Guerra <mariano@marianoguerra.org>
- Cc: public-webassembly@w3.org
Hello Mariano, The issue is that `call_indirect` requires an immediate integer operand that picks which function table to dispatch out of (see "table" in the External Syntax [1]). Your example will work if you have (call_indirect 0 (get_local 0)) and then add a module-level (table 0 1) (which means a table containing the first and second functions). That being said, this is an area where spec doesn't match design; function pointers are still in flux in the design repo (see [2] and linked discussions). I actually expect that the design is going to move toward ml-proto on this issue; I'd hold off writing tests for the moment. On a general note: the wasm group tends to do all of its discussion via GitHub issues, not the mailing list and this question would be perfectly welcome in https://github.com/WebAssembly/design/issues. Cheers, Luke [1] https://github.com/WebAssembly/spec/blob/master/ml-proto/README.md#external-syntax [2] https://github.com/WebAssembly/design/issues/89 On Fri, Sep 11, 2015 at 1:34 PM, Mariano Guerra <mariano@marianoguerra.org> wrote: > hi, I'm playing with the ml-proto implementation and I have a doubt. > > let's say I want to call a function inside the module I am by index, but the > index is passed as an argument to the current function, for that should i > use call or call_indirect? > > here is an example: > > (module > (func $one > (i32.const 1)) > > (func $fourthytwo > (i32.const 42)) > > (func $ic (param i32) > (call (get_local 0))) > > (export "one" $one) > (export "ft" $fourthytwo) > (export "ic" $ic)) > > at the moment I get forth.wasm:9.11-9.12: syntax error if I use call or > call_indirect. > > is it because it's not implemented, because I'm using it wrong or because it > doesn't work that way? > > I tried with addressof but it doesn't seem to be implemented.
Received on Monday, 14 September 2015 15:17:23 UTC