From 51e968b013e9b1582035f202e004ed024f747f4f Mon Sep 17 00:00:00 2001 From: Austin Wise Date: Sun, 5 Mar 2017 17:51:40 -0800 Subject: Remove hosting methods that always return false (#9930) * Remove CLRIoCompletionHosted as it always returns false. * Remove CLRSyncHosted as it always returns false. * Remove CLRMemoryHosted as it always returns false. * Remove CLRTaskHosted as it always returns false. * Remove CLRAssemblyHosted, CLRGCHosted,and CLRSecurityHosted. They are not called. * Remove IsThreadPoolHosted as it always returns false. * Remove EnterRuntime and LeaveRuntime, as they do nothing. * Add back calls to RevertIfImpersonated and GCX_PREEMP. I accidentally deleted the call to RevertIfImpersonated instead of just removing an extra parameter. When I removed the HR_LEAVE_RUNTIME_HOLDER macro from windowsruntime.h, I not only removed a LeaveRuntimeHolder but also a GCX_PREEMP. So I added it back. The holder and GCX_PREEMP where only inserted when the FEATURE_LEAVE_RUNTIME_HOLDER macro was defined. Since it is always defined, I removed it. Also as I understand it, you would always want to have a GCX_PREEMP before calling into the Windows API as not to block the GC, so I'm not sure why you would want to disable it. --- src/vm/crst.cpp | 40 +++------------------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) (limited to 'src/vm/crst.cpp') diff --git a/src/vm/crst.cpp b/src/vm/crst.cpp index 9613798f93..36447e2232 100644 --- a/src/vm/crst.cpp +++ b/src/vm/crst.cpp @@ -33,25 +33,7 @@ VOID CrstBase::InitWorker(INDEBUG_COMMA(CrstType crstType) CrstFlags flags) CONTRACTL { THROWS; WRAPPER(GC_TRIGGERS); - } CONTRACTL_END; - - // Disallow creation of Crst before EE starts. But only complain if we end up - // being hosted, since such Crsts have escaped the hosting net and will cause - // AVs on next use. -#ifdef _DEBUG - static bool fEarlyInit; // = false - - if (!g_fEEStarted) - { - if (!CLRSyncHosted()) - fEarlyInit = true; - } - - // If we are now hosted, we better not have *ever* created some Crsts that are - // not known to our host. - _ASSERTE(!fEarlyInit || !CLRSyncHosted()); - -#endif + } CONTRACTL_END; _ASSERTE((flags & CRST_INITIALIZED) == 0); @@ -328,16 +310,7 @@ void CrstBase::Enter(INDEBUG(NoLevelCheckFlag noLevelCheckFlag/* = CRST_LEVEL_CH } } - { - if (CLRTaskHosted()) - { - Thread::BeginThreadAffinity(); - } - - UnsafeEnterCriticalSection(&m_criticalsection); - - } - + UnsafeEnterCriticalSection(&m_criticalsection); #ifdef _DEBUG PostEnter(); @@ -370,14 +343,7 @@ void CrstBase::Leave() Thread * pThread = GetThread(); #endif - { - UnsafeLeaveCriticalSection(&m_criticalsection); - - - if (CLRTaskHosted()) { - Thread::EndThreadAffinity(); - } - } + UnsafeLeaveCriticalSection(&m_criticalsection); // Check for both rare case using one if-check if (m_dwFlags & (CRST_TAKEN_DURING_SHUTDOWN | CRST_DEBUGGER_THREAD)) -- cgit v1.2.3