Example #1
0
        unsafe StackObject *ILInvokeSub(ILIntepreter intp, StackObject *esp, IList <object> mStack)
        {
            var  ebp = esp;
            bool unhandled;

            if (method.HasThis)
            {
                esp = ILIntepreter.PushObject(esp, mStack, instance);
            }
            int paramCnt = method.ParameterCount;

            for (int i = paramCnt; i > 0; i--)
            {
                intp.CopyToStack(esp, Minus(ebp, i), mStack);
                esp++;
            }
            var ret = intp.Execute(method, esp, out unhandled);

            if (next != null)
            {
                if (method.ReturnType != appdomain.VoidType)
                {
                    intp.Free(ret - 1);//Return value for multicast delegate doesn't make sense, only return the last one's value
                }
                DelegateAdapter n = (DelegateAdapter)next;
                ret = n.ILInvokeSub(intp, ebp, mStack);
            }
            return(ret);
        }
Example #2
0
 public override bool Equals(object obj)
 {
     if (obj is DelegateAdapter)
     {
         DelegateAdapter b = (DelegateAdapter)obj;
         return(instance == b.instance && method == b.method);
     }
     return(false);
 }
Example #3
0
 public virtual bool Equals(IDelegateAdapter adapter)
 {
     if (adapter is DelegateAdapter)
     {
         DelegateAdapter b = (DelegateAdapter)adapter;
         return(instance == b.instance && method == b.method);
     }
     else
     {
         return(false);
     }
 }
Example #4
0
        unsafe StackObject *ILInvokeSub(ILIntepreter intp, StackObject *esp, IList <object> mStack)
        {
            var  ebp = esp;
            bool unhandled;

            if (method.HasThis)
            {
                esp = ILIntepreter.PushObject(esp, mStack, instance);
            }
            int paramCnt = method.ParameterCount;

            if (method.IsExtend && instance != null)
            {
                esp = ILIntepreter.PushObject(esp, mStack, instance);
                paramCnt--;
            }
            bool useRegister = method.ShouldUseRegisterVM;

            for (int i = paramCnt; i > 0; i--)
            {
                intp.CopyToStack(esp, Minus(ebp, i), mStack);
                if (esp->ObjectType < ObjectTypes.Object && useRegister)
                {
                    mStack.Add(null);
                }
                esp++;
            }
            StackObject *ret;

            if (useRegister)
            {
                ret = intp.ExecuteR(method, esp, out unhandled);
            }
            else
            {
                ret = intp.Execute(method, esp, out unhandled);
            }
            if (next != null)
            {
                if (method.ReturnType != appdomain.VoidType)
                {
                    intp.Free(ret - 1);//Return value for multicast delegate doesn't make sense, only return the last one's value
                }
                DelegateAdapter n = (DelegateAdapter)next;
                ret = n.ILInvokeSub(intp, ebp, mStack);
            }
            return(ret);
        }
 public virtual bool Equals(IDelegateAdapter adapter)
 {
     if (adapter is DelegateAdapter)
     {
         DelegateAdapter b = (DelegateAdapter)adapter;
         if (adapter is DummyDelegateAdapter)
         {
             return(instance == b.instance && next == b.next && method == b.method);
         }
         else
         {
             return(instance == b.instance && next == b.next && method == b.method && Delegate == b.Delegate);
         }
     }
     else
     {
         return(false);
     }
 }