Proposal for porting D runtime to WebAssembly

thedeemon dlang at thedeemon.com
Mon Nov 25 18:44:01 UTC 2019


On Saturday, 23 November 2019 at 09:51:13 UTC, Sebastiaan Koppe 
wrote:
> This is my proposal for porting D runtime to WebAssembly. I 
> would like to ask you to review it. You can find it here: 
> https://gist.github.com/skoppe/7617ceba6afd67b2e20c6be4f922725d

On the GC part. It says "The only unknown part is how to dump the 
registers to the stack to ensure no pointers are held in the 
registers only."

Please correct me where I'm wrong, but on the level of 
WebAssembly there are no registers, there is an operand stack 
outside the address space, there are local variables to the 
current function, again outside the accessible address space of 
program's linear memory, and there is the linear memory itself. 
So scanning the stack becomes a really hard (should I say 
impossible?) part. What some compilers do is they organize 
another stack manually in the linear memory and store the values 
that would otherwise be on the normal stack, there. Which means 
in case of D you'll have to seriously change the codegen, to 
change how local variables are stored, and to use a kind of 
shadow stack for temporaries in expressions that may be pointers. 
Do you really have a plan about it?


More information about the Digitalmars-d-announce mailing list