Skip to content

Commit 1e21b13

Browse files
authored
[mono][mini] Disable inlining if we encounter class initialization failure (#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.
1 parent 99b373a commit 1e21b13

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/mono/mono/mini/method-to-ir.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10142,6 +10142,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
1014210142
EMIT_NEW_PCONST (cfg, *sp, NULL);
1014310143
sp++;
1014410144
} else if (il_op == MONO_CEE_LDFLD || il_op == MONO_CEE_LDSFLD) {
10145+
// method_make_alwaysthrow_typeloadfailure currently doesn't work with inlining
10146+
INLINE_FAILURE("type load error");
1014510147
// An object is expected here. It may be impossible to correctly infer its type,
1014610148
// we turn this entire method into a throw.
1014710149
method_make_alwaysthrow_typeloadfailure (cfg, klass);

0 commit comments

Comments
 (0)