3 ms·
I don't think the thread proposal will change anything here. Like the existing memory instructions, the atomic instructions proposed for threads (https://githu
by panic 8y ago
I don't think the thread proposal will change anything here. Like the existing memory instructions, the atomic instructions proposed for threads (https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md https://github.com/WebAssembly/threads/blob/master/proposals...) don't take a linear memory parameter. That means they operate on the same default linear memory.
- danShumway 8y agoYou are very right, dug into it a bit more and none of the memory functions (new atomic ones included) have parameters to specify a memidex. Thanks for looking into that, it's good to know. > In the current version of WebAssembly, at most one memory may be defined or imported in a single module, and all constructs implicitly reference this memory 0. This restriction may be lifted in future versions. But I don't get the impression that it's completely unplanned. Modules still take a vector of linear memories, not just one[0], which would be pointless if it wasn't planned to let you access the others at some point. Data segments also explicitly allow referencing a memidx[1] (even if right now 0 is the only one that's allowed). Still, I've been under the impression that this was going in as part of threads, and I was all excited since threads were making such good progress. I'm a little disappointed to find out it's not. It's also possible globals[2] might solve some of the same problems? But I haven't dug into them enough to know what their memory model looks like or how well they work across multiple modules, and in any case, sharing multiple globals is probably going to be less convenient than just sharing memory, so I'd still like to see the ability to import multiple chunks of memory. [0]: https://webassembly.github.io/threads/syntax/modules.html# https://webassembly.github.io/threads/syntax/modules.html# [1]: https://webassembly.github.io/threads/syntax/modules.html#syntax-mem https://webassembly.github.io/threads/syntax/modules.html#sy... [2]: https://developer.mozilla.org/en-US/docs/WebAssembly/Using_the_JavaScript_API#Globals https://developer.mozilla.org/en-US/docs/WebAssembly/Using_t...