mimalloc icon indicating copy to clipboard operation
mimalloc copied to clipboard

Preliminary fixes and improvements to the wasm backend

Open TerrorJack opened this issue 2 years ago • 1 comments

The wasm backend seems to have bitrotted a bit, I couldn't get it to compile in the latest dev-slice branch, so I did some preliminary fixes and improvements. Summary of changes:

  • Making the wasm prim.c compile again by adding missing includes and moving a few helper functions around.
  • Use the __wasm__ macro uniformly across the codebase. This is better than __wasi__ since the linear memory characteristics really are not wasi-specific, and this macro works out of the box for both emscripten and wasi-sdk.
  • Remove redundant __builtin_wasm_memory_grow logic in the wasm backend. We always use sbrk for wasm at the moment, which works fine as long as the argument is a multiple of wasm page size.
  • Use getentropy to fix the random buffer source for the wasm backend. getentropy is present in the sysroots of both emscripten and wasi-sdk.

TerrorJack avatar Aug 28 '23 10:08 TerrorJack

@microsoft-github-policy-service agree

TerrorJack avatar Aug 28 '23 10:08 TerrorJack