You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Host component import function parameters should take borrowed values #5050
Host component import function parameters should take borrowed values.
Presently, the arguments to a host component import function (as provided to wasmtime::component::LinkerInstance::func_wrap) have to implement IntoComponentFunc, whose argument list is required to impl Lift. Lift does not allow borrowed values. So, these import functions are passed String or Vec<u8> when it would be better for them to accept &str or &[u8].
Benefit
Passing in a borrowed value will reduce the number of copies required to output lists. A borrowed value would be able to point to memory in a guest linear memory, whereas an owned value requires a copy out of linear memory.
The implementation of a synchronous fd_write would benefit from this optimization.
I got this wrong. Borrowed values are available in parameters to import funcs via WasmStr and WasmList. Wasmtime has what we need, so I'll file an issue on wit-bindgen to use them.
Activity
pchickey commentedon Oct 13, 2022
I got this wrong. Borrowed values are available in parameters to import funcs via
WasmStrandWasmList. Wasmtime has what we need, so I'll file an issue on wit-bindgen to use them.