Page MenuHomePhabricator

[WebAssembly] Initial support for reference type funcref in clang
Needs ReviewPublic

Authored by pmatos on Jun 23 2022, 6:49 AM.

Details

Summary

This is the funcref counterpart to 104bad5a. We introduce a new attribute
that marks a function pointer as a funcref. It also implements builtin
__builtin_wasm_ref_null_func(), that returns a null funcref value.

Diff Detail

Event Timeline

pmatos created this revision.Jun 23 2022, 6:49 AM
pmatos requested review of this revision.Jun 23 2022, 6:49 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 23 2022, 6:49 AM
pmatos planned changes to this revision.Jun 23 2022, 6:49 AM

Draft patch as some tests still fail.

pmatos updated this revision to Diff 439383.Jun 23 2022, 7:10 AM

Remove conflict marker

pmatos updated this revision to Diff 445410.Mon, Jul 18, 12:56 AM

Completely refactored the initial solution to funcref implementation and design.

Now it works similarly to the __ptr32 attribute from -fms-extensions.
We keep _both_ attribute and address space through the frontend, which is then automatically
converted to the proper LLVM address space through the AddressSpaceMap.

pmatos updated this revision to Diff 445524.Mon, Jul 18, 8:54 AM

Cleanedup the code. Ready to review.

pmatos updated this revision to Diff 446406.Thu, Jul 21, 2:58 AM

Rebase on top of main. Add missing code in Sema* to ensure the new funcref builtin is checked for.
Thanks to @asb for helping fix this.

pmatos updated this revision to Diff 446726.Thu, Jul 21, 11:53 PM

Update the patch as there were some missing calls from SemaChecking.
Thanks to @asb for spotting it.

pmatos added a comment.Fri, Aug 5, 6:28 AM

It would be great to get this landed. Can someone pls take a look at it? It's quite independent from the remainder of the work and self-contained.

maybe @tlively ping?