[PATCH] D139010: [clang][WebAssembly] Implement support for table types and builtins

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 6 10:54:43 PDT 2023


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

Spotted a typo in the docs, but otherwise LGTM (thanks for your patience while I was out last week).



================
Comment at: clang/docs/LanguageExtensions.rst:2310
+information related to the semantics of the builtins, please refer to the `WebAssembly Specification <https://webassembly.github.io/spec/core/>`_.
+In this section, when we refer to reference types, we are reffering to 
+WebAssembly reference types, not C++ reference types unless stated
----------------



================
Comment at: clang/docs/LanguageExtensions.rst:2288
+argument is the index to which to store the value into, and the
+third argument is a value of reference type to store in the table.
+It returns nothing.
----------------
pmatos wrote:
> aaron.ballman wrote:
> > pmatos wrote:
> > > aaron.ballman wrote:
> > > > This sounds like any reference type will work, e.g.,
> > > > ```
> > > > static __externref_t table[0];
> > > > void func(int i) {
> > > >   int &ref = i;
> > > >   __builtin_wasm_table_set(table, i, ref);
> > > > }
> > > > ```
> > > > so might want to say "value of ``_externref_t`` type" instead?
> > > Any reference type will work, i.e. externref or funcref. You can also store funcrefs in a wasm table. But of course, it needs to be well-typed. You cannot store a funcref value in an externref table and vice-versa.
> > My point is more that "any reference type" suggests you can use an arbitrary C++ reference type like `int &` and I think we mean something more specific than that, right?
> Yes, of course, I always mean a WebAssembly reference type in this context.
Thanks for the clarifying note!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139010/new/

https://reviews.llvm.org/D139010



More information about the cfe-commits mailing list