3 ms·
The thought is less about WASM having a GC and more about WASM being able to leverage the runtime's GC. The assumption is that WASM will run in something like
by cogman10 5y ago
The thought is less about WASM having a GC and more about WASM being able to leverage the runtime's GC.
The assumption is that WASM will run in something like a v8 where the it already has a GC for Javascript. So, rather than distributing a WASM executable with all the code needed to implement a GC, you'd have it rely on the inbuilt GC. As it stands, WASM is really only a good target for C/C++/Rust. Any other language with a more substantial runtime will end up blowing the byte budget.
The question about "Should WASM do this" is really all about what WASM should/could be. Is WASM going to be a universal language target? Should it support more than low level languages?
And yes, WASM exposes malloc and free.
- brabel 5y ago> And yes, WASM exposes malloc and free. No it doesn't. Unless you're referring to WASI, but WASI is not WASM, it's just a common API which modules can call when running on WASI-compliant WASM runtimes. All WASM itself has is linear memory, and that is not exposed via malloc/free, but via lower level instructions to set bytes on a page and grow when necessary (but not "free"). See the available instructions in the spec[1]. [1] https://www.w3.org/TR/wasm-core-1/#memory-instructions%E2%91%A0 https://www.w3.org/TR/wasm-core-1/#memory-instructions%E2%91...