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.
A function can be marked as _Noreturn
. So compiler generates and optimizes the code with that in mind. proc_exit
one on these functions.
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.
Last updated: Dec 23 2024 at 13:07 UTC