wasmtime-runtime: Allow tables to internally hold externrefs#1882
Conversation
This commit enables `wasmtime_runtime::Table` to internally hold elements of either `funcref` (all that is currently supported) or `externref` (newly introduced in this commit). This commit updates `Table`'s API, but does NOT generally propagate those changes outwards all the way through the Wasmtime embedding API. It only does enough to get everything compiling and the current test suite passing. It is expected that as we implement more of the reference types spec, we will bubble these changes out and expose them to the embedding API.
Subscribe to Label Actioncc @peterhuene DetailsThis issue or pull request has been labeled: "wasmtime:api"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
|
👍 |
yurydelendik
left a comment
There was a problem hiding this comment.
Looks good with Option<VMExternRef> binary representation addressed.
| current_elements: x.len().try_into().unwrap(), | ||
| }, | ||
| TableElements::ExternRefs(x) => VMTableDefinition { | ||
| base: x.as_ptr() as *const u8 as *mut u8, |
There was a problem hiding this comment.
We are exposing Option<VMExternRef> elements to the CL or other low level compiler. It is hard to guess what type of binary representation we will be dealing with here. For comparison, I see #[repr(C)] near VMCallerCheckedAnyfunc.
There was a problem hiding this comment.
VMExternRef is repr(transparent) around a NonNull which is repr(transparent) around a pointer. Additionally, Option<NonNull<...>> is guaranteed to have the same representation as a pointer. So we should be good as far as binary representation goes.
This commit enables
wasmtime_runtime::Tableto internally hold elements ofeither
funcref(all that is currently supported) orexternref(newlyintroduced in this commit).
This commit updates
Table's API, but does NOT generally propagate thosechanges outwards all the way through the Wasmtime embedding API. It only does
enough to get everything compiling and the current test suite passing. It is
expected that as we implement more of the reference types spec, we will bubble
these changes out and expose them to the embedding API.
cc #929