Skip to content

Commit 5622ed0

Browse files
authored
Delete unused thread flags (#103394)
Deleting thread flags that are never set anymore
1 parent 4f9cd4d commit 5622ed0

File tree

5 files changed

+9
-89
lines changed

5 files changed

+9
-89
lines changed

src/coreclr/inc/predeftlsslot.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ enum PredefinedTlsSlots
2222
enum TlsThreadTypeFlag // flag used for thread type in Tls data
2323
{
2424
ThreadType_GC = 0x00000001,
25-
ThreadType_Timer = 0x00000002,
26-
ThreadType_Gate = 0x00000004,
25+
// ThreadType_Timer = 0x00000002,
26+
// ThreadType_Gate = 0x00000004,
2727
ThreadType_DbgHelper = 0x00000008,
2828
ThreadType_Shutdown = 0x00000010,
2929
ThreadType_DynamicSuspendEE = 0x00000020,
3030
ThreadType_Finalizer = 0x00000040,
31-
ThreadType_ADUnloadHelper = 0x00000200,
32-
ThreadType_ShutdownHelper = 0x00000400,
33-
ThreadType_Threadpool_IOCompletion = 0x00000800,
34-
ThreadType_Threadpool_Worker = 0x00001000,
35-
ThreadType_Wait = 0x00002000,
31+
// ThreadType_ADUnloadHelper = 0x00000200,
32+
// ThreadType_ShutdownHelper = 0x00000400,
33+
// ThreadType_Threadpool_IOCompletion = 0x00000800,
34+
// ThreadType_Threadpool_Worker = 0x00001000,
35+
// ThreadType_Wait = 0x00002000,
3636
ThreadType_ProfAPI_Attach = 0x00004000,
3737
ThreadType_ProfAPI_Detach = 0x00008000,
3838
ThreadType_ETWRundownThread = 0x00010000,

src/coreclr/inc/utilcode.h

-46
Original file line numberDiff line numberDiff line change
@@ -3431,16 +3431,6 @@ inline BOOL IsGCSpecialThread ()
34313431
return !!(t_ThreadType & ThreadType_GC);
34323432
}
34333433

3434-
// check if current thread is a Gate thread
3435-
inline BOOL IsGateSpecialThread ()
3436-
{
3437-
STATIC_CONTRACT_NOTHROW;
3438-
STATIC_CONTRACT_GC_NOTRIGGER;
3439-
STATIC_CONTRACT_MODE_ANY;
3440-
3441-
return !!(t_ThreadType & ThreadType_Gate);
3442-
}
3443-
34443434
// check if current thread is a debugger helper thread
34453435
inline BOOL IsDbgHelperSpecialThread ()
34463436
{
@@ -3481,33 +3471,6 @@ inline BOOL IsShutdownSpecialThread ()
34813471
return !!(t_ThreadType & ThreadType_Shutdown);
34823472
}
34833473

3484-
inline BOOL IsThreadPoolIOCompletionSpecialThread ()
3485-
{
3486-
STATIC_CONTRACT_NOTHROW;
3487-
STATIC_CONTRACT_GC_NOTRIGGER;
3488-
STATIC_CONTRACT_MODE_ANY;
3489-
3490-
return !!(t_ThreadType & ThreadType_Threadpool_IOCompletion);
3491-
}
3492-
3493-
inline BOOL IsThreadPoolWorkerSpecialThread ()
3494-
{
3495-
STATIC_CONTRACT_NOTHROW;
3496-
STATIC_CONTRACT_GC_NOTRIGGER;
3497-
STATIC_CONTRACT_MODE_ANY;
3498-
3499-
return !!(t_ThreadType & ThreadType_Threadpool_Worker);
3500-
}
3501-
3502-
inline BOOL IsWaitSpecialThread ()
3503-
{
3504-
STATIC_CONTRACT_NOTHROW;
3505-
STATIC_CONTRACT_GC_NOTRIGGER;
3506-
STATIC_CONTRACT_MODE_ANY;
3507-
3508-
return !!(t_ThreadType & ThreadType_Wait);
3509-
}
3510-
35113474
// check if current thread is a thread which is performing shutdown
35123475
inline BOOL IsSuspendEEThread ()
35133476
{
@@ -3527,15 +3490,6 @@ inline BOOL IsFinalizerThread ()
35273490
return !!(t_ThreadType & ThreadType_Finalizer);
35283491
}
35293492

3530-
inline BOOL IsShutdownHelperThread ()
3531-
{
3532-
STATIC_CONTRACT_NOTHROW;
3533-
STATIC_CONTRACT_GC_NOTRIGGER;
3534-
STATIC_CONTRACT_MODE_ANY;
3535-
3536-
return !!(t_ThreadType & ThreadType_ShutdownHelper);
3537-
}
3538-
35393493
inline BOOL IsProfilerAttachThread ()
35403494
{
35413495
STATIC_CONTRACT_NOTHROW;

src/coreclr/vm/threads.cpp

-29
Original file line numberDiff line numberDiff line change
@@ -666,22 +666,6 @@ Thread* SetupThread()
666666
// thread spinning up.
667667
if (pThread)
668668
{
669-
if (IsThreadPoolWorkerSpecialThread())
670-
{
671-
pThread->SetThreadState(Thread::TS_TPWorkerThread);
672-
pThread->SetBackground(TRUE);
673-
}
674-
else if (IsThreadPoolIOCompletionSpecialThread())
675-
{
676-
pThread->SetThreadState(Thread::TS_CompletionPortThread);
677-
pThread->SetBackground(TRUE);
678-
}
679-
else if (IsWaitSpecialThread())
680-
{
681-
pThread->SetThreadState(Thread::TS_TPWorkerThread);
682-
pThread->SetBackground(TRUE);
683-
}
684-
685669
BOOL fStatus = pThread->HasStarted();
686670
ensurePreemptive.SuppressRelease();
687671
return fStatus ? pThread : NULL;
@@ -758,19 +742,6 @@ Thread* SetupThread()
758742

759743
ensurePreemptive.SuppressRelease();
760744

761-
if (IsThreadPoolWorkerSpecialThread())
762-
{
763-
pThread->SetThreadState(Thread::TS_TPWorkerThread);
764-
}
765-
else if (IsThreadPoolIOCompletionSpecialThread())
766-
{
767-
pThread->SetThreadState(Thread::TS_CompletionPortThread);
768-
}
769-
else if (IsWaitSpecialThread())
770-
{
771-
pThread->SetThreadState(Thread::TS_TPWorkerThread);
772-
}
773-
774745
#ifdef FEATURE_EVENT_TRACE
775746
ETW::ThreadLog::FireThreadCreated(pThread);
776747
#endif // FEATURE_EVENT_TRACE

src/coreclr/vm/threads.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ class Thread
577577
TS_Interruptible = 0x02000000, // sitting in a Sleep(), Wait(), Join()
578578
TS_Interrupted = 0x04000000, // was awakened by an interrupt APC. !!! This can be moved to TSNC
579579

580-
TS_CompletionPortThread = 0x08000000, // Completion port thread
580+
// unused
581581

582582
TS_AbortInitiated = 0x10000000, // set when abort is begun
583583

@@ -1815,7 +1815,7 @@ class Thread
18151815
BOOL IsThreadPoolThread()
18161816
{
18171817
LIMITED_METHOD_CONTRACT;
1818-
return m_State & (Thread::TS_TPWorkerThread | Thread::TS_CompletionPortThread);
1818+
return m_State & Thread::TS_TPWorkerThread;
18191819
}
18201820

18211821
void SetIsThreadPoolThread()

src/coreclr/vm/util.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@ void ClrFlsSetThreadType(TlsThreadTypeFlag flag)
2828

2929
// The historic location of ThreadType slot kept for compatibility with SOS
3030
// TODO: Introduce DAC API to make this hack unnecessary
31-
#if defined(_MSC_VER) && defined(HOST_X86)
32-
// Workaround for https://developercommunity.visualstudio.com/content/problem/949233/tls-relative-fixup-overflow-tls-section-is-too-lar.html
33-
gCurrentThreadInfo.m_EETlsData = (void**)(((size_t)&t_ThreadType ^ 1) - (4 * TlsIdx_ThreadType + 1));
34-
#else
3531
gCurrentThreadInfo.m_EETlsData = (void**)&t_ThreadType - TlsIdx_ThreadType;
36-
#endif
3732
}
3833

3934
void ClrFlsClearThreadType(TlsThreadTypeFlag flag)

0 commit comments

Comments
 (0)