Status of WASM support?
mail at skoppe.eu
Sat Aug 1 11:19:46 UTC 2020
On Saturday, 1 August 2020 at 08:42:49 UTC, Alexandru Ermicioi
> On Friday, 31 July 2020 at 21:18:25 UTC, Sebastiaan Koppe wrote:
>> I did experiment with a GC last year but I abandoned that in
>> favor of porting druntime to wasm. The problems I ran into
>> were mostly because 'new' isn't templated, so no amount of
>> work I did would allow people to simply 'new' things, and
>> instead they would always be stuck with custom allocators.
>> Which is fine for some, but it is really barebones.
> I've been wondering, is it possible to make gc take an
> allocator for memory allocation, instead of manually querying
> OS for that?
Yep, that is what I am doing in the wasm port of druntime.
Instead of querying memory from the OS it calls the appropriate
wasm functions to increase memory (which function a lot like
The GC uses memory mapping to fetch and return memory. Wasm
doesn't support it so I wrote a simple freelist on top of the
wasm memory functions
that I could connect it to the GC (I can't use stdx allocator in
> If it is possible, then it would make possible to use new in
> wasm, by just passing wasm allocator to it.
There is another problem with using 'new'. It isn't available in
betterC, which means you need most of druntime first, before you
can use it.
More information about the Digitalmars-d