Add -s SAFE_STACK to detect stack overflow#9141
Add -s SAFE_STACK to detect stack overflow#9141quantum5 merged 7 commits intoemscripten-core:incomingfrom
Conversation
|
Why have a separate setting |
| }, | ||
| // ======================================================================= | ||
|
|
||
| __handle_stack_overflow: function() { |
There was a problem hiding this comment.
__handle_stack_overflow -> __abort_stack_overflow?
There was a problem hiding this comment.
I don't know if __abort_stack_overflow is really a good name for the handler function. Binaryen gives the runtime flexibility to do whatever in face of stack overflow. Hypothetically, a runtime could implement a mechanism similar to sigaltstack(2) to handle stack overflows.
There was a problem hiding this comment.
Hmm, now that I look closer at this - does the wasm backend directly generate a call to this function? If so, then the name is very generic. How about __wasm_stack_overflow? Having compiler backend construct a function call with such a name that does not connect to an established API would make the symbol look somewhat floating.
There was a problem hiding this comment.
The WASM backend does not generate a call to this. wasm-emscripten-finalize in binaryen inserts a call to this function when passed a certain flag. So the __wasm prefix is inappropriate.
It doesn't do the same thing. |
| // Log out all SAFE_HEAP operations | ||
| var SAFE_HEAP_LOG = 0; | ||
|
|
||
| // Check each stack pointer decrement on WASM backend to ensure that the stack |
There was a problem hiding this comment.
nit (not worth a PR): wasm isn't an acronym, so just "wasm" is fine.
Depends on WebAssembly/binaryen#2278 (tests will not pass without it).
Also added a test mode
wasm2ssto run the whole test suite under-s SAFE_STACK. It seems to work.Fixes #9039.