-
Notifications
You must be signed in to change notification settings - Fork 84
3-pronged subtyping hierarchy #310
Conversation
See #311 for implementation and tests. |
I still believe we do not need |
@manoskouk, I believe that wouldn't be forward-compatible. For example, if we later introduce type imports |
#### Classification | ||
#### External conversion | ||
|
||
* `extern.internalize` converts an external value into the internal representation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the discussions, in was mentioned that it would be useful for performance to include direct transformations to more specific abstract types. This might be best as a post-MVP feature though.
A while back @rossberg suggested introducing a |
I'm all for adding |
I am not following. Aren't we doing the same thing for |
Only if you are assuming that we are removing
This export will no longer be adequate in the presence of additional subtypes of extern. Maybe such a case is not very relevant in practice, but I see no benefit in not rectifying it along with the others. It's not like omitting it would simplify much. |
proposals/gc/MVP.md
Outdated
| -0x13 | `eqref` | | shorthand | | ||
| -0x14 | `(ref null ht)` | `ht : heaptype (s33)` | from funcref proposal | | ||
| -0x15 | `(ref ht)` | `ht : heaptype (s33)` | from funcref proposal | | ||
| -0x16 | `i31ref` | | shorthand | | ||
| -0x19 | `dataref` | | shorthand | | ||
| -0x1a | `arrayref` | | shorthand | | ||
| -0x1b | `nullref` | | shorthand | | ||
| -0x1c | `nullfuncref` | | shorthand | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that -0x1c
through -0x1f
are taken by the stringrefs proposal, see https://github.com/WebAssembly/stringref/blob/main/proposals/stringref/Overview.md#binary-encoding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing out. I opened WebAssembly/stringref#41.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, we've implemented these as:
| -0x17 | `nullexternref` |
| -0x18 | `nullfuncref` |
to resolve the conflict with the stringref proposal. (Of course this applies to lines 749/750 below as well.)
Co-authored-by: Matthias Liedtke <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM.
I'd recommend to make the binary encoding listed here reflect reality (see note below) before landing this PR, but that's up to you.
proposals/gc/MVP.md
Outdated
| -0x13 | `eqref` | | shorthand | | ||
| -0x14 | `(ref null ht)` | `ht : heaptype (s33)` | from funcref proposal | | ||
| -0x15 | `(ref ht)` | `ht : heaptype (s33)` | from funcref proposal | | ||
| -0x16 | `i31ref` | | shorthand | | ||
| -0x19 | `dataref` | | shorthand | | ||
| -0x1a | `arrayref` | | shorthand | | ||
| -0x1b | `nullref` | | shorthand | | ||
| -0x1c | `nullfuncref` | | shorthand | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, we've implemented these as:
| -0x17 | `nullexternref` |
| -0x18 | `nullfuncref` |
to resolve the conflict with the stringref proposal. (Of course this applies to lines 749/750 below as well.)
Changed opcodes. In the future, I would appreciate if we could get away from this mode of operation where implementations unilaterally deviate from what's proposed and then retroactively declare that "reality". ;) |
What other workflow would you want to see that still allows engines to have multiple arbitrary prototype/early-stage proposals in flight at once? |
I think it's less a question of workflow than one of style and communication. When you discover conflicts between, or unresolved issues with, proposals, try to help the champions to get them resolved. If resolution is blocking you for too long, discuss what temporary choices you could move forward with. Consider them temporary. |
This makes the necessary changes to the MVP doc for introducing the 3-pronged subtype hierarchy. For now, I haven’t done any renaming, so I went with types
any
anddata
and leave possible bikeshedding for later. Concretely:any
separately fromextern
(under the previous type code)nofunc
andnoextern
nullfuncref = (ref null nofunc)
andnullexternref = (ref null noextern)
t
, unlike before(in other words, checking against
any
becomes more costly)extern.internalize
andextern.externalize
ref.is_func
,ref.as_func
,br_on_func
,br_on_non_func
As discussed, there are no instructions for converting between extern and functions.
See #311 for implementation and tests.