4 ms·
Shouldn't it be possible to implement your own GC in WASM? Why does WASM try to be everything?
by amelius 2y ago
Shouldn't it be possible to implement your own GC in WASM? Why does WASM try to be everything?
- davexunit 2y agoSlower, single threaded, greatly increases binary size, separate heap from JS so bad interop with extern refs. Wasm GC is a great thing.
- dzaima 2y agoYou can't GC together with the host environment if you do a custom GC (i.e. a wasm object and a JS object in a cycle wouldn't have any way to ever be GC'd).
- bhelx 2y agoyes, it's regularly done. But I think you are misunderstanding. WASM GC isn't a GC implementation.
- fulafel 2y agoYes, this is how it's done eg with Python and Go. An advantage of a common GC could be interop between languages.
- James_K 2y agoNot really. As I understand it, WASM offers no facility to unwind the stack which is needed for tracing garbage collectors. The only solution here is to manually write your own implementation of the stack on the heap and force all data to live there instead of in registers. This is a huge performance penalty.