-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support try-catch in Asyncify / lower wasm exceptions to MVP #5343
Comments
Sorry, still misunderstand this. What is old js exceptions? asmjs exceptions? wasm+asyncify didn't support any exceptions even simplest one? like
I just trying to understand, is dosbox-x exceptions handling not working because of bug, or because try/catch is not implemented (this task). |
There are two modes, see https://emscripten.org/docs/porting/exceptions.html Basically the old mode is |
Hi @tlively. I have motivation to implement this. I hope I don't bother you with some questions. From bird's-eye the lower wasm exceptions to MVP seems doable. My first idea is to replace the try blocks with just a block with br statement. When a br occurs, I store the exception data somewhere in memory and then process the blocks associated with the catches until exception is consumed. Something like this:
I excuse that it very raw, but I don't want to implement something not working :) Anyway,
|
This sounds like a good direction. I do think that having to check for exceptions after every call would bloat the binary, but it may not be avoidable. Maybe you could do an analysis to find calls that cannot possibly throw exceptions to skip instrumenting them. For try-delegate, I expect you will have to put in more branch instructions to transfer control to the correct handler block. Doing a |
Is there any update on Asyncify and -fwasm-exceptions working together? |
Well, if an exception never occurs in the asyncify code path (meaning no exceptions in the call stack of emscripten_sleep), then you can use the code from the my PR #5475 . It works well; I've used it with DOSBox-X. Additionally, I have prebuilt binaries of wasm-opt available. You can find them here. |
Thanks very much @caiiiycuk, I wish I could. |
See discussion in #5143 - lowering wasm exceptions to wasm MVP might be the best approach for this.
The text was updated successfully, but these errors were encountered: