[runtime] Make runtime invoke wrappers for dynamic methods non-shareable, so they...
authorZoltan Varga <vargaz@gmail.com>
Thu, 29 Jun 2017 22:10:34 +0000 (18:10 -0400)
committerGitHub <noreply@github.com>
Thu, 29 Jun 2017 22:10:34 +0000 (18:10 -0400)
mono/metadata/marshal.c

index f75d24736e4a6e0e817da04ee803f7de69e4ca31..9403e54a149ad81b16ba8f945bacddbed73718a9 100644 (file)
@@ -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)) {
                /*