Skip to content

Commit

Permalink
[mono][mini] Disable inlining if we encounter class initialization fa…
Browse files Browse the repository at this point in the history
…ilure (#111754)

method_make_alwaysthrow_typeloadfailure replaces the entire method code with a throw of type load exception. This behaviour not only seem dubious, if it is triggered from inlining a method, that might never even get called, but it also does changes to the set of basic blocks that can lead to crashes later on during compilation.
  • Loading branch information
BrzVlad authored Jan 30, 2025
1 parent 99b373a commit 1e21b13
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mono/mono/mini/method-to-ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -10142,6 +10142,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
EMIT_NEW_PCONST (cfg, *sp, NULL);
sp++;
} else if (il_op == MONO_CEE_LDFLD || il_op == MONO_CEE_LDSFLD) {
// method_make_alwaysthrow_typeloadfailure currently doesn't work with inlining
INLINE_FAILURE("type load error");
// An object is expected here. It may be impossible to correctly infer its type,
// we turn this entire method into a throw.
method_make_alwaysthrow_typeloadfailure (cfg, klass);
Expand Down

0 comments on commit 1e21b13

Please sign in to comment.