Stream: wasm

Topic: How does proc_exit affect control flow?


view this post on Zulip Vedant Roy (Sep 24 2020 at 03:18):

I notice that emscripten puts an unreachable statement after a call to proc_exit. I'm guessing proc_exit is supposed to terminate execution of the current WASM program.

My question is: Am I correct about this? Is this even possible? I wasn't aware that imported WASM functions could affect control flow like this.

view this post on Zulip Yury Delendik (Sep 24 2020 at 12:59):

A function can be marked as _Noreturn. So compiler generates and optimizes the code with that in mind. proc_exit one on these functions.

view this post on Zulip Dan Gohman (Sep 24 2020 at 15:36):

Yeah, proc_exit is a somewhat special case right now. In the future when wasm gets stack unwinding, I expect we'll define proc_exit in terms of that -- that's effectively what Wasmtime's implementation of proc_exit already does.

Proposal to add exception handling to WebAssembly. Contribute to WebAssembly/exception-handling development by creating an account on GitHub.

Last updated: Nov 22 2024 at 17:03 UTC