WebAssembly / shared-everything-threads

A draft proposal for spawning threads in WebAssembly
Other
34 stars 1 forks source link

Shared-to-non-shared edges #45

Open manoskouk opened 7 months ago

manoskouk commented 7 months ago

It seems that with the current design, some shared-to-non-shared edges are unavoidable: at the very least functions are closed wrt. their instance, which is always non-shared. Do we need to support such edges or are we planning to allow shared instances?

tlively commented 7 months ago

One idea would be to internally split instance objects into separate shared and non-shared parts. Non-shared functions would close over the non-shared part, which would have a reference to the shared part so that the non-shared functions could still access shared functions, globals, etc. Shared functions, OTOH, would close over only the shared part, which would not have a reference back to the non-shared part. This is fine because shared functions are not allowed to access non-shared module elements anyway.