wabt
wabt copied to clipboard
Unexpected token "null" with WasmGC example
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?
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.