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

Exporting / importing passive data segments? #1347

Open
nomeata opened this issue May 25, 2020 · 4 comments
Open

Exporting / importing passive data segments? #1347

nomeata opened this issue May 25, 2020 · 4 comments

Comments

@nomeata
Copy link

nomeata commented May 25, 2020

[Please tell me if this is not the right forum to discuss possible extensions like this.]

With this proposals (data) sections no longer “just” initialize memory, but are really things of their own, which can be addressed within the module (by index), and even change (by dropping). This leads me to the question: Should it be maybe possible to export and import (data) sections, just like one can export and import functions, globals, memories (and in the future other things)?

One vauge use case that I could see is modules (possibly even host modules) providing static data (e.g. Unicode tables, machine-learned models) to other modules.

A wrinkle that would have to be solved is what does dropping such an imported data segment mean. Should dropping only affect the “local reference”, e.g. by reference counting (less interaction between modules), or should one module dropping the segment suffice (makes it easier to merge modules).

@lars-t-hansen
Copy link
Contributor

It might be useful to kick this over to the design repository for a more general discussion. @rossberg, do you have the powers to do that?

On the one hand, the alternative to importing and exporting data is to create a "data container" module that exports initialization functions for the exported data on a memory (ie I would import the "initwithUnicodeData(atLocation)" method from that module and share my memory with it).

On the other hand, the data container module would probably have to be instantiated once for each memory that wants the data it provides, and I wouldn't necessarily want to share my memory with it.

@rossberg rossberg transferred this issue from WebAssembly/bulk-memory-operations May 26, 2020
@rossberg
Copy link
Member

@lars-t-hansen, done.

@nomeata
Copy link
Author

nomeata commented May 26, 2020

On the other hand, the data container module would probably have to be instantiated once for each memory that wants the data it provides, and I wouldn't necessarily want to share my memory with it.

Right, that’s my thinking as well: Importing a “passive memory segment” has much stronger guarantees about what can happen than “importing an arbitrary function and giving it access to my memory”

@binji
Copy link
Member

binji commented May 26, 2020

We discussed this briefly here: WebAssembly/bulk-memory-operations#15

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

No branches or pull requests

5 participants