Exceptions: implement C API. (#12861)* Exceptions: implement C API.This PR implements C (and C++) API support for Wasm exceptions, onefinal remaining hurdle (aside from fuzz-testing) for making
Exceptions: implement C API. (#12861)* Exceptions: implement C API.This PR implements C (and C++) API support for Wasm exceptions, onefinal remaining hurdle (aside from fuzz-testing) for making exceptionstier-1 and on-by-default.* Review feedback, and add exnref case to `wasmtime_val_t`.* Review feedback: GC feature guard.* clang-format* add docs to exn.hh.* Remove tag size asserts: broken on 32-bit platforms, but not needed for correctness wrt C struct.
show more ...
Merge wasm_tag type into wasm_functype / clean up C API tag headers (#12803)* Merge wasm_tag type into wasm_functype / clean up C API tag headers- Move tag type info into wasm.h alongside other c
Merge wasm_tag type into wasm_functype / clean up C API tag headers (#12803)* Merge wasm_tag type into wasm_functype / clean up C API tag headers- Move tag type info into wasm.h alongside other core types instead of a separate wasmtime/tag.h header- Remove wasmtime/tag.h (contents merged into wasm.h / wasm.hh)- Update extern.hh and tag.hh to reflect new layout- Add tag param accessors in func.rs- Refactor tag.rs to match updated C API surface- Update tag_type.cc tests accordinglyCo-Authored-By: Claude Sonnet 4.6 <[email protected]>* doc-wasm.h: add wasm_tagtype_t documentation and fix wasm_name typoAdd Doxygen documentation for the `wasm_tagtype_t` type and itsassociated functions (`wasm_tagtype_new`, `wasm_tagtype_functype`,vec helpers, and externtype conversion functions). Also document`WASM_EXTERN_TAG` and the `wasm_tagtype_as_externtype*` /`wasm_externtype_as_tagtype*` conversion functions.Fix pre-existing typo: `wasm_name_new_new_uninitialized` ->`wasm_name_new_uninitialized`.Co-Authored-By: Claude Sonnet 4.6 <[email protected]>---------Co-authored-by: Claude Sonnet 4.6 <[email protected]>
c-api: implement wasm_tagtype_t for exception tag types (#10252) (#12763)* c-api: implement wasm_tagtype_t for exception tag types (#10252)Implement the C embedder API for WebAssembly exception t
c-api: implement wasm_tagtype_t for exception tag types (#10252) (#12763)* c-api: implement wasm_tagtype_t for exception tag types (#10252)Implement the C embedder API for WebAssembly exception tags, resolvingthe long-standing todo!() in CExternType::new() that caused a Rust panicwhenever a module with tag exports had its exports enumerated via theC API (e.g. wasm_module_exports / wasmtime_module_exports).Changes:- Add wasm_tagtype_t type with wasm_tagtype_new/params/delete/copy and the standard as_externtype / externtype_as_tagtype cast functions- Add WASM_EXTERN_TAG = 4 constant to wasm_externkind_enum in wasm.h- Add CExternType::Tag(CTagType) variant; wire into CExternType::new() and wasm_externtype_kind()- Add wasmtime/types/tag.hh C++ wrapper (TagType / TagType::Ref)- Extend ExternType::Ref variant and ref_from_c() switch in extern.hh- Add TagType tests: construction, module export enumeration (regression for #10252), and wasm_externtype_kind / cast function correctnessCo-Authored-By: Claude Sonnet 4.6 <[email protected]>* c-api: move tag type declarations to wasmtime/tag.h- Revert wasm.h to its vendored upstream state (it must not be modified locally; tag support is not yet in the upstream wasm-c-api spec header)- Add crates/c-api/include/wasmtime/tag.h with wasm_tagtype_t forward declaration, WASM_EXTERN_TAG constant, and all wasm_tagtype_* / wasm_externtype_as_tagtype* function declarations- Include wasmtime/tag.h from wasmtime.hCo-Authored-By: Claude Sonnet 4.6 <[email protected]>* Apply rustfmt and clang-format to tag type implementationCo-Authored-By: Claude Sonnet 4.6 <[email protected]>* Fix Clippy warnings: remove unused imports and dead codeDrop unused `wasm_tagtype_t` import from extern.rs, and remove the`force`/`ty`/`wasm_tagtype_t::new` dead-code paths from tag.rs thatwere written for future engine-resolution support but are not yet called.Co-Authored-By: Claude Sonnet 4.6 <[email protected]>* Redesign tag type API with wasmtime_* prefix per reviewer feedback- Rename wasm_tagtype_t → wasmtime_tagtype_t and all wasm_tagtype_* functions → wasmtime_tagtype_* to avoid clashing with future wasm.h additions (as requested by alexcrichton)- Constructor now takes wasm_engine_t* + wasm_valkind_t array + count instead of wasm_valtype_vec_t, eliminating the lazy-init complexity- Replace wasm_tagtype_params() (returning a vec) with wasmtime_tagtype_param_count() + wasmtime_tagtype_param(nth), matching the component type accessor iterator pattern- Rename WASM_EXTERN_TAG → WASMTIME_EXTERN_TAG- Simplify CTagType: stores TagType directly, no Arc<Mutex<LazyTagType>>- Update C++ TagType wrapper: constructor takes Engine&, Ref exposes param_count() / param(nth) instead of params() returning ListRef- Add ValType::c_to_kind() static helper used by TagType::Ref::param()- Fix null-pointer panic for zero-length param arrays in RustCo-Authored-By: Claude Sonnet 4.6 <[email protected]>---------Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Fill out type information for components in C API (#11937)* Fill out type information for components in C APII've concluded that I'll want this for wasmtime-py so this fills outtype reflection
Fill out type information for components in C API (#11937)* Fill out type information for components in C APII've concluded that I'll want this for wasmtime-py so this fills outtype reflection for various items in the C API. This then additionallyextends the C++ API as well.prtest:full* Update crates/c-api/include/wasmtime/component/types/func.hCo-authored-by: Joel Dice <[email protected]>---------Co-authored-by: Joel Dice <[email protected]>
Expose custom page sizes in the C and C++ APIs (#11890)* Expose custom page sizes in the C and C++ APIs* Also expose `Config` knob for custom-page-sizes to C and C++ APIs* Avoid null-check in `
Expose custom page sizes in the C and C++ APIs (#11890)* Expose custom page sizes in the C and C++ APIs* Also expose `Config` knob for custom-page-sizes to C and C++ APIs* Avoid null-check in `MemoryType`'s deleter* Check `clangformat.sh` in CI
Run `clang-format` over more files (#10689)We were already running it over most `*.c` files and other ones butforgot the `*.hh` and `*.cc` extensions which are being used for C++bindings, so add
Run `clang-format` over more files (#10689)We were already running it over most `*.c` files and other ones butforgot the `*.hh` and `*.cc` extensions which are being used for C++bindings, so add those in and then run the formatter.
Split out some more C++ types to their own headers (#10658)* Move C++ WASI configuration to its own header* Move C++ `Store` to its own fileI tried binding `wasmtime_store_epoch_deadline_callba
Split out some more C++ types to their own headers (#10658)* Move C++ WASI configuration to its own header* Move C++ `Store` to its own fileI tried binding `wasmtime_store_epoch_deadline_callback` in C++ but Idon't know enough C++ to figure out the syntax for doing so.* Move C++ Val to its own headerAlso bind `AnyRef` while I'm here with some small tests.
Move various C++ type-related items to their own header (#10627)* Move C++ `ValType` to its own headerAnd fill out some small tests* Move C++ `GlobalType` to its own header* Move C++ `TableTy
Move various C++ type-related items to their own header (#10627)* Move C++ `ValType` to its own headerAnd fill out some small tests* Move C++ `GlobalType` to its own header* Move C++ `TableType` to its own fileWith some small tests* Move C++ `FuncType` to its own file* Move C++ ImportType to its own file* Move C++ `ExportType` to its own file* Move C++ `ExternType` to its own file
Move C++ `MemoryType` to its own header (#10623)While here fill out its API a bit with a builder type and some tests.