From aff5cf7d79ae31995ad2802551a86134e00aa4dc Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Wed, 15 Jul 2020 18:34:48 -0700 Subject: [PATCH] Add support for GCPOLL_INLINE for crossgen (#39376) Fixes #13591 --- src/coreclr/src/inc/readytorun.h | 1 + .../tools/Common/Internal/Runtime/ReadyToRunConstants.cs | 1 + src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs | 6 ------ .../JitInterface/CorInfoImpl.ReadyToRun.cs | 6 ++++++ .../ReadyToRunSignature.cs | 3 +++ src/coreclr/src/vm/jitinterface.cpp | 4 ++++ src/coreclr/src/zap/zapinfo.cpp | 8 ++++++-- 7 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/coreclr/src/inc/readytorun.h b/src/coreclr/src/inc/readytorun.h index f3bc01a878b94..b883f4b558e9b 100644 --- a/src/coreclr/src/inc/readytorun.h +++ b/src/coreclr/src/inc/readytorun.h @@ -219,6 +219,7 @@ enum ReadyToRunHelper // Not a real helper - handle to current module passed to delay load helpers. READYTORUN_HELPER_Module = 0x01, READYTORUN_HELPER_GSCookie = 0x02, + READYTORUN_HELPER_IndirectTrapThreads = 0x03, // // Delay load helpers diff --git a/src/coreclr/src/tools/Common/Internal/Runtime/ReadyToRunConstants.cs b/src/coreclr/src/tools/Common/Internal/Runtime/ReadyToRunConstants.cs index be037341870d4..ce6de5de37cac 100644 --- a/src/coreclr/src/tools/Common/Internal/Runtime/ReadyToRunConstants.cs +++ b/src/coreclr/src/tools/Common/Internal/Runtime/ReadyToRunConstants.cs @@ -140,6 +140,7 @@ public enum ReadyToRunHelper // Not a real helper - handle to current module passed to delay load helpers. Module = 0x01, GSCookie = 0x02, + IndirectTrapThreads = 0x03, // // Delay load helpers diff --git a/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs index dea009b035fea..da5d691a39cf6 100644 --- a/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs @@ -2496,12 +2496,6 @@ private uint getThreadTLSIndex(ref void* ppIndirection) private void* getInlinedCallFrameVptr(ref void* ppIndirection) { throw new NotImplementedException("getInlinedCallFrameVptr"); } - private int* getAddrOfCaptureThreadGlobal(ref void* ppIndirection) - { - ppIndirection = null; - return null; - } - private Dictionary _helperCache = new Dictionary(); private void* getHelperFtn(CorInfoHelpFunc ftnNum, ref void* ppIndirection) { diff --git a/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs b/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs index 7388a1d0ef6e0..2c2085635f348 100644 --- a/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs +++ b/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs @@ -2029,6 +2029,12 @@ private void getGSCookie(IntPtr* pCookieVal, IntPtr** ppCookieVal) *ppCookieVal = (IntPtr *)ObjectToHandle(_compilation.NodeFactory.GetReadyToRunHelperCell(ReadyToRunHelper.GSCookie)); } + private int* getAddrOfCaptureThreadGlobal(ref void* ppIndirection) + { + ppIndirection = (void*)ObjectToHandle(_compilation.NodeFactory.GetReadyToRunHelperCell(ReadyToRunHelper.IndirectTrapThreads)); + return null; + } + private void getMethodVTableOffset(CORINFO_METHOD_STRUCT_* method, ref uint offsetOfIndirection, ref uint offsetAfterIndirection, ref bool isRelative) { throw new NotImplementedException("getMethodVTableOffset"); } private void expandRawHandleIntrinsic(ref CORINFO_RESOLVED_TOKEN pResolvedToken, ref CORINFO_GENERICHANDLE_RESULT pResult) diff --git a/src/coreclr/src/tools/aot/ILCompiler.Reflection.ReadyToRun/ReadyToRunSignature.cs b/src/coreclr/src/tools/aot/ILCompiler.Reflection.ReadyToRun/ReadyToRunSignature.cs index 5f7175ef4e2d0..c8fca51fa4bef 100644 --- a/src/coreclr/src/tools/aot/ILCompiler.Reflection.ReadyToRun/ReadyToRunSignature.cs +++ b/src/coreclr/src/tools/aot/ILCompiler.Reflection.ReadyToRun/ReadyToRunSignature.cs @@ -1472,6 +1472,9 @@ private void ParseHelper(StringBuilder builder) builder.Append("GC_COOKIE"); break; + case ReadyToRunHelper.IndirectTrapThreads: + builder.Append("INDIRECT_TRAP_THREADS"); + break; // // Delay load helpers diff --git a/src/coreclr/src/vm/jitinterface.cpp b/src/coreclr/src/vm/jitinterface.cpp index 7c41498805bdb..09c077665fe69 100644 --- a/src/coreclr/src/vm/jitinterface.cpp +++ b/src/coreclr/src/vm/jitinterface.cpp @@ -13725,6 +13725,10 @@ BOOL LoadDynamicInfoEntry(Module *currentModule, result = (size_t)GetProcessGSCookie(); break; + case READYTORUN_HELPER_IndirectTrapThreads: + result = (size_t)&g_TrapReturningThreads; + break; + case READYTORUN_HELPER_DelayLoad_MethodCall: result = (size_t)GetEEFuncEntryPoint(DelayLoad_MethodCall); break; diff --git a/src/coreclr/src/zap/zapinfo.cpp b/src/coreclr/src/zap/zapinfo.cpp index 310c0b93cb053..203196851cc14 100644 --- a/src/coreclr/src/zap/zapinfo.cpp +++ b/src/coreclr/src/zap/zapinfo.cpp @@ -1430,9 +1430,13 @@ LONG * ZapInfo::getAddrOfCaptureThreadGlobal(void **ppIndirection) _ASSERTE(ppIndirection != NULL); *ppIndirection = NULL; - if (!IsReadyToRunCompilation()) + if (IsReadyToRunCompilation()) + { + *ppIndirection = m_pImage->GetImportTable()->GetHelperImport(READYTORUN_HELPER_IndirectTrapThreads); + } + else { - *ppIndirection = (LONG*)m_pImage->GetInnerPtr(m_pImage->m_pEEInfoTable, + *ppIndirection = m_pImage->GetInnerPtr(m_pImage->m_pEEInfoTable, offsetof(CORCOMPILE_EE_INFO_TABLE, addrOfCaptureThreadGlobal)); }