Add Emscripten memory helpers for using the C-API (from Wasm) (#2476)
Add Emscripten memory helpers for using the C-API (from Wasm) (#2476)

We already have exports for _malloc and _free in the Emscripten build, but there
is no way yet to initialize the data without resorting to JS. Hence this PR
adds a few additional memory helpers to the Emscripten build so it becomes
possible to manipulate Binaryen memory without the need for extra glue code, for
example when Binaryen is a WebAssembly import, and one is allocating strings to
be used by / reading strings returned by Binaryen.

I expect this to be a bit controversial because the use case is relatively
specific, but it makes sense for us because we are consuming the C-API directly
(from JS and eventually Wasm) and don't rely on binaryen.js-post.js.
WebAssembly/binaryen,WebAssembly/binaryen,WebAssembly/binaryen,WebAssembly/binaryen,WebAssembly/binaryen