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.
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:prim.c
compile again by adding missing includes and moving a few helper functions around.__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.__builtin_wasm_memory_grow
logic in the wasm backend. We always usesbrk
for wasm at the moment, which works fine as long as the argument is a multiple of wasm page size.getentropy
to fix the random buffer source for the wasm backend.getentropy
is present in the sysroots of both emscripten and wasi-sdk.