Canonicalisation of host function types #580
-
I'm working on implementing RTT's and I'm wondering how to approach creating an RTT for a host function, say through the embedding API Currently I'm aggregating all RTTs in the store as solution, which works but I'm unsure if this is the right approach. For context this is important for instructions like call indirect which retrieve the RTT from the function instance, and without this approach I'd have to fall back to structural defined type matching. I appreciate this is somewhat of an engine question as opposed to the spec, but I've seen the custom descriptors proposal around making RTTS something more concrete and was wondering how people suggest approaching this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Yes, that is the typical implementation. Note that this is rather unrelated to GC types, since functions required a runtime representation of their type in Wasm 1.0 already, to support the runtime check necessary for call_indirect. |
Beta Was this translation helpful? Give feedback.
-
I just came upon this topic in the context of Custom Descriptors. The conclusion I've arrived at (which is perhaps obvious in retrospect) is:
Pleasingly, this separation between (1) cached canonical unconfigurable RTTs and (2) uncached configurable RTTs potentially with JavaScript prototypes also achieves compatibility with the requirement to prevent cross-context (aka cross-"world", cross- |
Beta Was this translation helpful? Give feedback.
I just came upon this topic in the context of Custom Descriptors. The conclusion I've arrived at (which is perhaps obvious in retrospect) is: