winch: implement ref.null, ref.is_null, ref.func, and typed select#12940
winch: implement ref.null, ref.is_null, ref.func, and typed select#12940cfallin merged 3 commits intobytecodealliance:mainfrom
Conversation
e2ab600 to
db12a1b
Compare
There was a problem hiding this comment.
Pull request overview
Adds initial support for core WebAssembly reference-type operators (funcref-only) in Winch, enabling compilation of modules that use ref.null, ref.is_null, ref.func, and typed select, while rejecting unsupported heap types in line with existing table-op behavior.
Changes:
- Implement
ref.null,ref.is_null, andref.funcvisitor lowering (funcref-only; other heap types error out). - Add support for typed
selectby delegating to the existingselectlowering. - Extend the “supported ops” list so these operators are no longer treated as unimplemented.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
db12a1b to
b9dd9f3
Compare
b9dd9f3 to
3ceeab8
Compare
3ceeab8 to
9fe5fa4
Compare
Subscribe to Label ActionDetailsThis issue or pull request has been labeled: "winch"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
cfallin
left a comment
There was a problem hiding this comment.
This looks reasonable overall to me -- thanks!
A few testing requests:
- It doesn't look like
ref.func's return value is actually tested with a call; could you add a test case that does atable.setthen acall_indirectto make use of it? - It would be great to have disas tests (
tests/disas/winch/) for all of these operators as well.
|
Thanks for the quick review @cfallin! Added the tests here: |
cfallin
left a comment
There was a problem hiding this comment.
Looks reasonable to me -- thanks!
|
@r-near there's a CI test failure (see status from the merge queue attempt) -- perhaps a test is running that shouldn't yet with the current implementation status. Could you take a look? |
Implements the core reference type instructions for Winch (funcref only):
ref.null: pushes a null funcref (pointer-sized zero)ref.is_null: compares a ref to zero, produces i32 0/1ref.func: calls the existingref_funcbuiltin to get a funcref for a function indexselect: delegates to the existing untypedselectimplementationNon-func heap types (externref, etc.) bail with an unsupported error, consistent with how
table_get,table_set, and other table ops already handle them.Relates to #8088, #9924.