1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-09 17:44:48 +09:00

[release/9.0-staging] [mono][aot] Fix compilation crashes when type load exception is generated in code (#110271)

* [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.
This commit is contained in:
Vlad Brezae 2025-01-13 13:39:52 +02:00 committed by GitHub
parent 5e05023226
commit 9ee881abb0
Signed by: github
GPG key ID: B5690EEEBB952194

View file

@ -6263,6 +6263,9 @@ method_make_alwaysthrow_typeloadfailure (MonoCompile* cfg, MonoClass* klass)
mono_link_bblock (cfg, bb, cfg->bb_exit);
cfg->disable_inline = TRUE;
for (guint i = 0; i < cfg->header->num_clauses; i++)
cfg->clause_is_dead [i] = TRUE;
}
typedef union _MonoOpcodeParameter {
@ -12112,13 +12115,12 @@ mono_ldptr:
break;
case MONO_CEE_INITOBJ:
klass = mini_get_class (method, token, generic_context);
--sp;
if (CLASS_HAS_FAILURE (klass)) {
HANDLE_TYPELOAD_ERROR (cfg, klass);
inline_costs += 10;
break; // reached only in AOT
}
--sp;
if (mini_class_is_reference (klass))
MONO_EMIT_NEW_STORE_MEMBASE_IMM (cfg, OP_STORE_MEMBASE_IMM, sp [0]->dreg, 0, 0);