Does the D teams would like to increase the WASM support

Paulo Pinto pjmlp at progtools.org
Fri Nov 18 09:44:19 UTC 2022


On Friday, 18 November 2022 at 02:06:41 UTC, Adam D Ruppe wrote:
> On Thursday, 17 November 2022 at 23:31:27 UTC, H. S. Teoh wrote:
>> Not sure how we'd do the GC part, though.
>
> The stock druntime gc works so long as the wasm stack is empty. 
> llvm offers a shadow stack for this purpose, or I'm pretty sure 
> (and Sebastiaan agrees, we've both been swamped with day job 
> work but we chat every now and then a little) it'd work if we 
> deferred the mark/sweep for when the wasm stack is empty.
>
> In other words, GC.collect would always ask for new memory from 
> the system as if the collection failed, but then queue it - 
> javascript `setTimeout(GC.collect, 0);` would do the job. Then 
> it collects when back to the event loop thus knowing the wasm 
> work is paused and the call stack empty, so all stored values 
> are available from memory.
>
> Just like I said, I'm pretty swamped with work.... and when not 
> doing work I have a million other things to do. I have some use 
> case for webasm - it is kinda cool to put my little demo games 
> online - but it isn't a high priority.

Other approaches would be to look into Java, Flash (yep), Go and 
.NET, all of them already have mature WebAssembly 
implementations, with working GCs.


More information about the Digitalmars-d mailing list