aWsm icon indicating copy to clipboard operation
aWsm copied to clipboard

Improve "Trap Handling" for out of bounds memory access and other traps

Open bushidocodes opened this issue 3 years ago • 0 comments

According to the WebAssembly specification, abnormal behavior, such as an out-of-bounds memory access, should trigger a "trap."

image Source:

In the web context, this causes a JavaScript exception. However, the WebAssembly specification is being extended to support "in module" trap handlers (https://github.com/WebAssembly/exception-handling/blob/master/proposals/exception-handling/Exceptions.md)

Currently, we are mostly enforcing invariants via assert. We should likely replace this with a centralized entrypoint for trap handling logic called via setjmp and longjmp. I believe this would just log a descriptive and error out for now.

bushidocodes avatar Jul 22 '21 00:07 bushidocodes