From: Zoltan Varga Date: Thu, 29 Jun 2017 22:10:34 +0000 (-0400) Subject: [runtime] Make runtime invoke wrappers for dynamic methods non-shareable, so they... X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=ed6183c2b90c070ee2d2312484d8a6bd3b2c9f93 [runtime] Make runtime invoke wrappers for dynamic methods non-shareable, so they can be freed when the dynamic method is freed. (#5152) --- diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c index f75d24736e4..9403e54a149 100644 --- a/mono/metadata/marshal.c +++ b/mono/metadata/marshal.c @@ -4416,7 +4416,7 @@ mono_marshal_get_runtime_invoke_full (MonoMethod *method, gboolean virtual_, gbo csig->call_convention = MONO_CALL_C; #endif - name = mono_signature_to_name (callsig, virtual_ ? "runtime_invoke_virtual" : "runtime_invoke"); + name = mono_signature_to_name (callsig, virtual_ ? "runtime_invoke_virtual" : (need_direct_wrapper ? "runtime_invoke_direct" : "runtime_invoke")); mb = mono_mb_new (target_klass, name, MONO_WRAPPER_RUNTIME_INVOKE); g_free (name); @@ -4483,6 +4483,9 @@ mono_marshal_get_runtime_invoke (MonoMethod *method, gboolean virtual_) if (virtual_) need_direct_wrapper = TRUE; + if (method->dynamic) + need_direct_wrapper = TRUE; + if (method->klass->rank && (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) && (method->iflags & METHOD_IMPL_ATTRIBUTE_NATIVE)) { /*