Skip to content

Commit 120e0b6

Browse files
[mono][mini] Disable inlining if we encounter class initialization failure (#112005)
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. Co-authored-by: Vlad Brezae <brezaevlad@gmail.com>
1 parent 61d986c commit 120e0b6

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
@@ -10143,6 +10143,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
1014310143
EMIT_NEW_PCONST (cfg, *sp, NULL);
1014410144
sp++;
1014510145
} else if (il_op == MONO_CEE_LDFLD || il_op == MONO_CEE_LDSFLD) {
10146+
// method_make_alwaysthrow_typeloadfailure currently doesn't work with inlining
10147+
INLINE_FAILURE("type load error");
1014610148
// An object is expected here. It may be impossible to correctly infer its type,
1014710149
// we turn this entire method into a throw.
1014810150
method_make_alwaysthrow_typeloadfailure (cfg, klass);

0 commit comments

Comments
 (0)