-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[mono][wasm] AOT more methods containing EH clauses #111318
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
Conversation
WASM aot supports the `deopt` mode for a method, in which case the method will be aot compiled but the exception handlers are later invoked via the interpreter, if an exception is thrown. This is an alternative to fully interpreting the method in question. A problem can arise if an exception is caught inside a finally handler, because the start of the finally handler will be executed with AOT and then, once the exception is caught, the rest of the handler would be executed with the interprer. This is because the implementation of ENDFINALLY in the interpreter requires some information to have been initialized when the handler is called, initialization which is missing since the handler was called by AOT. The original code referenced this issue, but the condition to detect this situation was very relaxed, including common cases like `try { try {} catch {} } finally { }`. This commit changes the check so it is only hit for scenarios like `try { } finally { try { } catch { } }`.
dcc14e8
to
86b4996
Compare
Do we also need to change the scope of IL trimming (of method body) to reap size benefits ? |
@pavelsavara I'd tend to think, given @BrzVlad's explanation of EH that because the runtime's need for IL for running EH blocks, this particular AOT condition change won't impact IL stripping. |
* chore: Apply patch from dotnet/runtime#111318 * ci: Update artifacts steps * chore: Adjust patch * chore: Adjust ubuntu * chore: Adjust runners * chore: adjust net install * chore: Adjust net installer * chore: remove container
FYI, we're using this change in production and it's doing great so far. |
That's useful data. We'll take it in 10 and look at servicing |
I forgot to mention, it was backported to net8. |
WASM aot supports the
deopt
mode for a method, in which case the method will be aot compiled but the exception handlers are later invoked via the interpreter, if an exception is thrown. This is an alternative to fully interpreting the method in question. A problem can arise if an exception is caught inside a finally handler, because the start of the finally handler will be executed with AOT and then, once the exception is caught, the rest of the handler would be executed with the interprer. This is because the implementation of ENDFINALLY in the interpreter requires some information to have been initialized when the handler is called, initialization which is missing since the handler was called by AOT.The original code referenced this issue, but the condition to detect this situation was very relaxed, including common cases like
try { try {} catch {} } finally { }
. This commit changes the check so it is only hit for scenarios liketry { } finally { try { } catch { } }
.fixes: #111281