-
Notifications
You must be signed in to change notification settings - Fork 246
Description
I've been experimenting with upgrading to the latest wasmtime (i.e. the main branch for now, but I would use the most recent release in a PR). As a consequence of the upgrade, instantiate_smw fails to build due to its use of the module linking API, which has been removed as of wasmtime 0.36.
I'd like to update instantiate_smw to use the component model, although I realize it's not yet fully implemented as of this writing. I don't know whether wasmtime's implementation is complete enough yet for wit-bindgen's needs; one goal of this experiment is to answer that question. Either way, I'm eager to start using the component model in other projects, so it will be helpful to understand the specific limitations of the current (partial) implementation -- particularly with regard to linking modules together. I'd also be interested in helping move that implementation forward if there are opportunities to do so.
My current (possibly naive) strategy is to change instantiate_smw to create a component::Component which instantiates both the spidermonkey and input module, passing the former as an argument to the latter. Then I would instantiate that component using a component::Linker, call wizer.initialize on the spidermonkey module instance, and return as before. This raises a question:
- Given that the
wit_bindgen_wasmtime::export!andwit_bindgen_wasmtime::import!macros (not to mentionwasmtime_wasi::add_to_linker, etc.) expect a moduleLinker, not a componentLinker, it's not clear to me how to use them in a component context. Is there (or will there be) some way to add a moduleLinkerinto a componentLinkerfor the purpose of dynamic instantiation? Or am I thinking about it the wrong way?
(EDIT: I've moved the second question to bytecodealliance/wasmtime#4303 since it was not specific to wit-bindgen)