Comments (8)
Yes, spec/interpreter/test-side all boxes have been checked 4 years ago, just waiting for implementations to catch up. :) Happy to see progress on this!
from multi-memory.
Awesome! I went ahead and added an agenda item to vote Multi-Memory to Phase 4 at the in-person CG meeting, WebAssembly/meetings#1361
from multi-memory.
Should this proposal have a JS API that exposes multiple memories, or has some way that additional memory can be accessed from outside of Wasm? A straightforward extension could be to extend the memoryDescriptor
to take an index an optional memory index parameter to the and existing WebAssembly.Memory JS API functions.
The reason for proposing this is that without support in the compilation pipeline in the tools (someone should correct me if the Binaryen implementation is sufficient for use from a source language), or API functions in the Spec, the use of multiple memories is limited to within Wasm. While I'm not sure if there are applications that could benefit from this, adding an easily accessible API potentially encourages experimentation with the proposal, and/or usage in the future for applications.
from multi-memory.
#27 raised the limit on the number of memories in the JS API from 1 to 100. I'm not sure anything more needs to be done to the JS API specifically, since IIUC the core spec rules allow any memory to be exported or imported; so I think it wouldn't be the memoryDescriptor
that describes which index a memory is in, but the module's imports (and the corresponding objects that satisfy them at instantiation time).
from multi-memory.
What @dschuff said, the JS API shouldn't need anything to support this, as nothing in it depends on the fact that only a single memory can currently occur in import or export lists of a module. (Memory indices are not relevant or meaningful outside a module.)
from multi-memory.
Thanks both! Talked this through with @dschuff, and I was working backwards from how do you distinguish which buffer belongs to which memory with multiple memory imports/exports. Leaving a little bit of detail here if it helps anyone else. For imports, the memory object is created outside of Wasm, and the index itself isn't meaningful, but can be queried from the memory object itself. Similarly named exports on instantiation should be sufficient to distinguish which between multiple exported memories.
from multi-memory.
For imports, the memory object is created outside of Wasm, and the index itself isn't meaningful, but can be queried from the memory object itself.
Hm, did you mean "and cannot be queried from the memory object itself"? Runtime objects like memory instances do not carry indices in any form, they are merely "bound" to indices (possibly multiple ones) inside a given module. Indices are like local variable names.
from multi-memory.
For imports, the memory object is created outside of Wasm, and the index itself isn't meaningful, but can be queried from the memory object itself.
Hm, did you mean "and cannot be queried from the memory object itself"? Runtime objects like memory instances do not carry indices in any form, they are merely "bound" to indices (possibly multiple ones) inside a given module. Indices are like local variable names.
Sorry I phrased the sentence wrong, the index isn't meaningful, and the buffer can be queried from the memory object (not index as implied).
from multi-memory.
Related Issues (20)
- Possibility to dynamically add memories at runtime? HOT 2
- Overlap with recent issue raised on the main WASM design repo HOT 5
- Contradiction in multi-memory binary format instruction rules HOT 3
- A question about high level language interaction HOT 7
- Referencing locations across memories HOT 10
- Text format: parsing `v128.loadX_lane` and `v128.storeX_lane` requires backtracking HOT 6
- Multi-Memory Lowering & Memory Imports HOT 1
- Use-case for multi-memory: Flutter Web Engine linking with wasm-compiled skia (C++) and ICU4X (Rust) HOT 5
- Use-case for multi-memory: dart2wasm to implement ByteBuffer/TypedList objects with linear memory HOT 8
- Use-case for multi-memory: Component Model object transfer browser polyfill HOT 2
- Additional test cases for multi-memory HOT 3
- Use-case for multi-memory: Less overhead tracking of store calls to facilitate networked rollback HOT 1
- Use case for multi-memory: Sharing persistent datastructures between threads
- Toolchain support for multiple memories HOT 22
- Implementation support HOT 4
- JS-API limits test still tests for limit of 1 memory
- Is there a way to access a non-hardcoded memory? HOT 2
- A Bug in multi memory test? HOT 2
- Spec for instantiation of active data segments is incorrect HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from multi-memory.