WebAssembly / WASI

WebAssembly System Interface
Other
4.85k stars 251 forks source link

Use memory handles? #476

Closed SoniEx2 closed 2 years ago

SoniEx2 commented 2 years ago

Last time we looked at it, WASI seemed to do a weird thing where it exports functions and imports memory, but the memory must be exported by the module that imports the functions...

Which is extremely confusing, can be impossible in some wasm VM designs, and kinda defeats being capability-based tbh.

There should be some sort of "memory handle" that gets passed to WASI whenever it needs access to a memory object.

Drawback: neither reference types nor multi-memory enable memory handles. So this would need a new wasm proposal.

sunfishcode commented 2 years ago

The details aren't all completed yet, but we're expecting the interface-types proposal to provide facilities for passing data through buffers, in a way that completely avoids the need for memory to be exported and imported.

sunfishcode commented 2 years ago

If you wish to propose a first-class memory-handle type, please do so at the WebAssembly CG level, since that would be a language feature rather than a WASI API.