You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Initialization of externref-type tables by an element segment #1543
I'm confused how to interpret this. E.g., the below test seems to demonstrate initializing a table of element type externref from an element segment. It passes in the reference interpreter, but fails in WABT and maybe elsewhere. (I don't think there are any nonempty externref-type element segments in the current core testsuite, either valid or invalid.) What's the intended behavior?
(module$m
(table$t (export"table") 2externref)
(func (export"get") (param$ii32) (resultexternref)
(table.get$t (local.get$i)))
(func (export"set") (param$ii32) (param$xexternref)
(table.set$t (local.get$i) (local.get$x))))
(register"exporter"$m)
(assert_return (invoke$m"get" (i32.const0)) (ref.nullextern))
(assert_return (invoke$m"get" (i32.const1)) (ref.nullextern))
(assert_return (invoke$m"set" (i32.const0) (ref.extern42)))
(assert_return (invoke$m"set" (i32.const1) (ref.extern137)))
(assert_return (invoke$m"get" (i32.const0)) (ref.extern42))
(assert_return (invoke$m"get" (i32.const1)) (ref.extern137))
;; The table (of element type externref) can;; be initialized with an element segment,;; which seems to contradict the note at;; https://webassembly.github.io/spec/core/syntax/modules.html#element-segments
(module
(import"exporter""table" (table$t2externref))
(elem (i32.const0) externref (ref.nullextern)))
(assert_return (invoke$m"get" (i32.const0)) (ref.nullextern))
(assert_return (invoke$m"get" (i32.const1)) (ref.extern137))
You are right, this note is wrong, see #1545. (I don't remember where it came from, perhaps because we didn't have the generalised element syntax at first.)
Activity
rossberg commentedon Oct 4, 2022
You are right, this note is wrong, see #1545. (I don't remember where it came from, perhaps because we didn't have the generalised element syntax at first.)
keithw commentedon Oct 4, 2022
Thanks much. If this is the case, though, I think the spec should definitely have tests for:
I don't think it has either right now (and I believe WABT and probably other implementations wouldn't pass these tests today).
rossberg commentedon Oct 5, 2022
Well, happy to take a PR. ;)