Skip to content

Commit 4768280

Browse files
Use mono_runtime_invoke to invoke finalizers. This way managed runtime can do whatever is necessary to transition to executing managed code, like marking JIT memory executable on macOS ARM64.
1 parent 018fee6 commit 4768280

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

mono/metadata/gc.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -335,17 +335,6 @@ mono_gc_run_finalize (void *obj, void *data)
335335
if (log_finalizers)
336336
g_log ("mono-gc-finalizers", G_LOG_LEVEL_MESSAGE, "<%s at %p> Compiling finalizer.", o->vtable->klass->name, o);
337337

338-
#ifndef HOST_WASM
339-
if (!domain->finalize_runtime_invoke) {
340-
MonoMethod *invoke = mono_marshal_get_runtime_invoke (mono_class_get_method_from_name_flags (mono_defaults.object_class, "Finalize", 0, 0), TRUE);
341-
342-
domain->finalize_runtime_invoke = mono_compile_method_checked (invoke, &error);
343-
mono_error_assert_ok (&error); /* expect this not to fail */
344-
}
345-
346-
RuntimeInvokeFunction runtime_invoke = (RuntimeInvokeFunction)domain->finalize_runtime_invoke;
347-
#endif
348-
349338
mono_runtime_class_init_full (o->vtable, &error);
350339
goto_if_nok (&error, unhandled_error);
351340

@@ -359,12 +348,8 @@ mono_gc_run_finalize (void *obj, void *data)
359348

360349
MONO_PROFILER_RAISE (gc_finalizing_object, (o));
361350

362-
#ifdef HOST_WASM
363351
gpointer params[] = { NULL };
364352
mono_runtime_try_invoke (finalizer, o, params, &exc, &error);
365-
#else
366-
runtime_invoke (o, NULL, &exc, NULL);
367-
#endif
368353

369354
MONO_PROFILER_RAISE (gc_finalized_object, (o));
370355

0 commit comments

Comments
 (0)