Skip to content
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 4 #185

Open
sagacity opened this issue Feb 27, 2023 · 0 comments
Open

Add support for Wasmer 4 #185

sagacity opened this issue Feb 27, 2023 · 0 comments
Labels

Comments

@sagacity
Copy link
Contributor

sagacity commented Feb 27, 2023

Intro

We want to support Wasmer 3 in fp-bindgen. However, Wasmer 3 brings with a few changes that make it less than trivial to upgrade to it. This caused our initial upgrade approach to fizzle out, but some lessons were learned.

Clonability

Currently the fp-bindgen Runtime can be Cloned. However, the new Wasmer 3 Store cannot be cloned. This is arguably an improvement, but in order to make sure that our Runtime struct can still be cloned, we have to do some work. If we don't keep Stores around across method calls, but simply create new ones, that should already solve the issue, though. It seems that to create a new Module you need a Store, but this store is not actually used in the Module creation. Therefore, I guess a Module can be reused even across stores.

Mutability

In Wasmer 3 function invocations require a mutable wasmer Store. In Wasmer 2 this was not the case. Method calls on our generated Runtime struct would therefore also need to become mutable. Arguably this is more correct, since method calls are mutating memory and so on. However, it is a change to be aware of and would potentially be breaking to our users. If the Runtime remains cloneable, though, it may be less of a worry. Some extra details here: wasmerio/wasmer#3530

Feature

For compatibility purposes (and the changes listed above) it would be nice if users of fp-bindgen can choose whether to use the existing Wasmer 2 support or move to the new Wasmer 3 support. It would be nice if we can place the Wasmer 3 support behind a new host feature flag.

(note: ticket updated on March 6th after discussion with @kajacx on Discord)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants