From f3a45a91441cf938765bafc795cbf4885cad8800 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Mon, 24 Aug 2020 11:27:21 -0700 Subject: [PATCH] Delete dead code and obsolete comments (#41211) --- src/coreclr/src/debug/ee/debugger.cpp | 6 +++--- src/coreclr/src/debug/ee/funceval.cpp | 2 +- src/coreclr/src/vm/threads.cpp | 18 ++++-------------- src/coreclr/src/vm/threads.h | 30 ++++-------------------------- src/coreclr/src/vm/threadsuspend.cpp | 10 +--------- 5 files changed, 13 insertions(+), 53 deletions(-) diff --git a/src/coreclr/src/debug/ee/debugger.cpp b/src/coreclr/src/debug/ee/debugger.cpp index 5ead858..de49c11 100644 --- a/src/coreclr/src/debug/ee/debugger.cpp +++ b/src/coreclr/src/debug/ee/debugger.cpp @@ -7953,7 +7953,7 @@ void Debugger::ProcessAnyPendingEvals(Thread *pThread) // Now clear the bit else we'll see it again when we process the Exception notification // from this upcoming UserAbort exception. pThread->ResetThreadStateNC(Thread::TSNC_DebuggerReAbort); - pThread->UserAbort(Thread::TAR_Thread, EEPolicy::TA_Safe, INFINITE, Thread::UAC_Normal); + pThread->UserAbort(Thread::TAR_Thread, EEPolicy::TA_Safe, INFINITE); } #endif @@ -15475,7 +15475,7 @@ Debugger::FuncEvalAbort( // EX_TRY { - hr = pDE->m_thread->UserAbort(Thread::TAR_FuncEval, EEPolicy::TA_Safe, (DWORD)FUNC_EVAL_DEFAULT_TIMEOUT_VALUE, Thread::UAC_Normal); + hr = pDE->m_thread->UserAbort(Thread::TAR_FuncEval, EEPolicy::TA_Safe, (DWORD)FUNC_EVAL_DEFAULT_TIMEOUT_VALUE); if (hr == HRESULT_FROM_WIN32(ERROR_TIMEOUT)) { hr = S_OK; @@ -15541,7 +15541,7 @@ Debugger::FuncEvalRudeAbort( // EX_TRY { - hr = pDE->m_thread->UserAbort(Thread::TAR_FuncEval, EEPolicy::TA_Rude, (DWORD)FUNC_EVAL_DEFAULT_TIMEOUT_VALUE, Thread::UAC_Normal); + hr = pDE->m_thread->UserAbort(Thread::TAR_FuncEval, EEPolicy::TA_Rude, (DWORD)FUNC_EVAL_DEFAULT_TIMEOUT_VALUE); if (hr == HRESULT_FROM_WIN32(ERROR_TIMEOUT)) { hr = S_OK; diff --git a/src/coreclr/src/debug/ee/funceval.cpp b/src/coreclr/src/debug/ee/funceval.cpp index 0febdcba..8700b93 100644 --- a/src/coreclr/src/debug/ee/funceval.cpp +++ b/src/coreclr/src/debug/ee/funceval.cpp @@ -3886,7 +3886,7 @@ void * STDCALL FuncEvalHijackWorker(DebuggerEval *pDE) FrameWithCookie FEFrame(pDE, GetIP(&pDE->m_context), false); FEFrame.Push(); - pDE->m_thread->UserAbort(pDE->m_requester, EEPolicy::TA_Safe, INFINITE, Thread::UAC_Normal); + pDE->m_thread->UserAbort(pDE->m_requester, EEPolicy::TA_Safe, INFINITE); _ASSERTE(!"Should not return from UserAbort here!"); return NULL; } diff --git a/src/coreclr/src/vm/threads.cpp b/src/coreclr/src/vm/threads.cpp index 9dae20e..2a1be66 100644 --- a/src/coreclr/src/vm/threads.cpp +++ b/src/coreclr/src/vm/threads.cpp @@ -693,7 +693,7 @@ void EnsurePreemptive() typedef StateHolder EnsurePreemptiveModeIfException; -Thread* SetupThread(BOOL fInternal) +Thread* SetupThread() { CONTRACTL { THROWS; @@ -781,17 +781,7 @@ Thread* SetupThread(BOOL fInternal) SetupTLSForThread(pThread); - // A host can deny a thread entering runtime by returning a NULL IHostTask. - // But we do want threads used by threadpool. - if (IsThreadPoolWorkerSpecialThread() || - IsThreadPoolIOCompletionSpecialThread() || - IsTimerSpecialThread() || - IsWaitSpecialThread()) - { - fInternal = TRUE; - } - - if (!pThread->InitThread(fInternal) || + if (!pThread->InitThread() || !pThread->PrepareApartmentAndContext()) ThrowOutOfMemory(); @@ -1616,7 +1606,7 @@ Thread::Thread() //-------------------------------------------------------------------- // Failable initialization occurs here. //-------------------------------------------------------------------- -BOOL Thread::InitThread(BOOL fInternal) +BOOL Thread::InitThread() { CONTRACTL { THROWS; @@ -1841,7 +1831,7 @@ BOOL Thread::HasStarted(BOOL bRequiresTSL) ThrowOutOfMemory(); } - InitThread(FALSE); + InitThread(); SetThread(this); SetAppDomain(m_pDomain); diff --git a/src/coreclr/src/vm/threads.h b/src/coreclr/src/vm/threads.h index 03aea2e..c8acec7 100644 --- a/src/coreclr/src/vm/threads.h +++ b/src/coreclr/src/vm/threads.h @@ -580,19 +580,7 @@ enum ThreadpoolThreadType //--------------------------------------------------------------------------- // //--------------------------------------------------------------------------- -Thread* SetupThread(BOOL fInternal); -inline Thread* SetupThread() -{ - WRAPPER_NO_CONTRACT; - return SetupThread(FALSE); -} -// A host can deny a thread entering runtime by returning a NULL IHostTask. -// But we do want threads used by threadpool. -inline Thread* SetupInternalThread() -{ - WRAPPER_NO_CONTRACT; - return SetupThread(TRUE); -} +Thread* SetupThread(); Thread* SetupThreadNoThrow(HRESULT *phresult = NULL); // WARNING : only GC calls this with bRequiresTSL set to FALSE. Thread* SetupUnstartedThread(BOOL bRequiresTSL=TRUE); @@ -1001,9 +989,6 @@ public: // // A code:Thread contains all the per-thread information needed by the runtime. You can get at this // structure throught the and OS TLS slot see code:#RuntimeThreadLocals for more -// Implementing IUnknown would prevent the field (e.g. m_Context) layout from being rearranged (which will need to be fixed in -// "asmconstants.h" for the respective architecture). As it is, ICLRTask derives from IUnknown and would have got IUnknown implemented -// here - so doing this explicitly and maintaining layout sanity should be just fine. class Thread { friend struct ThreadQueue; // used to enqueue & dequeue threads onto SyncBlocks @@ -1793,7 +1778,7 @@ public: //-------------------------------------------------------------- // Failable initialization occurs here. //-------------------------------------------------------------- - BOOL InitThread(BOOL fInternal); + BOOL InitThread(); BOOL AllocHandles(); //-------------------------------------------------------------- @@ -2597,16 +2582,9 @@ public: public: - enum UserAbort_Client - { - UAC_Normal, - UAC_Host, // Called by host through IClrTask::Abort - }; - HRESULT UserAbort(ThreadAbortRequester requester, EEPolicy::ThreadAbortTypes abortType, - DWORD timeout, - UserAbort_Client client + DWORD timeout ); BOOL HandleJITCaseForAbort(); @@ -4797,7 +4775,7 @@ class ThreadStore { friend class Thread; friend class ThreadSuspend; - friend Thread* SetupThread(BOOL); + friend Thread* SetupThread(); friend class AppDomain; #ifdef DACCESS_COMPILE friend class ClrDataAccess; diff --git a/src/coreclr/src/vm/threadsuspend.cpp b/src/coreclr/src/vm/threadsuspend.cpp index 51a2b07..746d722 100644 --- a/src/coreclr/src/vm/threadsuspend.cpp +++ b/src/coreclr/src/vm/threadsuspend.cpp @@ -1230,8 +1230,7 @@ void Thread::SetAbortEndTime(ULONGLONG endTime, BOOL fRudeAbort) HRESULT Thread::UserAbort(ThreadAbortRequester requester, EEPolicy::ThreadAbortTypes abortType, - DWORD timeout, - UserAbort_Client client + DWORD timeout ) { CONTRACTL @@ -1300,13 +1299,6 @@ Thread::UserAbort(ThreadAbortRequester requester, _ASSERTE(this != pCurThread); // Aborting another thread. - if (client == UAC_Host) - { - // A host may call ICLRTask::Abort on a critical thread. We don't want to - // block this thread. - return S_OK; - } - #ifdef _DEBUG DWORD elapsed_time = 0; #endif -- 2.7.4