diff options
author | Jan Kotas <jkotas@microsoft.com> | 2018-06-20 06:34:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-20 06:34:09 +0300 |
commit | 756e71269169c3a57d087efc71221963944e80a8 (patch) | |
tree | 47c9d8ddfeb6fbdff0e993b62cd3d7c904c7bfdd /src | |
parent | 46845627c591d8fdc95945233c23f0b942bae6f8 (diff) |
Update RyuJIT (#5969)
Diffstat (limited to 'src')
-rw-r--r-- | src/JitInterface/src/CorInfoBase.cs | 61 | ||||
-rw-r--r-- | src/JitInterface/src/CorInfoImpl.cs | 6 | ||||
-rw-r--r-- | src/JitInterface/src/ThunkGenerator/ThunkInput.txt | 1 | ||||
-rw-r--r-- | src/JitInterface/src/ThunkGenerator/corinfo.h | 16 | ||||
-rw-r--r-- | src/Native/jitinterface/jitinterface.h | 10 | ||||
-rw-r--r-- | src/Native/jitinterface/jitwrapper.cpp | 10 |
6 files changed, 73 insertions, 31 deletions
diff --git a/src/JitInterface/src/CorInfoBase.cs b/src/JitInterface/src/CorInfoBase.cs index 8ce1de300..f9f78d97a 100644 --- a/src/JitInterface/src/CorInfoBase.cs +++ b/src/JitInterface/src/CorInfoBase.cs @@ -320,6 +320,8 @@ namespace Internal.JitInterface [UnmanagedFunctionPointerAttribute(default(CallingConvention))] delegate void* __getTailCallCopyArgsThunk(IntPtr _this, IntPtr* ppException, CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags); [UnmanagedFunctionPointerAttribute(default(CallingConvention))] + [return: MarshalAs(UnmanagedType.I1)]delegate bool __convertPInvokeCalliToCall(IntPtr _this, IntPtr* ppException, ref CORINFO_RESOLVED_TOKEN pResolvedToken, [MarshalAs(UnmanagedType.I1)]bool mustConvert); + [UnmanagedFunctionPointerAttribute(default(CallingConvention))] delegate void* __getMemoryManager(IntPtr _this, IntPtr* ppException); [UnmanagedFunctionPointerAttribute(default(CallingConvention))] delegate void __allocMem(IntPtr _this, IntPtr* ppException, uint hotCodeSize, uint coldCodeSize, uint roDataSize, uint xcptnsCount, CorJitAllocMemFlag flag, ref void* hotCodeBlock, ref void* coldCodeBlock, ref void* roDataBlock); @@ -2478,6 +2480,20 @@ namespace Internal.JitInterface } } + [return: MarshalAs(UnmanagedType.I1)]static bool _convertPInvokeCalliToCall(IntPtr thisHandle, IntPtr* ppException, ref CORINFO_RESOLVED_TOKEN pResolvedToken, [MarshalAs(UnmanagedType.I1)]bool mustConvert) + { + var _this = GetThis(thisHandle); + try + { + return _this.convertPInvokeCalliToCall(ref pResolvedToken, mustConvert); + } + catch (Exception ex) + { + *ppException = _this.AllocException(ex); + return default(bool); + } + } + static void* _getMemoryManager(IntPtr thisHandle, IntPtr* ppException) { var _this = GetThis(thisHandle); @@ -2737,8 +2753,8 @@ namespace Internal.JitInterface static IntPtr GetUnmanagedCallbacks(out Object keepAlive) { - IntPtr * callbacks = (IntPtr *)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 173); - Object[] delegates = new Object[173]; + IntPtr * callbacks = (IntPtr *)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 174); + Object[] delegates = new Object[174]; var d0 = new __getMethodAttribs(_getMethodAttribs); callbacks[0] = Marshal.GetFunctionPointerForDelegate(d0); @@ -3202,63 +3218,66 @@ namespace Internal.JitInterface var d153 = new __getTailCallCopyArgsThunk(_getTailCallCopyArgsThunk); callbacks[153] = Marshal.GetFunctionPointerForDelegate(d153); delegates[153] = d153; - var d154 = new __getMemoryManager(_getMemoryManager); + var d154 = new __convertPInvokeCalliToCall(_convertPInvokeCalliToCall); callbacks[154] = Marshal.GetFunctionPointerForDelegate(d154); delegates[154] = d154; - var d155 = new __allocMem(_allocMem); + var d155 = new __getMemoryManager(_getMemoryManager); callbacks[155] = Marshal.GetFunctionPointerForDelegate(d155); delegates[155] = d155; - var d156 = new __reserveUnwindInfo(_reserveUnwindInfo); + var d156 = new __allocMem(_allocMem); callbacks[156] = Marshal.GetFunctionPointerForDelegate(d156); delegates[156] = d156; - var d157 = new __allocUnwindInfo(_allocUnwindInfo); + var d157 = new __reserveUnwindInfo(_reserveUnwindInfo); callbacks[157] = Marshal.GetFunctionPointerForDelegate(d157); delegates[157] = d157; - var d158 = new __allocGCInfo(_allocGCInfo); + var d158 = new __allocUnwindInfo(_allocUnwindInfo); callbacks[158] = Marshal.GetFunctionPointerForDelegate(d158); delegates[158] = d158; - var d159 = new __yieldExecution(_yieldExecution); + var d159 = new __allocGCInfo(_allocGCInfo); callbacks[159] = Marshal.GetFunctionPointerForDelegate(d159); delegates[159] = d159; - var d160 = new __setEHcount(_setEHcount); + var d160 = new __yieldExecution(_yieldExecution); callbacks[160] = Marshal.GetFunctionPointerForDelegate(d160); delegates[160] = d160; - var d161 = new __setEHinfo(_setEHinfo); + var d161 = new __setEHcount(_setEHcount); callbacks[161] = Marshal.GetFunctionPointerForDelegate(d161); delegates[161] = d161; - var d162 = new __logMsg(_logMsg); + var d162 = new __setEHinfo(_setEHinfo); callbacks[162] = Marshal.GetFunctionPointerForDelegate(d162); delegates[162] = d162; - var d163 = new __doAssert(_doAssert); + var d163 = new __logMsg(_logMsg); callbacks[163] = Marshal.GetFunctionPointerForDelegate(d163); delegates[163] = d163; - var d164 = new __reportFatalError(_reportFatalError); + var d164 = new __doAssert(_doAssert); callbacks[164] = Marshal.GetFunctionPointerForDelegate(d164); delegates[164] = d164; - var d165 = new __allocBBProfileBuffer(_allocBBProfileBuffer); + var d165 = new __reportFatalError(_reportFatalError); callbacks[165] = Marshal.GetFunctionPointerForDelegate(d165); delegates[165] = d165; - var d166 = new __getBBProfileData(_getBBProfileData); + var d166 = new __allocBBProfileBuffer(_allocBBProfileBuffer); callbacks[166] = Marshal.GetFunctionPointerForDelegate(d166); delegates[166] = d166; - var d167 = new __recordCallSite(_recordCallSite); + var d167 = new __getBBProfileData(_getBBProfileData); callbacks[167] = Marshal.GetFunctionPointerForDelegate(d167); delegates[167] = d167; - var d168 = new __recordRelocation(_recordRelocation); + var d168 = new __recordCallSite(_recordCallSite); callbacks[168] = Marshal.GetFunctionPointerForDelegate(d168); delegates[168] = d168; - var d169 = new __getRelocTypeHint(_getRelocTypeHint); + var d169 = new __recordRelocation(_recordRelocation); callbacks[169] = Marshal.GetFunctionPointerForDelegate(d169); delegates[169] = d169; - var d170 = new __getModuleNativeEntryPointRange(_getModuleNativeEntryPointRange); + var d170 = new __getRelocTypeHint(_getRelocTypeHint); callbacks[170] = Marshal.GetFunctionPointerForDelegate(d170); delegates[170] = d170; - var d171 = new __getExpectedTargetArchitecture(_getExpectedTargetArchitecture); + var d171 = new __getModuleNativeEntryPointRange(_getModuleNativeEntryPointRange); callbacks[171] = Marshal.GetFunctionPointerForDelegate(d171); delegates[171] = d171; - var d172 = new __getJitFlags(_getJitFlags); + var d172 = new __getExpectedTargetArchitecture(_getExpectedTargetArchitecture); callbacks[172] = Marshal.GetFunctionPointerForDelegate(d172); delegates[172] = d172; + var d173 = new __getJitFlags(_getJitFlags); + callbacks[173] = Marshal.GetFunctionPointerForDelegate(d173); + delegates[173] = d173; keepAlive = delegates; return (IntPtr)callbacks; diff --git a/src/JitInterface/src/CorInfoImpl.cs b/src/JitInterface/src/CorInfoImpl.cs index fc2985413..7d8d49445 100644 --- a/src/JitInterface/src/CorInfoImpl.cs +++ b/src/JitInterface/src/CorInfoImpl.cs @@ -3448,6 +3448,12 @@ namespace Internal.JitInterface return null; } + private bool convertPInvokeCalliToCall(ref CORINFO_RESOLVED_TOKEN pResolvedToken, bool mustConvert) + { + Debug.Assert(!mustConvert); + return false; + } + private void* getMemoryManager() { // This method is completely handled by the C++ wrapper to the JIT-EE interface, diff --git a/src/JitInterface/src/ThunkGenerator/ThunkInput.txt b/src/JitInterface/src/ThunkGenerator/ThunkInput.txt index 4792e13d1..056daa6db 100644 --- a/src/JitInterface/src/ThunkGenerator/ThunkInput.txt +++ b/src/JitInterface/src/ThunkGenerator/ThunkInput.txt @@ -314,6 +314,7 @@ FUNCTIONS CORINFO_METHOD_HANDLE GetDelegateCtor(CORINFO_METHOD_HANDLE methHnd, CORINFO_CLASS_HANDLE clsHnd, CORINFO_METHOD_HANDLE targetMethodHnd, DelegateCtorArgs * pCtorData); void MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd); void* getTailCallCopyArgsThunk (CORINFO_SIG_INFO *pSig, CorInfoHelperTailCallSpecialHandling flags); + bool convertPInvokeCalliToCall(CORINFO_RESOLVED_TOKEN * pResolvedToken, bool mustConvert); [ManualNativeWrapper] IEEMemoryManager* getMemoryManager(); void allocMem( ULONG hotCodeSize, ULONG coldCodeSize, ULONG roDataSize, ULONG xcptnsCount, CorJitAllocMemFlag flag, void** hotCodeBlock, void** coldCodeBlock, void** roDataBlock ); void reserveUnwindInfo(BOOL isFunclet, BOOL isColdCode, ULONG unwindSize) diff --git a/src/JitInterface/src/ThunkGenerator/corinfo.h b/src/JitInterface/src/ThunkGenerator/corinfo.h index d430412f3..1e4bb9618 100644 --- a/src/JitInterface/src/ThunkGenerator/corinfo.h +++ b/src/JitInterface/src/ThunkGenerator/corinfo.h @@ -213,11 +213,11 @@ TODO: Talk about initializing strutures before use #define SELECTANY extern __declspec(selectany) #endif -SELECTANY const GUID JITEEVersionIdentifier = { /* 0ba106c8-81a0-407f-99a1-928448c1eb62 */ - 0x0ba106c8, - 0x81a0, - 0x407f, - {0x99, 0xa1, 0x92, 0x84, 0x48, 0xc1, 0xeb, 0x62} +SELECTANY const GUID JITEEVersionIdentifier = { /* dc72a60f-22f2-49fb-809f-00077f3eb1a8 */ + 0xdc72a60f, + 0x22f2, + 0x49fb, + { 0x80, 0x9f, 0x0, 0x7, 0x7f, 0x3e, 0xb1, 0xa8} }; ////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -3153,6 +3153,12 @@ public: CORINFO_SIG_INFO *pSig, CorInfoHelperTailCallSpecialHandling flags ) = 0; + + // Optionally, convert calli to regular method call. This is for PInvoke argument marshalling. + virtual bool convertPInvokeCalliToCall( + CORINFO_RESOLVED_TOKEN * pResolvedToken, + bool fMustConvert + ) = 0; }; /**********************************************************************************/ diff --git a/src/Native/jitinterface/jitinterface.h b/src/Native/jitinterface/jitinterface.h index 9902df650..5d115bde5 100644 --- a/src/Native/jitinterface/jitinterface.h +++ b/src/Native/jitinterface/jitinterface.h @@ -164,6 +164,7 @@ struct JitInterfaceCallbacks void* (* GetDelegateCtor)(void * thisHandle, CorInfoException** ppException, void* methHnd, void* clsHnd, void* targetMethodHnd, void* pCtorData); void (* MethodCompileComplete)(void * thisHandle, CorInfoException** ppException, void* methHnd); void* (* getTailCallCopyArgsThunk)(void * thisHandle, CorInfoException** ppException, void* pSig, int flags); + bool (* convertPInvokeCalliToCall)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken, bool mustConvert); void* (* getMemoryManager)(void * thisHandle, CorInfoException** ppException); void (* allocMem)(void * thisHandle, CorInfoException** ppException, unsigned int hotCodeSize, unsigned int coldCodeSize, unsigned int roDataSize, unsigned int xcptnsCount, int flag, void** hotCodeBlock, void** coldCodeBlock, void** roDataBlock); void (* reserveUnwindInfo)(void * thisHandle, CorInfoException** ppException, int isFunclet, int isColdCode, unsigned int unwindSize); @@ -1516,6 +1517,15 @@ public: return _ret; } + virtual bool convertPInvokeCalliToCall(void* pResolvedToken, bool mustConvert) + { + CorInfoException* pException = nullptr; + bool _ret = _callbacks->convertPInvokeCalliToCall(_thisHandle, &pException, pResolvedToken, mustConvert); + if (pException != nullptr) + throw pException; + return _ret; + } + virtual void* getMemoryManager(); virtual void allocMem(unsigned int hotCodeSize, unsigned int coldCodeSize, unsigned int roDataSize, unsigned int xcptnsCount, int flag, void** hotCodeBlock, void** coldCodeBlock, void** roDataBlock) { diff --git a/src/Native/jitinterface/jitwrapper.cpp b/src/Native/jitinterface/jitwrapper.cpp index ac5264b7d..d42d54a8f 100644 --- a/src/Native/jitinterface/jitwrapper.cpp +++ b/src/Native/jitinterface/jitwrapper.cpp @@ -27,11 +27,11 @@ private: unsigned __int64 corJitFlags; }; -static const GUID JITEEVersionIdentifier = { /* 0ba106c8-81a0-407f-99a1-928448c1eb62 */ - 0x0ba106c8, - 0x81a0, - 0x407f, - {0x99, 0xa1, 0x92, 0x84, 0x48, 0xc1, 0xeb, 0x62} +static const GUID JITEEVersionIdentifier = { /* dc72a60f-22f2-49fb-809f-00077f3eb1a8 */ + 0xdc72a60f, + 0x22f2, + 0x49fb, + { 0x80, 0x9f, 0x0, 0x7, 0x7f, 0x3e, 0xb1, 0xa8 } }; class Jit |