Skip to content
Prev Previous commit
Next Next commit
Precompile invoke helper for GuardedFinalize
  • Loading branch information
VSadov committed Aug 15, 2025
commit 4e4503bebceff4e3fd2dc092cf3c14b2e32e0840
2 changes: 1 addition & 1 deletion src/mono/mono/mini/aot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -4977,7 +4977,7 @@ add_full_aot_wrappers (MonoAotCompile *acfg)
add_method (acfg, get_runtime_invoke_sig (csig));

/* runtime-invoke used by finalizers */
add_method (acfg, get_runtime_invoke (acfg, get_method_nofail (mono_defaults.object_class, "GuardedFinalize", 0, 0), FALSE));
add_method (acfg, mono_marshal_get_runtime_invoke_full (get_method_nofail (mono_defaults.object_class, "GuardedFinalize", 0, 0), FALSE, TRUE));

/* This is used by mono_runtime_capture_context () */
method = mono_get_context_capture_method ();
Expand Down
4 changes: 2 additions & 2 deletions src/mono/mono/mini/mini-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -5363,8 +5363,8 @@ mono_precompile_assembly (MonoAssembly *ass, void *user_data)
mono_error_cleanup (error); /* FIXME don't swallow the error */
continue;
}
if (strcmp (method->name, "Finalize") == 0) {
invoke = mono_marshal_get_runtime_invoke (method, FALSE);
if (strcmp (method->name, "GuardedFinalize") == 0) {
invoke = mono_marshal_get_runtime_invoke_full (method, FALSE, TRUE);
mono_compile_method_checked (invoke, error);
mono_error_assert_ok (error);
}
Expand Down