Stream: wasmtime

Topic: Component Reference Handling


view this post on Zulip Michael V. (Jun 26 2023 at 12:02):

Hi,
there is currently no way to handle references in components, right? When returning values from a webassembly guest to a rust host, I always have to copy all values. In the future, one could use resources to do that (https://github.com/bytecodealliance/wasmtime/issues/6583). So right now, if I want to call two separate webassembly functions create_image and process_image from the host, I would have to put the image into a List and basically copy the image from WebAssembly to the host and from the host back to webassembly. With a ressource, I could use a handle to avoid copying the whole image.
Do I understand this correctly?

This is intended to be a bit of a tracking issue and/or brain-dump about implementing resources in the component model. The work here spans a number of repositories and isn't exclusively limited to...

view this post on Zulip Alex Crichton (Jun 26 2023 at 14:41):

I believe that's correct, yes. If you're putting an image into a component and eventually getting back out even with resources that'll be two copies. With resources though that could represent the image living in wasm memory for later operations to have to copy in/out the image between the invocations

view this post on Zulip Michael V. (Jun 28 2023 at 17:01):

thank you!


Last updated: Nov 22 2024 at 16:03 UTC