WebAssembly + Custom Runtime + Associative Arrays

kinke noone at nowhere.com
Wed Nov 11 01:06:34 UTC 2020


On Tuesday, 10 November 2020 at 18:24:03 UTC, Remi wrote:
> Anyway, where am I going wrong? Thanks.

[I've just glanced at the code, not run and debugged anything.] I 
don't see where you actually grow the heap (wasm_growMemory() 
never used AFAICT), certainly not in your malloc(), which 
initializes `nextFree` with &__heap_base and then bumps that 
pointer for the next allocation (likely breaking some alignment 
btw - rounding up to the next multiple of 8 or 16 should be safe).

Note that you shouldn't have to get the size of and grow the 
linear memory in JS, there are LLVM intrinsics you can use (just 
copy the declarations): 
https://github.com/ldc-developers/druntime/blob/412467a452e2d12f561a2eace933dd44014af3c6/src/ldc/intrinsics.di#L678-L697


More information about the digitalmars-d-ldc mailing list