[OT] web assembly memory model

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sun Jan 4 03:30:50 UTC 2026


On 04/01/2026 3:30 PM, Walter Bright wrote:
> On 1/3/2026 6:03 PM, Richard (Rikki) Andrew Cattermole wrote:
>> As far as GC is concerned we are on our own and stuck on linear memory 
>> aka sbrk, we cannot use WasmGC with our pointers.
>>
>> Upstream ldc does not have runtime supported and I'm not sure I'd even 
>> suggest the -betterC support as acceptable.
>>
>> Having the target enabled isn't the same thing as being a supported 
>> target.
> 
> 
> I don't see why calls to `new` cannot be redirected to whatever WASM does?

You can't do pointer arithmetic with WasmGC.
No subtraction, no getting pointers to fields, nothing like that.
That is the GC offering currently.

For the linear memory, its a memory mapper only, sbrk.
Oh and you can have multiple linear memories that you have to keep track 
what the offset is actually for when dereferencing.

They are typed entirely differently, you cannot mix them.
It is exactly like near vs far pointers.

Basically you're on your own as a compiler developer.


More information about the Digitalmars-d mailing list