Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of call_ref does not take a type indice in wat2wasm #2383

Closed
jlpettersson opened this issue Feb 4, 2024 · 1 comment
Closed

Use of call_ref does not take a type indice in wat2wasm #2383

jlpettersson opened this issue Feb 4, 2024 · 1 comment

Comments

@jlpettersson
Copy link

I am trying to use call_ref from function references. According to the linked documentation, I thought that I should include a type index when using call_ref instruction. But wat2wasm does not build with a type index passed.

I tried with this example, using latest wat2wasm (version 1.0.34).

(module
    (type $f_type (func (result i32)))
    (table 2 funcref)
    (elem (i32.const 0) func $f1 $f2)

    (func $f1 (result i32)
        (i32.const 99)
    )

    (func $f2 (result i32)
        (i32.const 71)
    )

    (func (export "c") (result i32)

        (ref.func $f1)
        (call_ref $f_type)  ;; expected to pass $f_type here, but only builds without it.

    )
)

When I change (call_ref $f_type) to only (call_ref), it builds using wat2wasm. However that wasm binary does not run using node --experimental-wasm-typed_funcref, it throws [CompileError: WebAssembly.instantiate(): Compiling function #2 failed: invalid signature index: 11 @+64], but this issue is mainly how I should use call_refwith wat2wasm.

@keithw
Copy link
Member

keithw commented Feb 6, 2024

WABT doesn't support the function-references (or GC) proposals -- we don't even have it in our feature matrix yet (https://github.com/WebAssembly/wabt/). :-(

You will probably have better luck with wasm-tools parse or binaryen's wasm-as.

@keithw keithw closed this as completed Feb 6, 2024
@keithw keithw closed this as not planned Won't fix, can't repro, duplicate, stale Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants