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

Transitioning from module linking to the component model #4303

Closed
dicej opened this issue Jun 23, 2022 · 4 comments
Closed

Transitioning from module linking to the component model #4303

dicej opened this issue Jun 23, 2022 · 4 comments

Comments

@dicej
Copy link
Contributor

dicej commented Jun 23, 2022

Per bytecodealliance/wit-bindgen#259, I'm interested in upgrading the wasmtime dependency in wit-bindgen, and that has raised a more general question, which I'd like to ask here:

What's the vision for code which previously used module linking and will eventually need to transition to the component model? Will there be a simple recipe to follow, or will big (e.g. architectural) changes be necessary?

Whatever that vision is, I'd be interested to help implement it if there are opportunities to do so without distracting from the work already in progress.

@dicej
Copy link
Contributor Author

dicej commented Jun 23, 2022

I hijacked today's wasmtime project meeting to discuss this and had a very enlightening conversation with @alexcrichton and @fitzgen about it. Here are my takeaways:

  • Users of module linking should stick with pre-0.36 wasmtime for the time being. Although it's technically possible to migrate to the component model already (i.e. wasmtime has enough of the building blocks to make module linking work), the rest of the ecosystem has not caught up and can't catch up until more foundation work is done, and trying to use it in this state would not be worth the trouble.
  • There are a few specific opportunities to help with that foundation work now, and once that's done the ecosystem work will be very parallelizeable; i.e. many more opportunities will arise. I've volunteered to help with this, and Alex and Nick are going to open issues to track a couple of the foundation work items.
  • The long-term vision for linking modules will be component-oriented, e.g. wasmtime_wasi::add_to_linker would take a component::Linker.

@alexcrichton perhaps you could clarify the last point, since I'm not sure I understood it. Would there be two variants of add_to_linker, one for modules and one for components? Or would both Linker types implement a trait so that add_to_linker could be generic? Or would component::Linker simply replace the module Linker and subsume the latter's functionality such that instantiating a module is the same as instantiating a trivial component containing a single module?

@alexcrichton
Copy link
Member

Sure yeah, my current thinking is that wit-bindgen will only generate one add_to_linker function which will only work with components, not with core wasm modules. Much of the component model only makes sense in the context of the component model itself (e.g. async, resources, streams, etc) so I don't think it will be possible to have a full-featured generated for "just" core wasm. This means that in the long run support for running raw core wasm files will likely be dropped from wit-bindgen since it'll work primarily at the ocmponent layer.

@alexcrichton
Copy link
Member

Also, for concrete work items, I'm trying to keep the main tracking issue up-to-date and the "Separate work items" category should all be issues that are standalone (ish) and possible to implement in parallel. (although I still wouldn't classify any of them as "easy")

dicej added a commit to dicej/wit-bindgen that referenced this issue Jun 24, 2022
This updates to `wasmtime` v0.38.0.  Because module linking support has been
removed from `wasmtime` as of v0.36.0, and the component model implementation is
not yet mature enough to use as a replacement (see
bytecodealliance/wasmtime#4303 for details), it is
necessary to temporarily disable the Spidermonkey tests.  I've done this by
commenting-out the broken code in `instantiate_smw`, prefixed its name with and
underscore, and renamed the relevant host.rs files to ignore_host.rs to hide
them from the test infrastructure.  Once the component model implementation is
mature enough and the broader ecosystem has been updated to use it, we can
update and restore these tests.

Signed-off-by: Joel Dice <[email protected]>
dicej added a commit to dicej/wit-bindgen that referenced this issue Jun 24, 2022
This updates to `wasmtime` v0.38.0.  Because module linking support has been
removed from `wasmtime` as of v0.36.0, and the component model implementation is
not yet mature enough to use as a replacement (see
bytecodealliance/wasmtime#4303 for details), it is
necessary to temporarily disable the Spidermonkey tests.  I've done this by
commenting-out the broken code in `instantiate_smw`, prefixed its name with and
underscore, and renamed the relevant host.rs files to ignore_host.rs to hide
them from the test infrastructure.

Once the component model implementation is mature enough and the broader
ecosystem has been updated to use it, we can update and restore the Spidermonkey
tests.

fixes bytecodealliance#259

Signed-off-by: Joel Dice <[email protected]>
@dicej
Copy link
Contributor Author

dicej commented Jun 24, 2022

I think the original questions here have been addressed, so I'm going to close this. Thanks for your help, Alex!

@dicej dicej closed this as completed Jun 24, 2022
alexcrichton pushed a commit to bytecodealliance/wit-bindgen that referenced this issue Jun 27, 2022
This updates to `wasmtime` v0.38.0.  Because module linking support has been
removed from `wasmtime` as of v0.36.0, and the component model implementation is
not yet mature enough to use as a replacement (see
bytecodealliance/wasmtime#4303 for details), it is
necessary to temporarily disable the Spidermonkey tests.  I've done this by
commenting-out the broken code in `instantiate_smw`, prefixed its name with and
underscore, and renamed the relevant host.rs files to ignore_host.rs to hide
them from the test infrastructure.

Once the component model implementation is mature enough and the broader
ecosystem has been updated to use it, we can update and restore the Spidermonkey
tests.

fixes #259

Signed-off-by: Joel Dice <[email protected]>
rvolosatovs pushed a commit to bytecodealliance/wrpc that referenced this issue May 23, 2024
This updates to `wasmtime` v0.38.0.  Because module linking support has been
removed from `wasmtime` as of v0.36.0, and the component model implementation is
not yet mature enough to use as a replacement (see
bytecodealliance/wasmtime#4303 for details), it is
necessary to temporarily disable the Spidermonkey tests.  I've done this by
commenting-out the broken code in `instantiate_smw`, prefixed its name with and
underscore, and renamed the relevant host.rs files to ignore_host.rs to hide
them from the test infrastructure.

Once the component model implementation is mature enough and the broader
ecosystem has been updated to use it, we can update and restore the Spidermonkey
tests.

fixes bytecodealliance/wit-bindgen#259

Signed-off-by: Joel Dice <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants