Skip to content
This repository was archived by the owner on Apr 16, 2025. It is now read-only.

Conversation

@alexcrichton
Copy link
Member

This commit binds two new APIs added to wasmtime's C API recently:

  • wasmtime_func_new_unchecked
  • wamstime_func_call_unchecked

These two functions are a more accelerated path of invoking a
WebAssembly function and having a WebAssembly function call the host.
The new APIs are generally unsafe but with the C++ bindings added here
they should at least be type-safe. The goal was to add APIs similar to
the Rust crate's Func::wrap and Func::typed for statically-typed
function calls.

Overall the performance here worked out great in that it's on-par with C
and as expected from the PR adding the *_unchecked variants. This is,
however, basically my first foray into templated functions in C++ and
wow is this a lot more complicated than I thought that it would be. Some
extra eyes on this would be appreciated to see if I've missed something
or if the design could be simplified.

This commit binds two new APIs added to `wasmtime`'s C API recently:

* `wasmtime_func_new_unchecked`
* `wamstime_func_call_unchecked`

These two functions are a more accelerated path of invoking a
WebAssembly function and having a WebAssembly function call the host.
The new APIs are generally unsafe but with the C++ bindings added here
they should at least be type-safe. The goal was to add APIs similar to
the Rust crate's `Func::wrap` and `Func::typed` for statically-typed
function calls.

Overall the performance here worked out great in that it's on-par with C
and as expected from the PR adding the `*_unchecked` variants. This is,
however, basically my first foray into templated functions in C++ and
wow is this a lot more complicated than I thought that it would be. Some
extra eyes on this would be appreciated to see if I've missed something
or if the design could be simplified.
@alexcrichton alexcrichton merged commit c3bb729 into bytecodealliance:main Sep 27, 2021
@alexcrichton alexcrichton deleted the fastcall branch September 27, 2021 13:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant