alexcrichton opened PR #13235 from alexcrichton:c-api-reftypes to bytecodealliance:main:
This commit fills out APIs necessary to reflect on value types to get the full type hierarchy of WebAssembly. Currently types in the C API are primarily inherited from
wasm.hwhich notably doesn't handle proposals such as simd or GC or typed function references. This puts us in a bit of an awkward position where much of our API relies onwasm.h, but there's obvious holes inwasm.hthat would otherwise require modifications.This commit takes the route of adding a parallel
wasmtime_valtype_tdefinition fully tailored for Wasmtime's use case. Conversions are then provided betweenwasmtime_valtype_tandwasm_valtype_t. The Wasmtime version notably has a different representation which enables, for example, constructing primitive types without function calls.This then fills out the corresponding C++ APIs and fills gaps in the preexisting types. For example
FieldTypeis much different from before and now follows C++ idioms and semantics. Additionally it now has the ability to express the full breadth of all wasm types in fields and they can both be constructed and read.This is all necessary for some implementation work to fill out the GC proposal in the
wasmtime-pybindings where the lack of type information was otherwise leading to a pretty awkward API relative to the rest of the package.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested fitzgen for a review on PR #13235.
alexcrichton requested wasmtime-core-reviewers for a review on PR #13235.
github-actions[bot] added the label wasmtime:c-api on PR #13235.
alexcrichton updated PR #13235.
alexcrichton updated PR #13235.
alexcrichton updated PR #13235.
:thumbs_up: fitzgen submitted PR review:
LGTM!
fitzgen added PR #13235 Fill out GC type reflection in the C API to the merge queue.
github-merge-queue[bot] removed PR #13235 Fill out GC type reflection in the C API from the merge queue.
alexcrichton updated PR #13235.
alexcrichton has enabled auto merge for PR #13235.
alexcrichton added PR #13235 Fill out GC type reflection in the C API to the merge queue.
github-merge-queue[bot] removed PR #13235 Fill out GC type reflection in the C API from the merge queue.
alexcrichton added PR #13235 Fill out GC type reflection in the C API to the merge queue.
:check: alexcrichton merged PR #13235.
alexcrichton removed PR #13235 Fill out GC type reflection in the C API from the merge queue.
Last updated: May 03 2026 at 22:13 UTC