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

Unexpected token "null" with WasmGC example #2333

Open
trolund opened this issue Nov 20, 2023 · 1 comment
Open

Unexpected token "null" with WasmGC example #2333

trolund opened this issue Nov 20, 2023 · 1 comment

Comments

@trolund
Copy link

trolund commented Nov 20, 2023

I can see that wat2wasm does have the option to enable "gc", but when running the example below (with all features enabled), it fail. The example is from the article: https://v8.dev/blog/wasm-gc-porting

(module
  (type $Node (struct (field $next (ref null $Node)) (field $value (mut i32))))

  (global $global (mut (ref null $Node)) (ref.null $Node))

  (export "global" (global $global))

  (export "_start" (func $_start))

  (func $_start
    (local $i i32)
    (loop $loop
      (global.set $global
        (struct.new $Node
          (global.get $global)
          (local.get $i)
        )
      )
      (local.set $i
        (i32.add
          (local.get $i)
          (i32.const 1)
        )
      )
    
      (br_if $loop
        (i32.le_u
          (local.get $i)
          (i32.const 1000)
        )
      )
    )

  )
)

The error:

Error: parseWat failed:
test.wast:2:41: error: unexpected token "null", expected a numeric index or a name (e.g. 12 or $foo).
  (type $Node (struct (field $next (ref null $Node)) (field $value (mut i32))))

Is there any roadmap for the GC spec in wat2wasm?

@keithw
Copy link
Member

keithw commented Dec 5, 2023

We don't currently support the function-references or gc proposals (we don't even have them on the matrix at https://github.com/WebAssembly/wabt/), but given their imminent merger into the spec, I would really like to. I don't think we have anybody signed up for this at the moment though.

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