Static ctors in wasm

Sebastiaan Koppe mail at skoppe.eu
Fri Feb 9 07:21:04 UTC 2024


On Friday, 9 February 2024 at 00:02:12 UTC, H. S. Teoh wrote:
> Is this even possible in wasm?  Or am I missing something 
> obvious?
>
>
> T

Might I direct you to my past efforts of a druntime port? This is 
a good entry point https://github.com/skoppe/ldc/tree/wasm as it 
contains the changes for LDC and submodules for Phobos and 
druntime.

I got everything working, except for things that aren't supported 
like exceptions and fibers.

Its just 3 year behind on master.

The other issue is the GC not seeing all pointers hence freeing 
too much. As mentioned in another thread this can be solved by 
spilling the pointers to the shadow stack, which involves either 
changes to LDC/llvm or doing a post build step. Nowadays there is 
binaryen which reimplemented the required pass. I haven't been 
able to test it but others have used it with a similar Böhm GC.


More information about the Digitalmars-d mailing list