Imported Upstream version 4.2.1.60

Former-commit-id: 05052d1d7a3a94b0d9ee70461d62b6591e5ab5bc
This commit is contained in:
Xamarin Public Jenkins
2015-10-06 08:40:39 -04:00
committed by Jo Shields
parent ea5caba957
commit bdd40f83c0
55 changed files with 488 additions and 317 deletions

View File

@ -60,6 +60,7 @@ namespace System
private object m_target;
private IntPtr method;
private IntPtr delegate_trampoline;
private IntPtr rgctx;
private IntPtr method_code;
private MethodInfo method_info;
@ -68,6 +69,8 @@ namespace System
private MethodInfo original_method_info;
private DelegateData data;
private bool method_is_virtual;
#pragma warning restore 169, 414, 649
#endregion
@ -103,13 +106,19 @@ namespace System
return method_info;
} else {
if (method != IntPtr.Zero) {
method_info = (MethodInfo)MethodBase.GetMethodFromHandleNoGenericCheck (new RuntimeMethodHandle (method));
if (!method_is_virtual)
method_info = (MethodInfo)MethodBase.GetMethodFromHandleNoGenericCheck (new RuntimeMethodHandle (method));
else
method_info = GetVirtualMethod_internal ();
}
return method_info;
}
}
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern MethodInfo GetVirtualMethod_internal ();
public object Target {
get {
return m_target;
@ -467,13 +476,15 @@ namespace System
return MemberwiseClone ();
}
internal bool Compare (Delegate d)
public override bool Equals (object obj)
{
Delegate d = obj as Delegate;
if (d == null)
return false;
// Do not compare method_ptr, since it can point to a trampoline
if (d.m_target == m_target && d.method == method) {
if (d.m_target == m_target && d.Method == Method) {
if (d.data != null || data != null) {
/* Uncommon case */
if (d.data != null && data != null)
@ -492,14 +503,10 @@ namespace System
return false;
}
public override bool Equals (object obj)
{
return Compare (obj as Delegate);
}
public override int GetHashCode ()
{
return method.GetHashCode () ^ (m_target != null ? m_target.GetHashCode () : 0);
/* same implementation as CoreCLR */
return GetType ().GetHashCode ();
}
protected virtual MethodInfo GetMethodImpl ()