[PATCH] D42030: [WebAssembly] Define __heap_base global

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 15:31:39 PST 2018


sbc100 added a comment.

Oh, I didn't see that musl's malloc had that threshold.     So all allocations over MMAP_THRESHOLD will always waste `n % PAGE_SIZE` bytes, so the higher the page size for more wastage.

For emscripten they choose to use dlmalloc instead.   I guess we'll have to see what kind of real world overheads and users we see.   If musl's malloc does prove very wasteful when PAGE_SIZE is large there are two of options (use your own malloc, fix musl's malloc) which I think I would prefer over hacking the PAGE_SIZE.  As you say its fairly hypothetical at this point.

In terms of modifications to musl, I have also been trying to absolutely minimize them.  The port we use essentially only adds `arch/wasm32` too.  I think it would probably be good to merge our efforts here.  Emscripten already has a musl port, and if we can avoid making two more that would be great.  One feature of your port and the emscripten port that I think has some advantages is the fact that each syscall ends up as a unique wasm import (in emscripten they did this so they could GC the unused JS syscall functions).


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D42030





More information about the llvm-commits mailing list