@@ -327,25 +327,6 @@ mono_gc_run_finalize (void *obj, void *data)
327
327
return ;
328
328
}
329
329
330
- /*
331
- * To avoid the locking plus the other overhead of mono_runtime_invoke_checked (),
332
- * create and precompile a wrapper which calls the finalize method using
333
- * a CALLVIRT.
334
- */
335
- if (log_finalizers )
336
- g_log ("mono-gc-finalizers" , G_LOG_LEVEL_MESSAGE , "<%s at %p> Compiling finalizer." , o -> vtable -> klass -> name , o );
337
-
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
-
349
330
mono_runtime_class_init_full (o -> vtable , & error );
350
331
goto_if_nok (& error , unhandled_error );
351
332
@@ -354,22 +335,20 @@ mono_gc_run_finalize (void *obj, void *data)
354
335
o -> vtable -> klass -> name_space , o -> vtable -> klass -> name );
355
336
}
356
337
357
- if (log_finalizers )
358
- g_log ("mono-gc-finalizers" , G_LOG_LEVEL_MESSAGE , "<%s at %p> Calling finalizer." , o -> vtable -> klass -> name , o );
338
+ if (finalizer ) {
339
+ if (log_finalizers )
340
+ g_log ("mono-gc-finalizers" , G_LOG_LEVEL_MESSAGE , "<%s at %p> Calling finalizer." , o -> vtable -> klass -> name , o );
359
341
360
- MONO_PROFILER_RAISE (gc_finalizing_object , (o ));
342
+ MONO_PROFILER_RAISE (gc_finalizing_object , (o ));
361
343
362
- #ifdef HOST_WASM
363
- gpointer params [] = { NULL };
364
- mono_runtime_try_invoke (finalizer , o , params , & exc , & error );
365
- #else
366
- runtime_invoke (o , NULL , & exc , NULL );
367
- #endif
344
+ gpointer params [] = { NULL };
345
+ mono_runtime_try_invoke (finalizer , o , params , & exc , & error );
368
346
369
- MONO_PROFILER_RAISE (gc_finalized_object , (o ));
347
+ MONO_PROFILER_RAISE (gc_finalized_object , (o ));
370
348
371
- if (log_finalizers )
372
- g_log ("mono-gc-finalizers" , G_LOG_LEVEL_MESSAGE , "<%s at %p> Returned from finalizer." , o -> vtable -> klass -> name , o );
349
+ if (log_finalizers )
350
+ g_log ("mono-gc-finalizers" , G_LOG_LEVEL_MESSAGE , "<%s at %p> Returned from finalizer." , o -> vtable -> klass -> name , o );
351
+ }
373
352
374
353
unhandled_error :
375
354
if (!is_ok (& error ))
0 commit comments