Exemple #1
0
        public virtual CorInfoTypeWithMod getArgType_wrapper(IntPtr _this, out IntPtr exception, CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_STRUCT_* args, ref CORINFO_CLASS_STRUCT_* vcTypeRet)
        {
            exception = IntPtr.Zero;
            try
            {
                return getArgType(sig, args, ref vcTypeRet);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (CorInfoTypeWithMod)0;
        }
Exemple #2
0
        private void getMethodSig(IntPtr _this, CORINFO_METHOD_STRUCT_* ftn, CORINFO_SIG_INFO* sig, CORINFO_CLASS_STRUCT_* memberParent)
        {
            MethodDesc method = HandleToObject(ftn);

            Get_CORINFO_SIG_INFO(method.Signature, out *sig);
        }
Exemple #3
0
 private void findSig(IntPtr _this, CORINFO_MODULE_STRUCT_* module, uint sigTOK, CORINFO_CONTEXT_STRUCT* context, CORINFO_SIG_INFO* sig)
 {
     var methodIL = (MethodIL)HandleToObject((IntPtr)module);
     Get_CORINFO_SIG_INFO((MethodSignature)methodIL.GetObject((int)sigTOK), out *sig);
 }
Exemple #4
0
 private void* getTailCallCopyArgsThunk(IntPtr _this, CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
 { throw new NotImplementedException("getTailCallCopyArgsThunk"); }
Exemple #5
0
        private void Get_CORINFO_SIG_INFO(MethodSignature signature, out CORINFO_SIG_INFO sig)
        {
            sig.callConv = (CorInfoCallConv)0;
            if (!signature.IsStatic) sig.callConv |= CorInfoCallConv.CORINFO_CALLCONV_HASTHIS;

            TypeDesc returnType = signature.ReturnType;

            CorInfoType corInfoRetType = asCorInfoType(signature.ReturnType, out sig.retTypeClass);
            sig._retType = (byte)corInfoRetType;
            sig.retTypeSigClass = sig.retTypeClass; // The difference between the two is not relevant for ILCompiler

            sig.flags = 0;    // used by IL stubs code

            sig.numArgs = (ushort)signature.Length;

            sig.args = (CORINFO_ARG_LIST_STRUCT_*)0; // CORINFO_ARG_LIST_STRUCT_ is argument index

            // TODO: Shared generic
            sig.sigInst.classInst = null;
            sig.sigInst.classInstCount = 0;
            sig.sigInst.methInst = null;
            sig.sigInst.methInstCount = 0;

            sig.pSig = (byte*)ObjectToHandle(signature);
            sig.cbSig = 0; // Not used by the JIT
            sig.scope = null; // Not used by the JIT
            sig.token = 0; // Not used by the JIT

            // TODO: Shared generic
            // if (ftn->RequiresInstArg())
            // {
            //     sig.callConv = (CorInfoCallConv)(sig.callConv | CORINFO_CALLCONV_PARAMTYPE);
            // }
        }
Exemple #6
0
 private void* GetCookieForPInvokeCalliSig(IntPtr _this, CORINFO_SIG_INFO* szMetaSig, ref void* ppIndirection)
 { throw new NotImplementedException("GetCookieForPInvokeCalliSig"); }
Exemple #7
0
 private IntPtr getVarArgsHandle(IntPtr _this, CORINFO_SIG_INFO* pSig, ref void* ppIndirection)
 { throw new NotImplementedException("getVarArgsHandle"); }
Exemple #8
0
        public virtual void* getTailCallCopyArgsThunk_wrapper(IntPtr _this, out IntPtr exception, CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
        {
            exception = IntPtr.Zero;
            try
            {
                return getTailCallCopyArgsThunk(pSig, flags);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (void*)0;
        }
Exemple #9
0
 public virtual void recordCallSite_wrapper(IntPtr _this, out IntPtr exception, uint instrOffset, CORINFO_SIG_INFO* callSig, CORINFO_METHOD_STRUCT_* methodHandle)
 {
     exception = IntPtr.Zero;
     try
     {
         recordCallSite(instrOffset, callSig, methodHandle);
         return;
     }
     catch (Exception ex)
     {
         exception = AllocException(ex);
     }
 }
Exemple #10
0
        public virtual IntPtr getVarArgsHandle_wrapper(IntPtr _this, out IntPtr exception, CORINFO_SIG_INFO* pSig, ref void* ppIndirection)
        {
            exception = IntPtr.Zero;
            try
            {
                return getVarArgsHandle(pSig, ref ppIndirection);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (IntPtr)0;
        }
Exemple #11
0
        [return: MarshalAs(UnmanagedType.I1)]public virtual bool canGetVarArgsHandle_wrapper(IntPtr _this, out IntPtr exception, CORINFO_SIG_INFO* pSig)
        {
            exception = IntPtr.Zero;
            try
            {
                return canGetVarArgsHandle(pSig);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return false;
        }
Exemple #12
0
        [return: MarshalAs(UnmanagedType.I1)]public virtual bool canGetCookieForPInvokeCalliSig_wrapper(IntPtr _this, out IntPtr exception, CORINFO_SIG_INFO* szMetaSig)
        {
            exception = IntPtr.Zero;
            try
            {
                return canGetCookieForPInvokeCalliSig(szMetaSig);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return false;
        }
Exemple #13
0
        public virtual void* GetCookieForPInvokeCalliSig_wrapper(IntPtr _this, out IntPtr exception, CORINFO_SIG_INFO* szMetaSig, ref void* ppIndirection)
        {
            exception = IntPtr.Zero;
            try
            {
                return GetCookieForPInvokeCalliSig(szMetaSig, ref ppIndirection);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (void*)0;
        }
Exemple #14
0
        public virtual CORINFO_CLASS_STRUCT_* getArgClass_wrapper(IntPtr _this, out IntPtr exception, CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_STRUCT_* args)
        {
            exception = IntPtr.Zero;
            try
            {
                return getArgClass(sig, args);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (CORINFO_CLASS_STRUCT_*)0;
        }
Exemple #15
0
        private CorInfoTypeWithMod getArgType(IntPtr _this, CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_STRUCT_* args, ref CORINFO_CLASS_STRUCT_* vcTypeRet)
        {
            int index = (int)args;
            Object sigObj = HandleToObject((IntPtr)sig->pSig);

            MethodSignature methodSig = sigObj as MethodSignature;

            if (methodSig != null)
            {
                TypeDesc type = methodSig[index];

                CorInfoType corInfoType = asCorInfoType(type, out vcTypeRet);
                return (CorInfoTypeWithMod)corInfoType;
            }
            else
            {
                LocalVariableDefinition[] locals = (LocalVariableDefinition[])sigObj;
                TypeDesc type = locals[index].Type;

                CorInfoType corInfoType = asCorInfoType(type, out vcTypeRet);

                return (CorInfoTypeWithMod)corInfoType | (locals[index].IsPinned ? CorInfoTypeWithMod.CORINFO_TYPE_MOD_PINNED : 0);
            }
        }
Exemple #16
0
 public virtual void getMethodSig_wrapper(IntPtr _this, out IntPtr exception, CORINFO_METHOD_STRUCT_* ftn, CORINFO_SIG_INFO* sig, CORINFO_CLASS_STRUCT_* memberParent)
 {
     exception = IntPtr.Zero;
     try
     {
         getMethodSig(ftn, sig, memberParent);
         return;
     }
     catch (Exception ex)
     {
         exception = AllocException(ex);
     }
 }
Exemple #17
0
        private CORINFO_CLASS_STRUCT_* getArgClass(IntPtr _this, CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_STRUCT_* args)
        {
            int index = (int)args;
            Object sigObj = HandleToObject((IntPtr)sig->pSig);

            MethodSignature methodSig = sigObj as MethodSignature;
            if (methodSig != null)
            {
                TypeDesc type = methodSig[index];
                return ObjectToHandle(type);
            }
            else
            {
                LocalVariableDefinition[] locals = (LocalVariableDefinition[])sigObj;
                TypeDesc type = locals[index].Type;
                return ObjectToHandle(type);
            }
        }
Exemple #18
0
        [return: MarshalAs(UnmanagedType.Bool)]public virtual bool pInvokeMarshalingRequired_wrapper(IntPtr _this, out IntPtr exception, CORINFO_METHOD_STRUCT_* method, CORINFO_SIG_INFO* callSiteSig)
        {
            exception = IntPtr.Zero;
            try
            {
                return pInvokeMarshalingRequired(method, callSiteSig);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return false;
        }
Exemple #19
0
 private bool canGetCookieForPInvokeCalliSig(IntPtr _this, CORINFO_SIG_INFO* szMetaSig)
 { throw new NotImplementedException("canGetCookieForPInvokeCalliSig"); }
Exemple #20
0
 public virtual void findCallSiteSig_wrapper(IntPtr _this, out IntPtr exception, CORINFO_MODULE_STRUCT_* module, uint methTOK, CORINFO_CONTEXT_STRUCT* context, CORINFO_SIG_INFO* sig)
 {
     exception = IntPtr.Zero;
     try
     {
         findCallSiteSig(module, methTOK, context, sig);
         return;
     }
     catch (Exception ex)
     {
         exception = AllocException(ex);
     }
 }
Exemple #21
0
 private bool canGetVarArgsHandle(IntPtr _this, CORINFO_SIG_INFO* pSig)
 { throw new NotImplementedException("canGetVarArgsHandle"); }
Exemple #22
0
        private void Get_CORINFO_SIG_INFO(MethodDesc method, out CORINFO_SIG_INFO sig)
        {
            Get_CORINFO_SIG_INFO(method.Signature, out sig);

            // Does the method have a hidden parameter?
            if (method.RequiresInstArg())
            {
                sig.callConv |= CorInfoCallConv.CORINFO_CALLCONV_PARAMTYPE;
            }
        }
Exemple #23
0
 private void recordCallSite(IntPtr _this, uint instrOffset, CORINFO_SIG_INFO* callSig, CORINFO_METHOD_STRUCT_* methodHandle)
 {
 }
Exemple #24
0
        private void Get_CORINFO_SIG_INFO(MethodSignature signature, out CORINFO_SIG_INFO sig)
        {
            sig.callConv = (CorInfoCallConv)(signature.Flags & MethodSignatureFlags.UnmanagedCallingConventionMask);
            if (!signature.IsStatic) sig.callConv |= CorInfoCallConv.CORINFO_CALLCONV_HASTHIS;

            TypeDesc returnType = signature.ReturnType;

            CorInfoType corInfoRetType = asCorInfoType(signature.ReturnType, out sig.retTypeClass);
            sig._retType = (byte)corInfoRetType;
            sig.retTypeSigClass = sig.retTypeClass; // The difference between the two is not relevant for ILCompiler

            sig.flags = 0;    // used by IL stubs code

            sig.numArgs = (ushort)signature.Length;

            sig.args = (CORINFO_ARG_LIST_STRUCT_*)0; // CORINFO_ARG_LIST_STRUCT_ is argument index

            sig.sigInst.classInst = null; // Not used by the JIT 
            sig.sigInst.classInstCount = 0; // Not used by the JIT 
            sig.sigInst.methInst = null; // Not used by the JIT 
            sig.sigInst.methInstCount = (uint)signature.GenericParameterCount;

            sig.pSig = (byte*)ObjectToHandle(signature);
            sig.cbSig = 0; // Not used by the JIT
            sig.scope = null; // Not used by the JIT
            sig.token = 0; // Not used by the JIT
        }
Exemple #25
0
        private void Get_CORINFO_SIG_INFO(LocalVariableDefinition[] locals, out CORINFO_SIG_INFO sig)
        {
            sig.callConv = CorInfoCallConv.CORINFO_CALLCONV_DEFAULT;
            sig._retType = (byte)CorInfoType.CORINFO_TYPE_VOID;
            sig.retTypeClass = null;
            sig.retTypeSigClass = null;
            sig.flags = (byte)CorInfoSigInfoFlags.CORINFO_SIGFLAG_IS_LOCAL_SIG;

            sig.numArgs = (ushort)locals.Length;

            sig.sigInst.classInst = null;
            sig.sigInst.classInstCount = 0;
            sig.sigInst.methInst = null;
            sig.sigInst.methInstCount = 0;

            sig.args = (CORINFO_ARG_LIST_STRUCT_*)0; // CORINFO_ARG_LIST_STRUCT_ is argument index

            sig.pSig = (byte*)ObjectToHandle(locals);
            sig.cbSig = 0; // Not used by the JIT
            sig.scope = null; // Not used by the JIT
            sig.token = 0; // Not used by the JIT
        }
Exemple #26
0
        private bool pInvokeMarshalingRequired(CORINFO_METHOD_STRUCT_* handle, CORINFO_SIG_INFO* callSiteSig)
        {
            // TODO: Support for PInvoke calli with marshalling. For now, assume there is no marshalling required.
            if (handle == null)
                return false;

            MethodDesc method = HandleToObject(handle);

            if (method.IsRawPInvoke())
                return false;

            // TODO: Ideally, we would just give back the PInvoke stub IL to the JIT and let it inline it, without
            // checking whether it is required upfront. Unfortunatelly, RyuJIT is not able to generate PInvoke
            // transitions in inlined methods today (impCheckForPInvokeCall is not called for inlinees and number of other places
            // depend on it). To get a decent code with this limitation, we mirror CoreCLR behavior: Check
            // whether PInvoke stub is required here, and disable inlining of PInvoke methods in getMethodAttribsInternal.
            return Internal.IL.Stubs.PInvokeILEmitter.IsStubRequired(method);
        }
Exemple #27
0
 private bool pInvokeMarshalingRequired(IntPtr _this, CORINFO_METHOD_STRUCT_* method, CORINFO_SIG_INFO* callSiteSig)
 { throw new NotImplementedException("pInvokeMarshalingRequired"); }
Exemple #28
0
 private void findCallSiteSig(CORINFO_MODULE_STRUCT_* module, uint methTOK, CORINFO_CONTEXT_STRUCT* context, CORINFO_SIG_INFO* sig)
 {
     var methodIL = (MethodIL)HandleToObject((IntPtr)module);
     Get_CORINFO_SIG_INFO(((MethodDesc)methodIL.GetObject((int)methTOK)), out *sig);
 }
Exemple #29
0
 private void findCallSiteSig(IntPtr _this, CORINFO_MODULE_STRUCT_* module, uint methTOK, CORINFO_CONTEXT_STRUCT* context, CORINFO_SIG_INFO* sig)
 {
     // TODO: dynamic scopes
     // TODO: verification
     var methodIL = (MethodIL)HandleToObject((IntPtr)module);
     Get_CORINFO_SIG_INFO(((MethodDesc)methodIL.GetObject((int)methTOK)).Signature, out *sig);
 }
Exemple #30
0
 static void _findCallSiteSig(IntPtr thisHandle, IntPtr* ppException, CORINFO_MODULE_STRUCT_* module, uint methTOK, CORINFO_CONTEXT_STRUCT* context, CORINFO_SIG_INFO* sig)
 {
     var _this = GetThis(thisHandle);
     try
     {
         _this.findCallSiteSig(module, methTOK, context, sig);
     }
     catch (Exception ex)
     {
         *ppException = _this.AllocException(ex);
     }
 }