-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Wasmer in Witty #945
Conversation
Prepare to add support for Wasmer in an optional manner.
Implement the `Runtime` trait for it.
A type to make it easier to handle a Wasmer guest instance while it is being initialized.
Share the actual `wasmer::Instance` type with reentrant calls.
A type to help with the construction of an `EntrypointInstance`.
Add a trait to help with the implementation of `InstanceWithFunction` for Wasmer instance types.
Add a trait to help with the implementation of `InstanceWithFunction` for Wasmer instance types.
Allow calling imported functions using Wasmer.
Allow loading and storing `WitType`s in the memory of Wasmer guest instances.
26b236b
to
9e0f76a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
impl_instance_with_function!(@generate(ReentrantInstance<'_>) $( $names: $types ),*); | ||
}; | ||
|
||
(@generate($instance:ty) $( $names:ident : $types:ident ),*) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Seems like you just need another macro instead of using @generate(..)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
/// | ||
/// The maximum number of parameters is defined by the [canonical | ||
/// ABI](https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md#flattening) | ||
/// as the `MAX_FLAT_PARAMS` constant. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value 16 is hardcoded in this library in various places, right? Maybe explain this in the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I tried to improve the related documentation and mentioned the MAX_FLAT_*
constants so it's easier to grep
for them.
Allow the type that exported host functions receive to be able to call imported guest functions reentrantly.
Some simple Wasm modules that will be used during some integration tests.
Reuse the integration tests for `wit_import` using a Wasmer instance.
Build the test modules and run the integration tests with the `wasmer` feature enabled.
Include the name of the constant from the specification, to improve searchability and describe how it's handled in Witty.
Motivation
The new Witty crate should generate host code that's compatible with the Wasmer runtime.
Proposal
Create a feature gated
wasmer
module inlinera_witty::runtime
, with implementations for the Witty traits. There are twoInstance
implementations, one for newly created instances (EntrypointInstance
) and one for instances made available inside host functions called by the guest module (ReentrantInstance
).Test Plan
Reuse the integration tests for
wit_import
.Links
Part of #906
Release Plan
Reviewer Checklist