Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Henry <ludovic.henry@xamarin.com>2015-04-14 12:33:30 +0300
committerLudovic Henry <ludovic.henry@xamarin.com>2015-05-05 19:36:53 +0300
commit611a43ee0f672adbac3e25dc77731843a3d10cf1 (patch)
tree7ea025724bdc7c7db56d80ba81b1937be8b59b64 /mcs/class/corlib/System/Delegate.cs
parent690aa51537a1134434f94c6390a31e42199182d8 (diff)
[delegate] Replace multicast delegate implementation
Replace the reversed linked implementation by an array based implementation. This will improve Combine performance, as well as ease delegate to virtual function optimization.
Diffstat (limited to 'mcs/class/corlib/System/Delegate.cs')
-rw-r--r--mcs/class/corlib/System/Delegate.cs16
1 files changed, 10 insertions, 6 deletions
diff --git a/mcs/class/corlib/System/Delegate.cs b/mcs/class/corlib/System/Delegate.cs
index bd2835cae43..c2f92a7f73b 100644
--- a/mcs/class/corlib/System/Delegate.cs
+++ b/mcs/class/corlib/System/Delegate.cs
@@ -123,9 +123,6 @@ namespace System
[MethodImplAttribute (MethodImplOptions.InternalCall)]
internal static extern Delegate CreateDelegate_internal (Type type, object target, MethodInfo info, bool throwOnBindFailure);
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- internal extern void SetMulticastInvoke ();
-
private static bool arg_type_match (Type delArgType, Type argType) {
bool match = delArgType == argType;
@@ -186,11 +183,12 @@ namespace System
MethodInfo invoke = type.GetMethod ("Invoke");
- if (!return_type_match (invoke.ReturnType, method.ReturnType))
+ if (!return_type_match (invoke.ReturnType, method.ReturnType)) {
if (throwOnBindFailure)
throw new ArgumentException ("method return type is incompatible");
else
return null;
+ }
ParameterInfo[] delargs = invoke.GetParametersInternal ();
ParameterInfo[] args = method.GetParametersInternal ();
@@ -224,11 +222,12 @@ namespace System
argLengthMatch = args.Length == delargs.Length + 1;
}
}
- if (!argLengthMatch)
+ if (!argLengthMatch) {
if (throwOnBindFailure)
throw new ArgumentException ("method argument length mismatch");
else
return null;
+ }
bool argsMatch;
DelegateData delegate_data = new DelegateData ();
@@ -274,11 +273,12 @@ namespace System
}
}
- if (!argsMatch)
+ if (!argsMatch) {
if (throwOnBindFailure)
throw new ArgumentException ("method arguments are incompatible");
else
return null;
+ }
Delegate d = CreateDelegate_internal (type, target, method, throwOnBindFailure);
if (d != null)
@@ -614,5 +614,9 @@ namespace System
{
return CreateDelegate_internal (type, firstArgument, method, true);
}
+
+ /* Internal call largely inspired from MS Delegate.InternalAllocLike */
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static MulticastDelegate AllocDelegateLike_internal (Delegate d);
}
}