c-api: Tidy up some wasmtime_func_t usage#8461
Merged
alexcrichton merged 2 commits intoApr 24, 2024
Merged
Conversation
Try to avoid using a `transmute` in the implementation of the C API and instead use a `union` like is being done in bytecodealliance#8451. Additionally add some helper functions to the header to work with null funcref values instead of only documenting the implementation.
fitzgen
approved these changes
Apr 24, 2024
kpreisser
added a commit
to kpreisser/wasmtime-dotnet
that referenced
this pull request
Jun 24, 2024
This includes updates for: - bytecodealliance/wasmtime#8451 - bytecodealliance/wasmtime#8461 - bytecodealliance/wasmtime#8011 TODOs: - Allocating an `externref` can now fail (by `wasmtime_externref_new` returning `false`). Currently, we throw a `WasmtimeException` in that case. We need to check where that exception can be thrown, and whether we need to do any additional clean-up (e.g. when converting arguments for a function call). - Check whether it's ok to compare the `__private` field of externs (which has been remaned in the C API, previously it was `index`). - `anyref` type is not yet supported, but I'm not sure what exactly it is and whether we need to add it. Fixes bytecodealliance#315
Merged
2 tasks
jsturtevant
pushed a commit
to bytecodealliance/wasmtime-dotnet
that referenced
this pull request
Jun 28, 2024
* Update to recent Wasmtime C API changes regarding values. This includes updates for: - bytecodealliance/wasmtime#8451 - bytecodealliance/wasmtime#8461 - bytecodealliance/wasmtime#8011 TODOs: - Allocating an `externref` can now fail (by `wasmtime_externref_new` returning `false`). Currently, we throw a `WasmtimeException` in that case. We need to check where that exception can be thrown, and whether we need to do any additional clean-up (e.g. when converting arguments for a function call). - Check whether it's ok to compare the `__private` field of externs (which has been remaned in the C API, previously it was `index`). - `anyref` type is not yet supported, but I'm not sure what exactly it is and whether we need to add it. Fixes #315 * Follow-Up: Make fields private. * Ensure to clean-up `Value` instances (in arguments for a function call, and in results for an untyped callback) when e.g. allocating an `externref` fails. We don't need to do such a clean-up for unchecked function calls that use `ValueRaw` because in that case we don't own `externref` values. * Avoid accessing the `__private` fields in tests by checking the whole struct for equality (which is the case when all members are equal). * Use separate dictionaries for caching `Function`, `Memory`, and `Global` objects in the `Store`, which avoids having to explicitly accessing the `__private` field (because the whole struct is now compared). Additionally, it is more type-safe (since we don't need to cast the `object`).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Try to avoid using a
transmutein the implementation of the C API and instead use aunionlike is being done in #8451. Additionally add some helper functions to the header to work with null funcref values instead of only documenting the implementation.