|
Revision tags: dev, v36.0.9, v44.0.1, v43.0.2, v36.0.8, v24.0.8, v44.0.0, v43.0.1, v42.0.2, v36.0.7, v24.0.7 |
|
| #
0dbb6f3d |
| 31-Mar-2026 |
Chris Fallin <[email protected]> |
Exceptions: implement C API. (#12861)
* Exceptions: implement C API.
This PR implements C (and C++) API support for Wasm exceptions, one final 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, one final remaining hurdle (aside from fuzz-testing) for making exceptions tier-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 ...
|
|
Revision tags: v43.0.0, v42.0.1, v41.0.4, v42.0.0, v40.0.4, v36.0.6, v24.0.6, v41.0.3, v41.0.2, v41.0.1, v36.0.5, v40.0.3, v41.0.0, v36.0.4, v39.0.2, v40.0.2, v40.0.1, v40.0.0, v39.0.1, v39.0.0, v38.0.4, v37.0.3, v36.0.3, v24.0.5, v38.0.3, v38.0.2 |
|
| #
cde2e04f |
| 21-Oct-2025 |
Alex Crichton <[email protected]> |
Fill out more of the C++ API for components (#11889)
* capi: Add a C++ API for `component::Linker`
Just a bare-bones API for now with functionality that's possible to fill out. Notably instantiatio
Fill out more of the C++ API for components (#11889)
* capi: Add a C++ API for `component::Linker`
Just a bare-bones API for now with functionality that's possible to fill out. Notably instantiation and defining functions is not yet possible in C++. Some more feature-parity is also added with the core linkers as well.
* capi: Add bindings for component instances
* capi: Delete wasip2.h header file
Upon reflection I realize that this is not actually necessary and is otherwise a duplicate of the functionality in `wasi.h`. All of the functionality in `wasi.h` is already supported to power WASIp2-defined APIs in a linker, which is enabled by the `WasiView` trait redirecting to the `WasiView for WasiP1Ctx` implementation. This is similar to how the `wasmtime` CLI works where a P1 context is always created and then it's conditionally used for either core wasm or components.
Effectively this is a deletion of duplicate functionality in the C API but no underlying functionality is lost. Translating information to preexisting WASI calls will work the same as using the wasip2 APIs before.
* capi: Start bindings for component functions
* capi: Bind component values in the C++ API
* capi: Finish bindings for component functions/linkers
All the pieces are now in place to use the C++ API in testing.
* Fix compilation of CLI
* Fix compile on MSVC
* Try again to fix msvc compat
* Fix `get_f32` and `get_f64` return values
* Fix signed return values
* Remove no-longer-needed `capi_transfer` function
* Try to fix msvc again
* Remove std::optional constructor of `Val`
* Fix another namespace clash on msvc
* One day I surely may understand a fraction of either C++ or MSVC, but today is not that day.
* Document internal macro
* Add other internal docs
show more ...
|
|
Revision tags: v38.0.1, v37.0.2, v37.0.1, v37.0.0, v36.0.2, v36.0.1, v36.0.0, v35.0.0, v24.0.4, v33.0.2, v34.0.2, v34.0.1, v33.0.1, v24.0.3, v32.0.1, v34.0.0 |
|
| #
69c01c5d |
| 18-Jun-2025 |
MangoPeachGrape <[email protected]> |
c-api: component-model: Resource table, WASI (#11055)
* c-api: component-model: Resource table, WASI
* WASIP2 context builder
* Add include
* Rename function
* Add a simple test
* Add comments
c-api: component-model: Resource table, WASI (#11055)
* c-api: component-model: Resource table, WASI
* WASIP2 context builder
* Add include
* Rename function
* Add a simple test
* Add comments prtest:full
show more ...
|
|
Revision tags: v33.0.0 |
|
| #
90ac295e |
| 19-May-2025 |
Alex Crichton <[email protected]> |
Update Wasmtime to the 2024 Rust Edition (#10806)
* Update Wasmtime to the 2024 Rust Edition
Now that our MSRV supports the 2024 edition it's possible to make this switch. This commit moves Wasmtim
Update Wasmtime to the 2024 Rust Edition (#10806)
* Update Wasmtime to the 2024 Rust Edition
Now that our MSRV supports the 2024 edition it's possible to make this switch. This commit moves Wasmtime to the 2024 Edition to keep up-to-date with Rust idioms and access many of the edition features exclusive to the 2024 edition.
prtest:full
* Reformat with the 2024 edition
show more ...
|
|
Revision tags: v32.0.0 |
|
| #
6ba6e13b |
| 14-Apr-2025 |
MangoPeachGrape <[email protected]> |
c-api: Compile a component (#10566)
* c-api: Compile a component
Co-authored-by: Tyler Rockwood <[email protected]> Co-authored-by: Jean-Jacques Lafay <[email protected]>
* Add docu
c-api: Compile a component (#10566)
* c-api: Compile a component
Co-authored-by: Tyler Rockwood <[email protected]> Co-authored-by: Jean-Jacques Lafay <[email protected]>
* Add documentation to config
---------
Co-authored-by: Tyler Rockwood <[email protected]> Co-authored-by: Jean-Jacques Lafay <[email protected]>
show more ...
|
| #
073aedab |
| 09-Apr-2025 |
Alex Crichton <[email protected]> |
Enable the `unsafe-op-in-unsafe-fn` lint (#10559)
* Enable the `unsafe-op-in-unsafe-fn` lint
This commit enables the `unsafe-op-in-unsafe-fn` lint in rustc for the entire workspace. This lint will
Enable the `unsafe-op-in-unsafe-fn` lint (#10559)
* Enable the `unsafe-op-in-unsafe-fn` lint
This commit enables the `unsafe-op-in-unsafe-fn` lint in rustc for the entire workspace. This lint will be warn-by-default in the 2024 edition so this is intended to smooth the future migration to the new edition.
Many `unsafe` blocks were added in places the lint warned about, with two major exceptions. The `wasmtime` and `wasmtime-c-api` crates simply expect this lint to fire and effectively disable the lint. They're too big at this time to do through this PR. My hope is that one day in the future they'll be migrated, but more realistically that probably won't happen so these crates just won't benefit from this lint.
* Fix nostd fiber build
prtest:full
* Fix build on Windows
* Fix asan build
show more ...
|
|
Revision tags: v31.0.0, v30.0.2, v30.0.1, v30.0.0, v29.0.1, v29.0.0, v28.0.1, v28.0.0 |
|
| #
45b60bd6 |
| 02-Dec-2024 |
Alex Crichton <[email protected]> |
Start using `#[expect]` instead of `#[allow]` (#9696)
* Start using `#[expect]` instead of `#[allow]`
In Rust 1.81, our new MSRV, a new feature was added to Rust to use `#[expect]` to control lint
Start using `#[expect]` instead of `#[allow]` (#9696)
* Start using `#[expect]` instead of `#[allow]`
In Rust 1.81, our new MSRV, a new feature was added to Rust to use `#[expect]` to control lint levels. This new lint annotation will silence a lint but will itself cause a lint if it doesn't actually silence anything. This is quite useful to ensure that annotations don't get stale over time.
Another feature is the ability to use a `reason` directive on the attribute with a string explaining why the attribute is there. This string is then rendered in compiler messages if a warning or error happens.
This commit migrates applies a few changes across the workspace:
* Some `#[allow]` are changed to `#[expect]` with a `reason`. * Some `#[allow]` have a `reason` added if the lint conditionally fires (mostly related to macros). * Some `#[allow]` are removed since the lint doesn't actually fire. * The workspace configures `clippy::allow_attributes_without_reason = 'warn'` as a "ratchet" to prevent future regressions. * Many crates are annotated to allow `allow_attributes_without_reason` during this transitionary period.
The end-state is that all crates should use `#[expect(..., reason = "...")]` for any lint that unconditionally fires but is expected. The `#[allow(..., reason = "...")]` lint should be used for conditionally firing lints, primarily in macro-related code. The `allow_attributes_without_reason = 'warn'` level is intended to be permanent but the transitionary `#[expect(clippy::allow_attributes_without_reason)]` crate annotations to go away over time.
* Fix adapter build
prtest:full
* Fix one-core build of icache coherence
* Use `allow` for missing_docs
Work around rust-lang/rust#130021 which was fixed in Rust 1.83 and isn't fixed for our MSRV at this time.
* More MSRV compat
show more ...
|
|
Revision tags: v27.0.0, v26.0.1, v25.0.3, v24.0.2, v26.0.0, v21.0.2, v22.0.1, v23.0.3, v25.0.2, v24.0.1, v25.0.1, v25.0.0, v24.0.0, v23.0.2 |
|
| #
a0442ea0 |
| 05-Aug-2024 |
Hamir Mahal <[email protected]> |
Enforce `uninlined_format_args` for the workspace (#9065)
* Enforce `uninlined_format_args` for the workspace
* fix: failing `Monolith Checks` job
* fix: formatting
|
|
Revision tags: v23.0.1, v23.0.0, v22.0.0, v21.0.1, v21.0.0, v20.0.2, v20.0.1, v20.0.0, v17.0.3, v19.0.2, v18.0.4, v19.0.1, v19.0.0, v18.0.3 |
|
| #
55bd797a |
| 08-Mar-2024 |
Milek7 <[email protected]> |
Extend C API with interfaces needed to use threads (#7940)
|
|
Revision tags: v18.0.2, v17.0.2, v18.0.1 |
|
| #
ff93bce0 |
| 20-Feb-2024 |
Nick Fitzgerald <[email protected]> |
Wasmtime: Finish support for the typed function references proposal (#7943)
* Wasmtime: Finish support for the typed function references proposal
While we supported the function references proposal
Wasmtime: Finish support for the typed function references proposal (#7943)
* Wasmtime: Finish support for the typed function references proposal
While we supported the function references proposal inside Wasm, we didn't support it on the "outside" in the Wasmtime embedder APIs. So much of the work here is exposing typed function references, and their type system updates, in the embedder API. These changes include:
* `ValType::FuncRef` and `ValType::ExternRef` are gone, replaced with the introduction of the `RefType` and `HeapType` types and a `ValType::Ref(RefType)` variant.
* `ValType` and `FuncType` no longer implement `Eq` and `PartialEq`. Instead there are `ValType::matches` and `FuncType::matches` methods which check directional subtyping. I also added `ValType::eq` and `FuncType::eq` static methods for the rare case where someone needs to check precise equality, but that is almost never actually the case, 99.99% of the time you want to check subtyping.
* There are also public `Val::matches_ty` predicates for checking if a value is an instance of a type, as well as internal helpers like `Val::ensure_matches_ty` that return a formatted error if the value does not match the given type. These helpers are used throughout Wasmtime internals now.
* There is now a dedicated `wasmtime::Ref` type that represents reference values. Table operations have been updated to take and return `Ref`s rather than `Val`s.
Furthermore, this commit also includes type registry changes to correctly manage lifetimes of types that reference other types. This wasn't previously an issue because the only thing that could reference types that reference other types was a Wasm module that added all the types that could reference each other at the same time and removed them all at the same time. But now that the previously discussed work to expose these things in the embedder API is done, type lifetime management in the registry becomes a little trickier because the embedder might grab a reference to a type that references another type, and then unload the Wasm module that originally defined that type, but then the user should still be able use that type and the other types it transtively references. Before, we were refcounting individual registry entries. Now, we still are refcounting individual entries, but now we are also accounting for type-to-type references and adding a new type to the registry will increment the refcounts of each of the types that it references, and removing a type from the registry will decrement the refcounts of each of the types it references, and then recursively (logically, not literally) remove any types whose refcount has now reached zero.
Additionally, this PR adds support for subtyping to `Func::typed`- and `Func::wrap`-style APIs. For result types, you can always use a supertype of the WebAssembly function's actual declared return type in `Func::typed`. And for param types, you can always use a subtype of the Wasm function's actual declared param type. Doing these things essentially erases information but is always correct. But additionally, for functions which take a reference to a concrete type as a parameter, you can also use the concrete type's supertype. Consider a WebAssembly function that takes a reference to a function with a concrete type: `(ref null <func type index>)`. In this scenario, there is no static `wasmtime::Foo` Rust type that corresponds to that particular Wasm-defined concrete reference type because Wasm modules are loaded dynamically at runtime. You *could* do `f.typed::<Option<NoFunc>, ()>()`, and while that is correctly typed and valid, it is often overly restrictive. The only value you could call the resulting typed function with is the null function reference, but we'd like to call it with non-null function references that happen to be of the correct type. Therefore, `f.typed<Option<Func>, ()>()` is also allowed in this case, even though `Option<Func>` represents `(ref null func)` which is the supertype, not subtype, of `(ref null <func type index>)`. This does imply some minimal dynamic type checks in this case, but it is supported for better ergonomics, to enable passing non-null references into the function.
We can investigate whether it is possible to use generic type parameters and combinators to define Rust types that precisely match concrete reference types in future, follow-up pull requests. But for now, we've made things usable, at least.
Finally, this also takes the first baby step towards adding support for the Wasm GC proposal. Right now the only thing that is supported is `nofunc` references, and this was mainly to make testing function reference subtyping easier. But that does mean that supporting `nofunc` references entailed also adding a `wasmtime::NoFunc` type as well as the `Config::wasm_gc(enabled)` knob. So we officially have an in-progress implementation of Wasm GC in Wasmtime after this PR lands!
Fixes https://github.com/bytecodealliance/wasmtime/issues/6455
* Fix WAT in test to be valid
* Check that dependent features are enabled for function-references and GC
* Remove unnecessary engine parameters from a few methods
Ever since `FuncType`'s internal `RegisteredType` holds onto its own `Engine`, we don't need these anymore.
Still useful to keep the `Engine` parameter around for the `ensure_matches` methods because that can be used to check correct store/engine usage for embedders.
* Add missing dependent feature enabling for some tests
* Remove copy-paste bit from test
* match self to show it is uninhabited
* Add a missing `is_v128` method
* Short circuit a few func type comparisons
* Turn comment into part of doc comment
* Add test for `Global::new` and subtyping
* Add tests for embedder API, tables, and subtyping
* Add an embedder API test for setting globals and subtyping
* Construct realloc's type from its index, rather than from scratch
* Help LLVM better optimize our dynamic type checks in `TypedFunc::call_raw`
* Fix call benchmark compilation
* Change `WasmParams::into_abi` to take the whole func type instead of iter of params
* Fix doc links
prtest:full
* Fix size assertion on s390x
show more ...
|
|
Revision tags: v18.0.0, v17.0.1 |
|
| #
825494fe |
| 05-Feb-2024 |
Max Brunsfeld <[email protected]> |
Add wasmtime-c-api-impl to the list of crates to publish (#7837)
* Add wasmtime-c-api-impl to the list of crates to publish
* Enable rustdoc and publishing for c-api crate
* Provide paths to c-api
Add wasmtime-c-api-impl to the list of crates to publish (#7837)
* Add wasmtime-c-api-impl to the list of crates to publish
* Enable rustdoc and publishing for c-api crate
* Provide paths to c-api headers as cargo links metadata
* Add a README section about using wasm-c-api in a rust crate
* In C API doc comment, mention use case for crates w/ C bindings
* Enable publishing for wasmtime-c-api-macros (prtest:full)
* Move c-api crates later in the publishing sequence (prtest:full)
show more ...
|
| #
d4eaacd6 |
| 05-Feb-2024 |
Milek7 <[email protected]> |
Add C API for GuestProfiler (#7854)
* Add C API for GuestProfiler
* GuestProfiler C API: remove unsafe and add docs
* Fix clang-format complaints
* rename to wasmtime_guestprofiler_t for consiste
Add C API for GuestProfiler (#7854)
* Add C API for GuestProfiler
* GuestProfiler C API: remove unsafe and add docs
* Fix clang-format complaints
* rename to wasmtime_guestprofiler_t for consistency, change to passing tuples by struct type, clarify docs
* rustfmt
* out is marked "own" too
* gate on profiling feature
show more ...
|
|
Revision tags: v17.0.0, v16.0.0, v15.0.1, v15.0.0, v14.0.4, v14.0.3, v14.0.2, v13.0.1, v14.0.1, v14.0.0 |
|
| #
f7004c19 |
| 18-Oct-2023 |
Alex Crichton <[email protected]> |
c-api: Update reexport of wasmtime crate crate (#7112)
* c-api: Remove reexport of wasmtime crate
This is a follow-up to #6765 to remove this reexport since it was originally added to use both the
c-api: Update reexport of wasmtime crate crate (#7112)
* c-api: Remove reexport of wasmtime crate
This is a follow-up to #6765 to remove this reexport since it was originally added to use both the C API and the `wasmtime` crate in the same downstream crate, but this should be possible through Cargo with:
[dependencies] wasmtime = "13" wasmtime-c-api = { version = "13", package = "wasmtime-c-api" }
and that way `wasmtime::*` is available as well as `wasmtime_c_api::*`
* Add `pub use wasmtime;`
show more ...
|
| #
37cf8e1e |
| 03-Oct-2023 |
Tyler Rockwood <[email protected]> |
Async support in the C API (#7106)
* c-api: Add a feature for async
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Add support for async config
Signed-off-by: Tyler Rockwood <rock
Async support in the C API (#7106)
* c-api: Add a feature for async
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Add support for async config
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Add support for calling async functions
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Add ability to yield execution of Wasm in a store
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Introduce wasmtime_linker_instantiate_async
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Support defining async host functions
Signed-off-by: Tyler Rockwood <[email protected]>
* gitignore: ignore cmake cache for examples
Signed-off-by: Tyler Rockwood <[email protected]>
* examples: Add example of async API in C
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Consolidate async functionality into a single place
Put all the async stuff in it's own header and own rust source file
Also remove the wasmtime_async_continuation_new function, users can just allocate it directly.
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Make async function safe
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Remove wasmtime_call_future_get_results
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Simplify CHostCallFuture
Move the result translation and hostcall_val_storage usage into an async function
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Simplify C continuation implementation
Remove the caller, which means that we don't need another struct for the future implementation.
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Improve async.h documentation
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Cleanup from previous changes
Signed-off-by: Tyler Rockwood <[email protected]>
* examples: Fix example
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Simplify continuation callback
This gives more duality with calling an async function and also means that the implementation can pretty much mirror the sync version.
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Fix async.h documentation
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Fix documentation for async.h
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: Review feedback
Signed-off-by: Tyler Rockwood <[email protected]>
* examples: Downgrade async.cpp example to C++11
Signed-off-by: Tyler Rockwood <[email protected]>
* c-api: initialize continuation with a panic callback
Signed-off-by: Tyler Rockwood <[email protected]>
* prtest:full
Signed-off-by: Tyler Rockwood <[email protected]>
---------
Signed-off-by: Tyler Rockwood <[email protected]>
show more ...
|
| #
90e4daff |
| 29-Sep-2023 |
Silas Groh <[email protected]> |
Make C API usable from Rust (#6765)
|
|
Revision tags: minimum-viable-wasi-proxy-serve, v13.0.0, v12.0.2, v11.0.2, v10.0.2, v12.0.1, v12.0.0, v11.0.1, v11.0.0, v10.0.1, v10.0.0, v9.0.4, v9.0.3, v9.0.2, v9.0.1, v9.0.0, v6.0.2, v7.0.1, v8.0.1, v8.0.0, v7.0.0, v6.0.1, v5.0.1, v4.0.1, v6.0.0, v5.0.0, v4.0.0, v3.0.1, v3.0.0, v1.0.2, v2.0.2, v2.0.1, v2.0.0, v1.0.1, v1.0.0, v0.40.1, v0.40.0, v0.39.1, v0.38.3, v0.38.2, v0.39.0, v0.38.1, v0.38.0, v0.37.0, v0.36.0, v0.35.3, v0.34.2, v0.35.2, v0.35.1, v0.35.0, v0.33.1, v0.34.1, v0.34.0, v0.33.0, v0.32.1, v0.32.0, v0.31.0, v0.30.0, v0.29.0, v0.28.0 |
|
| #
7a1b7cdf |
| 03-Jun-2021 |
Alex Crichton <[email protected]> |
Implement RFC 11: Redesigning Wasmtime's APIs (#2897)
Implement Wasmtime's new API as designed by RFC 11. This is quite a large commit which has had lots of discussion externally, so for more inform
Implement RFC 11: Redesigning Wasmtime's APIs (#2897)
Implement Wasmtime's new API as designed by RFC 11. This is quite a large commit which has had lots of discussion externally, so for more information it's best to read the RFC thread and the PR thread.
show more ...
|
|
Revision tags: v0.26.1, v0.27.0, v0.26.0, v0.25.0, v0.24.0, v0.23.0, v0.22.1, cranelift-v0.69.0, v0.22.0, v0.21.0, v0.20.0, v0.19.0 |
|
| #
41e13002 |
| 16-Jul-2020 |
Alex Crichton <[email protected]> |
Allow `improper_ctypes_definitions` in C API
This was enabled in rust-lang/rust#72700 but it looks like it's still too noisy for it to be useful to us.
|
| #
d07fdca7 |
| 10-Jul-2020 |
Nick Fitzgerald <[email protected]> |
wasmtime-c-api: Use a safe helper for initializing `MaybeUninit` out pointers
|
| #
377b213f |
| 10-Jul-2020 |
Nick Fitzgerald <[email protected]> |
wasmtime-c-api: Remove unused `HostInfoState` struct
|
| #
cca558cd |
| 26-Jun-2020 |
Alex Crichton <[email protected]> |
Remove `HostRef<T>` from the C API (#1926)
This commit removes `HostRef<T>` from the C API which only served the
purpose now of converting each type to a `wasm_ref_t*`. Our
implementation, however
Remove `HostRef<T>` from the C API (#1926)
This commit removes `HostRef<T>` from the C API which only served the
purpose now of converting each type to a `wasm_ref_t*`. Our
implementation, however, does not guarantee that you'll get the same
`wasm_ref_t*` for each actual underlying item (e.g. if you put a func in
a table and then get the func as an export and from the table then
`same` will report `false`). Additionally the fate of `wasm_ref_t*`
seems somewhat unclear at this point.
The change here is to make the `same` and cast functions all abort
saying they're unimplemented. (similar to the host info functions). If
and when we get around to reimplementing these functions we can ensure
they're implemented uniformly and work well for all intended use cases.
show more ...
|
|
Revision tags: v0.18.0, v0.17.0 |
|
| #
58b08b9d |
| 01-Jun-2020 |
Nick Fitzgerald <[email protected]> |
Move `HostRef<T>` into the C API crate
It isn't used by anything except for the C API and all of our embedder-exposed APIs are already internally `Rc`-based, so it doesn't make sense to use with the
Move `HostRef<T>` into the C API crate
It isn't used by anything except for the C API and all of our embedder-exposed APIs are already internally `Rc`-based, so it doesn't make sense to use with them.
show more ...
|
|
Revision tags: v0.16.0 |
|
| #
bd374fd6 |
| 06-Apr-2020 |
Alex Crichton <[email protected]> |
Add Wasmtime-specific C API functions to return errors (#1467)
* Add Wasmtime-specific C API functions to return errors
This commit adds new `wasmtime_*` symbols to the C API, many of which
mirr
Add Wasmtime-specific C API functions to return errors (#1467)
* Add Wasmtime-specific C API functions to return errors
This commit adds new `wasmtime_*` symbols to the C API, many of which
mirror the existing counterparts in the `wasm.h` header. These APIs are
enhanced in a number of respects:
* Detailed error information is now available through a
`wasmtime_error_t`. Currently this only exposes one function which is
to extract a string version of the error.
* There is a distinction now between traps and errors during
instantiation and function calling. Traps only happen if wasm traps,
and errors can happen for things like runtime type errors when
interacting with the API.
* APIs have improved safety with respect to embedders where the lengths
of arrays are now taken as explicit parameters rather than assumed
from other parameters.
* Handle trap updates
* Update C examples
* Fix memory.c compile on MSVC
* Update test assertions
* Refactor C slightly
* Bare-bones .NET update
* Remove bogus nul handling
show more ...
|
|
Revision tags: v0.15.0, cranelift-v0.62.0 |
|
| #
4ede98fe |
| 27-Mar-2020 |
Alex Crichton <[email protected]> |
Make WASI and `wat` support optional in the C API (#1419)
Add some crate features to compile out support for these features of the
C API. Avoiding these two features if they're not necessary shaves
Make WASI and `wat` support optional in the C API (#1419)
Add some crate features to compile out support for these features of the
C API. Avoiding these two features if they're not necessary shaves about
2MB off the final shared object in some local tests!
show more ...
|
| #
6ef09359 |
| 27-Mar-2020 |
Alex Crichton <[email protected]> |
Refactor and fill out wasmtime's C API (#1415)
* Refactor and improve safety of C API
This commit is intended to be a relatively large refactoring of the C
API which is targeted at improving the
Refactor and fill out wasmtime's C API (#1415)
* Refactor and improve safety of C API
This commit is intended to be a relatively large refactoring of the C
API which is targeted at improving the safety of our C API definitions.
Not all of the APIs have been updated yet but this is intended to be the
start.
The goal here is to make as many functions safe as we can, expressing
inputs/outputs as native Rust types rather than raw pointers wherever
possible. For example instead of `*const wasm_foo_t` we'd take
`&wasm_foo_t`. Instead of returning `*mut wasm_foo_t` we'd return
`Box<wasm_foo_t>`. No ABI/API changes are intended from this commit,
it's supposed to only change how we define all these functions
internally.
This commit also additionally implements a few more API bindings for
exposed vector types by unifying everything into one macro.
Finally, this commit moves many internal caches in the C API to the
`OnceCell` type which provides a safe interface for one-time
initialization.
* Split apart monolithic C API `lib.rs`
This commit splits the monolithic `src/lib.rs` in the C API crate into
lots of smaller files. The goal here is to make this a bit more readable
and digestable. Each module now contains only API bindings for a
particular type, roughly organized around the grouping in the wasm.h
header file already.
A few more extensions were added, such as filling out `*_as_*`
conversions with both const and non-const versions. Additionally many
APIs were made safer in the same style as the previous commit, generally
preferring Rust types rather than raw pointer types.
Overall no functional change is intended here, it should be mostly just
code movement and minor refactorings!
* Make a few wasi C bindings safer
Use safe Rust types where we can and touch up a few APIs here and there.
* Implement `wasm_*type_as_externtype*` APIs
This commit restructures `wasm_externtype_t` to be similar to
`wasm_extern_t` so type conversion between the `*_extern_*` variants to
the concrete variants are all simple casts. (checked in the case of
general to concrete, of course).
* Consistently imlpement host info functions in the API
This commit adds a small macro crate which is then used to consistently
define the various host-info-related functions in the C API. The goal
here is to try to mirror what the `wasm.h` header provides to provide a
full implementation of the header.
show more ...
|
|
Revision tags: cranelift-v0.61.0 |
|
| #
fb0762bb |
| 26-Mar-2020 |
Peter Huene <[email protected]> |
Add wasmtime_func_new_with_env.
This commit adds the `wasmtime_func_new_with_env` C API function and refactors the implementation to share the implementation between the C API and Wasmtime extension
Add wasmtime_func_new_with_env.
This commit adds the `wasmtime_func_new_with_env` C API function and refactors the implementation to share the implementation between the C API and Wasmtime extension variants.
show more ...
|