-
Notifications
You must be signed in to change notification settings - Fork 71
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
Are functions still required to be pre-declared as referable? #499
Comments
Update: it appears that the reference interpreter has just changed to use constant initializers ( |
I don't know what the intention is here. I don't recall ever having discussed it 😅 |
IIRC we explicitly decided that the occurrence of a function index in a global/table initialiser, active/passive elem segment, or export would also (in addition to the "normal" declarative elem segment case) count as "referencing" for the purposes of allowing I remember @rossberg being against this relaxing at the time :) |
WebAssembly/reference-types#31 See @lukewagner's comment towards the end, which I think pretty much sums up the eventual decision
|
@conrad-watt Thanks for doing the legwork to dig this up. It seems the most consistent that all element segments behave the same (counting as a reference), regardless of whether they were function indexes or |
agree - especially since we previously said that occurrences of |
Right, IIRC, it was the group's sentiment to count every occurrence of a function reference outside a function body to be sufficient as a "forward declaration". That's what spec and interpreter implement. (This forward declaration thing probably is one of Wasm's biggest hacks.) Legacy element segments with just function indices are desugared into reference instructions by the spec, so they naturally behave consistently. FWIW re the OP: the text format never implies hidden forward declarations. What you see is what you get when converting to binary. |
@rossberg Thanks, I think we can close this now. |
The current reference interpreter passes this test (excerpted from
type-equivalence.wast
):However, when translating it to
.bin.wast
, it does not pre-refer to the functions in the table. IIUC this is a change from previous behavior. Do we still require functions to be pre-declared (in elements) to be used withref.func
?The text was updated successfully, but these errors were encountered: