Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete unused thread flags #103394

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/coreclr/inc/predeftlsslot.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ enum PredefinedTlsSlots
enum TlsThreadTypeFlag // flag used for thread type in Tls data
{
ThreadType_GC = 0x00000001,
ThreadType_Timer = 0x00000002,
ThreadType_Gate = 0x00000004,
// ThreadType_Timer = 0x00000002,
// ThreadType_Gate = 0x00000004,
ThreadType_DbgHelper = 0x00000008,
ThreadType_Shutdown = 0x00000010,
ThreadType_DynamicSuspendEE = 0x00000020,
ThreadType_Finalizer = 0x00000040,
ThreadType_ADUnloadHelper = 0x00000200,
ThreadType_ShutdownHelper = 0x00000400,
ThreadType_Threadpool_IOCompletion = 0x00000800,
ThreadType_Threadpool_Worker = 0x00001000,
ThreadType_Wait = 0x00002000,
// ThreadType_ADUnloadHelper = 0x00000200,
// ThreadType_ShutdownHelper = 0x00000400,
// ThreadType_Threadpool_IOCompletion = 0x00000800,
// ThreadType_Threadpool_Worker = 0x00001000,
// ThreadType_Wait = 0x00002000,
ThreadType_ProfAPI_Attach = 0x00004000,
ThreadType_ProfAPI_Detach = 0x00008000,
ThreadType_ETWRundownThread = 0x00010000,
Expand Down
46 changes: 0 additions & 46 deletions src/coreclr/inc/utilcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -3431,16 +3431,6 @@ inline BOOL IsGCSpecialThread ()
return !!(t_ThreadType & ThreadType_GC);
}

// check if current thread is a Gate thread
inline BOOL IsGateSpecialThread ()
{
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_MODE_ANY;

return !!(t_ThreadType & ThreadType_Gate);
}

// check if current thread is a debugger helper thread
inline BOOL IsDbgHelperSpecialThread ()
{
Expand Down Expand Up @@ -3481,33 +3471,6 @@ inline BOOL IsShutdownSpecialThread ()
return !!(t_ThreadType & ThreadType_Shutdown);
}

inline BOOL IsThreadPoolIOCompletionSpecialThread ()
{
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_MODE_ANY;

return !!(t_ThreadType & ThreadType_Threadpool_IOCompletion);
}

inline BOOL IsThreadPoolWorkerSpecialThread ()
{
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_MODE_ANY;

return !!(t_ThreadType & ThreadType_Threadpool_Worker);
}

inline BOOL IsWaitSpecialThread ()
{
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_MODE_ANY;

return !!(t_ThreadType & ThreadType_Wait);
}

// check if current thread is a thread which is performing shutdown
inline BOOL IsSuspendEEThread ()
{
Expand All @@ -3527,15 +3490,6 @@ inline BOOL IsFinalizerThread ()
return !!(t_ThreadType & ThreadType_Finalizer);
}

inline BOOL IsShutdownHelperThread ()
{
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_MODE_ANY;

return !!(t_ThreadType & ThreadType_ShutdownHelper);
}

inline BOOL IsProfilerAttachThread ()
{
STATIC_CONTRACT_NOTHROW;
Expand Down
29 changes: 0 additions & 29 deletions src/coreclr/vm/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,22 +683,6 @@ Thread* SetupThread()
// thread spinning up.
if (pThread)
{
if (IsThreadPoolWorkerSpecialThread())
{
pThread->SetThreadState(Thread::TS_TPWorkerThread);
pThread->SetBackground(TRUE);
}
else if (IsThreadPoolIOCompletionSpecialThread())
{
pThread->SetThreadState(Thread::TS_CompletionPortThread);
pThread->SetBackground(TRUE);
}
else if (IsWaitSpecialThread())
{
pThread->SetThreadState(Thread::TS_TPWorkerThread);
pThread->SetBackground(TRUE);
}

BOOL fStatus = pThread->HasStarted();
ensurePreemptive.SuppressRelease();
return fStatus ? pThread : NULL;
Expand Down Expand Up @@ -775,19 +759,6 @@ Thread* SetupThread()

ensurePreemptive.SuppressRelease();

if (IsThreadPoolWorkerSpecialThread())
{
pThread->SetThreadState(Thread::TS_TPWorkerThread);
}
else if (IsThreadPoolIOCompletionSpecialThread())
{
pThread->SetThreadState(Thread::TS_CompletionPortThread);
}
else if (IsWaitSpecialThread())
{
pThread->SetThreadState(Thread::TS_TPWorkerThread);
}

#ifdef FEATURE_EVENT_TRACE
ETW::ThreadLog::FireThreadCreated(pThread);
#endif // FEATURE_EVENT_TRACE
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ class Thread
TS_Interruptible = 0x02000000, // sitting in a Sleep(), Wait(), Join()
TS_Interrupted = 0x04000000, // was awakened by an interrupt APC. !!! This can be moved to TSNC

TS_CompletionPortThread = 0x08000000, // Completion port thread
// unused

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

Expand Down Expand Up @@ -1882,7 +1882,7 @@ class Thread
BOOL IsThreadPoolThread()
{
LIMITED_METHOD_CONTRACT;
return m_State & (Thread::TS_TPWorkerThread | Thread::TS_CompletionPortThread);
return m_State & Thread::TS_TPWorkerThread;
}

void SetIsThreadPoolThread()
Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/vm/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ void ClrFlsSetThreadType(TlsThreadTypeFlag flag)

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

void ClrFlsClearThreadType(TlsThreadTypeFlag flag)
Expand Down
Loading