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

Closed
trolund opened this issue Nov 20, 2023 · 3 comments
Closed

Unexpected token "null" with WasmGC example #2333

trolund opened this issue Nov 20, 2023 · 3 comments

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.

@kevmoo
Copy link

kevmoo commented Jan 15, 2025

I see that gc is an option now, but this is still failing out.

Trying w/ this wasm file (using GC) https://kevmoo.com/main.wasm

wasm2wat --enable-all main.wasm
000000f: error: expected valid field type (got -0x8)

@keithw
Copy link
Member

keithw commented Jan 15, 2025

WABT does not support the GC proposal. We don't even have them on the matrix at https://github.com/WebAssembly/wabt/ . The wasm-tools suite does support them though.

@keithw keithw closed this as completed Jan 15, 2025
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

3 participants