-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[mono][aot] Fix compilation crashes when type load exception is generated in code #110078
Conversation
Sorry - no idea about the code change... but a question about the regression: |
src/mono/mono/mini/method-to-ir.c
Outdated
@@ -6262,6 +6262,9 @@ method_make_alwaysthrow_typeloadfailure (MonoCompile* cfg, MonoClass* klass) | |||
mono_link_bblock (cfg, bb, cfg->bb_exit); | |||
|
|||
cfg->disable_inline = TRUE; | |||
|
|||
for (int i = 0; i < cfg->header->num_clauses; i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i < cfg->header->num_clauses; i++) | |
for (guint i = 0; i < cfg->header->num_clauses; i++) |
Method compilation was continuing and we ended up failing with invalid IL.
…ption throw In the final stages of method compilation, when trying to compute clause ranges, we were asserting because the clause bblocks haven't been reached for compilation.
4d1c07c
to
11375fe
Compare
/backport to release/9.0 |
Started backporting to release/9.0: https://github.com/dotnet/runtime/actions/runs/12081654970 |
@BrzVlad backporting to release/9.0 failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: [mono][aot] Fix stack state when emitting type load throw
Using index info to reconstruct a base tree...
M src/mono/mono/mini/method-to-ir.c
Falling back to patching base and 3-way merge...
Auto-merging src/mono/mono/mini/method-to-ir.c
CONFLICT (content): Merge conflict in src/mono/mono/mini/method-to-ir.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 [mono][aot] Fix stack state when emitting type load throw
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
@BrzVlad an error occurred while backporting to release/9.0, please check the run log for details! Error: git am failed, most likely due to a merge conflict. |
/backport to release/9.0-staging |
Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/12084366956 |
@BrzVlad backporting to release/9.0-staging failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: [mono][aot] Fix stack state when emitting type load throw
Using index info to reconstruct a base tree...
M src/mono/mono/mini/method-to-ir.c
Falling back to patching base and 3-way merge...
Auto-merging src/mono/mono/mini/method-to-ir.c
CONFLICT (content): Merge conflict in src/mono/mono/mini/method-to-ir.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 [mono][aot] Fix stack state when emitting type load throw
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
@BrzVlad an error occurred while backporting to release/9.0-staging, please check the run log for details! Error: git am failed, most likely due to a merge conflict. |
…ated in code (dotnet#110078) * [mono][aot] Fix stack state when emitting type load throw Method compilation was continuing and we ended up failing with invalid IL. * [mono][aot] Mark clauses as dead when replacing method code with exception throw In the final stages of method compilation, when trying to compute clause ranges, we were asserting because the clause bblocks haven't been reached for compilation.
Following #91261, exception throwing during aot compilation for type load exceptions was replaced with throwing of exception at runtime, as part of the method code. This code insertion could hit some issues in various scenarios. Fixes #110003 and #109966