summaryrefslogtreecommitdiff
path: root/scripts/fuzz_opt.py
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-09-05 20:19:04 -0700
committerGitHub <noreply@github.com>2019-09-05 20:19:04 -0700
commit7b4f97823cf46532ac65b980a957f67a681e3002 (patch)
tree5a175105d2bef64200e6edfc337a0d0e024e4c95 /scripts/fuzz_opt.py
parenta0c77bf09dc561f9857bd44167fb04d571e3036a (diff)
downloadbinaryen-7b4f97823cf46532ac65b980a957f67a681e3002.tar.gz
binaryen-7b4f97823cf46532ac65b980a957f67a681e3002.tar.bz2
binaryen-7b4f97823cf46532ac65b980a957f67a681e3002.zip
SafeHeap: Prepare for emscripten_get_sbrk_ptr (#2331)
Currently emscripten links the wasm, then links the JS, then computes the final static allocations and in particular the location of the sbrk ptr (i.e. the location in memory of the brk location). Emscripten then imports that into the asm.js or wasm as env.DYNAMICTOP_PTR. However, this didn't work in the wasm backend where we didn't have support for importing globals from JS, so we implement sbrk in JS. I am proposing that we change this model to allow us to write sbrk in C and compile it to wasm. To do so, that C code can import an extern C function, emscripten_get_sbrk_ptr(), which basically just returns that location. The PostEmscripten pass can even apply that value at compile time, so we avoid the function call, and end up in the optimal place, see #2325 and emscripten PRs will be opened once other stuff lands. However, the SafeHeap pass must be updated to handle this, or our CI will break in the middle. This PR fixes that, basically making it check if env.DYNAMICTOP_PTR exists, or if not then looking for env.emscripten_get_sbrk_ptr, so that it can handle both.
Diffstat (limited to 'scripts/fuzz_opt.py')
0 files changed, 0 insertions, 0 deletions