WebAssembly / WebAssembly/wabt

wat2wasm doesn't support wasm GC?

Open
#2,530 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
8.1k
Forks
827
Avg merge
4d 6h
Merged PRs (30d)
18

Description

code example:

;; wat2wasm --enable-gc ./test.wat
(module
    (type $i32_arr (array (mut i32)) )

    (func $createArray (param $len i32) (result i32) 
        (array.new
            $i32_arr
            (i32.const 42)      ;; initial value 
            (local.get $len)   ;; array len
        )
        (array.get
            $i32_arr
            (i32.const 0)   ;; element idx
        )
    )

    (export "createArray" (func $createArray) )
)

error msg:

./test.wat:6:10: error: unexpected token "array.new", expected an instr.
        (array.new

wat2wasm doesn't support array instr?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided test.wat example with wat2wasm --enable-gc and trace how wat2wasm parses instructions. The payload names no source files or tests, so locate the parser and existing GC support before assessing the change. Done means the example accepts array.new and array.get without the reported unexpected-token error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, wasm
Domain
compilers, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.