Skip to content
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
6 changes: 1 addition & 5 deletions src/coreclr/debug/di/rsmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ const char * GetDebugCodeName(DWORD dwCode)
// Per-thread state for Debug builds...
//-----------------------------------------------------------------------------
#ifdef RSCONTRACTS
#ifndef __GNUC__
__declspec(thread) DbgRSThread* DbgRSThread::t_pCurrent;
#else // !__GNUC__
__thread DbgRSThread* DbgRSThread::t_pCurrent;
#endif // !__GNUC__
thread_local DbgRSThread* DbgRSThread::t_pCurrent;

LONG DbgRSThread::s_Total = 0;

Expand Down
6 changes: 1 addition & 5 deletions src/coreclr/debug/di/rspriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -11228,11 +11228,7 @@ class DbgRSThread
DbgRSThread();

// The TLS slot that we'll put this thread object in.
#ifndef __GNUC__
static __declspec(thread) DbgRSThread* t_pCurrent;
#else // !__GNUC__
static __thread DbgRSThread* t_pCurrent;
#endif // !__GNUC__
static thread_local DbgRSThread* t_pCurrent;

static LONG s_Total; // Total count of thread objects

Expand Down
12 changes: 6 additions & 6 deletions src/coreclr/debug/di/rsthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3125,7 +3125,7 @@ HRESULT CordbUnmanagedThread::SetTlsSlot(DWORD slot, REMOTE_PTR value)
return S_OK;
}

// gets the value of gCurrentThreadInfo.m_pThread
// gets the value of t_CurrentThreadInfo.m_pThread
DWORD_PTR CordbUnmanagedThread::GetEEThreadValue()
{
DWORD_PTR ret = NULL;
Expand All @@ -3152,7 +3152,7 @@ DWORD_PTR CordbUnmanagedThread::GetEEThreadValue()
return ret;
}

// returns the remote address of gCurrentThreadInfo
// returns the remote address of t_CurrentThreadInfo
HRESULT CordbUnmanagedThread::GetClrModuleTlsDataAddress(REMOTE_PTR* pAddress)
{
*pAddress = NULL;
Expand Down Expand Up @@ -3721,14 +3721,14 @@ HRESULT CordbUnmanagedThread::SetupFirstChanceHijackForSync()
LOG((LF_CORDB, LL_INFO10000, "CUT::SFCHFS: hijackCtx started as:\n"));
LogContext(GetHijackCtx());

// Save the thread's full context + DT_CONTEXT_EXTENDED_REGISTERS
// Save the thread's full context + DT_CONTEXT_EXTENDED_REGISTERS
// to avoid getting incomplete information and corrupt the thread context
DT_CONTEXT context;
#if defined(DT_CONTEXT_EXTENDED_REGISTERS)
#if defined(DT_CONTEXT_EXTENDED_REGISTERS)
context.ContextFlags = DT_CONTEXT_FULL | DT_CONTEXT_EXTENDED_REGISTERS;
#else
context.ContextFlags = DT_CONTEXT_FULL;
#endif
#endif
BOOL succ = DbiGetThreadContext(m_handle, &context);
_ASSERTE(succ);
// for debugging when GetThreadContext fails
Expand All @@ -3741,7 +3741,7 @@ HRESULT CordbUnmanagedThread::SetupFirstChanceHijackForSync()
GetHijackCtx()->ContextFlags = DT_CONTEXT_FULL | DT_CONTEXT_EXTENDED_REGISTERS;
#else
GetHijackCtx()->ContextFlags = DT_CONTEXT_FULL;
#endif
#endif
CORDbgCopyThreadContext(GetHijackCtx(), &context);
LOG((LF_CORDB, LL_INFO10000, "CUT::SFCHFS: thread=0x%x Hijacking for sync. Original context is:\n", this));
LogContext(GetHijackCtx());
Expand Down
13 changes: 7 additions & 6 deletions src/coreclr/inc/palclr.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@

// ===========================================================================


#if defined(HOST_WINDOWS)

#ifndef __PALCLR_H__
#define __PALCLR_H__

#if defined(HOST_WINDOWS)

// This macro is used to standardize the wide character string literals between UNIX and Windows.
// Unix L"" is UTF32, and on windows it's UTF16. Because of built-in assumptions on the size
// of string literals, it's important to match behaviour between Unix and Windows. Unix will be defined
Expand Down Expand Up @@ -602,9 +601,9 @@

#define __clr_reserved __reserved

#endif // __PALCLR_H__

#include "palclr_win.h"
// Native system libray handle.
// In Windows, NATIVE_LIBRARY_HANDLE is the same as HMODULE.
typedef HMODULE NATIVE_LIBRARY_HANDLE;

#ifndef IMAGE_FILE_MACHINE_LOONGARCH64
#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264 // LOONGARCH64.
Expand All @@ -615,3 +614,5 @@
#endif

#endif // defined(HOST_WINDOWS)

#endif // __PALCLR_H__
143 changes: 0 additions & 143 deletions src/coreclr/inc/palclr_win.h

This file was deleted.

9 changes: 2 additions & 7 deletions src/coreclr/pal/src/exception/seh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ PAL_ThrowExceptionFromContext(CONTEXT* context, PAL_SEHException* ex)
// We need to make a copy of the exception off stack, since the "ex" is located in one of the stack
// frames that will become obsolete by the ThrowExceptionFromContextInternal and the ThrowExceptionHelper
// could overwrite the "ex" object by stack e.g. when allocating the low level exception object for "throw".
static __thread BYTE threadLocalExceptionStorage[sizeof(PAL_SEHException)];
static thread_local BYTE threadLocalExceptionStorage[sizeof(PAL_SEHException)];
ThrowExceptionFromContextInternal(context, new (threadLocalExceptionStorage) PAL_SEHException(std::move(*ex)));
}

Expand Down Expand Up @@ -372,12 +372,7 @@ bool CatchHardwareExceptionHolder::IsEnabled()

--*/

#if defined(__GNUC__)
static __thread
#else // __GNUC__
__declspec(thread) static
#endif // !__GNUC__
NativeExceptionHolderBase *t_nativeExceptionHolderHead = nullptr;
static thread_local NativeExceptionHolderBase *t_nativeExceptionHolderHead = nullptr;

extern "C"
NativeExceptionHolderBase **
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/vm/amd64/AsmMacros.inc
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,17 @@ Section ends
; Inlined version of GetThread
; Trashes rax and r11
;
gCurrentThreadInfo TEXTEQU <?gCurrentThreadInfo@@3UThreadLocalInfo@@A>
t_CurrentThreadInfo TEXTEQU <?t_CurrentThreadInfo@@3UThreadLocalInfo@@A>

INLINE_GETTHREAD macro Reg

EXTERN _tls_index : DWORD
EXTERN gCurrentThreadInfo:DWORD
EXTERN t_CurrentThreadInfo:DWORD

mov r11d, [_tls_index]
mov rax, gs:[OFFSET__TEB__ThreadLocalStoragePointer]
mov rax, [rax + r11 * 8]
mov r11d, SECTIONREL gCurrentThreadInfo
mov r11d, SECTIONREL t_CurrentThreadInfo
mov Reg, [rax + r11]

endm
Expand Down
18 changes: 9 additions & 9 deletions src/coreclr/vm/arm/asmmacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ __PWTB_StackAlloc SETA __PWTB_TransitionBlock
;
__tls_array equ 0x2C ;; offsetof(TEB, ThreadLocalStoragePointer)

GBLS __SECTIONREL_gCurrentThreadInfo
__SECTIONREL_gCurrentThreadInfo SETS "SECTIONREL_gCurrentThreadInfo"
GBLS __SECTIONREL_t_CurrentThreadInfo
__SECTIONREL_t_CurrentThreadInfo SETS "SECTIONREL_t_CurrentThreadInfo"

MACRO
INLINE_GETTHREAD $destReg, $trashReg
Expand All @@ -172,24 +172,24 @@ __SECTIONREL_gCurrentThreadInfo SETS "SECTIONREL_gCurrentThreadInfo"
mrc p15, 0, $trashReg, c13, c0, 2
ldr $trashReg, [$trashReg, #__tls_array]
ldr $destReg, [$trashReg, $destReg, lsl #2]
ldr $trashReg, $__SECTIONREL_gCurrentThreadInfo
ldr $destReg,[$destReg, $trashReg] ; return gCurrentThreadInfo.m_pThread
ldr $trashReg, $__SECTIONREL_t_CurrentThreadInfo
ldr $destReg,[$destReg, $trashReg] ; return t_CurrentThreadInfo.m_pThread
MEND

;-----------------------------------------------------------------------------
; INLINE_GETTHREAD_CONSTANT_POOL macro has to be used after the last function in the .asm file that used
; INLINE_GETTHREAD. Optionally, it can be also used after any function that used INLINE_GETTHREAD
; to improve density, or to reduce distance between the constant pool and its use.
;
SETALIAS gCurrentThreadInfo, ?gCurrentThreadInfo@@3UThreadLocalInfo@@A
SETALIAS t_CurrentThreadInfo, ?t_CurrentThreadInfo@@3UThreadLocalInfo@@A

MACRO
INLINE_GETTHREAD_CONSTANT_POOL
EXTERN $gCurrentThreadInfo
EXTERN $t_CurrentThreadInfo

$__SECTIONREL_gCurrentThreadInfo
DCDU $gCurrentThreadInfo
$__SECTIONREL_t_CurrentThreadInfo
DCDU $t_CurrentThreadInfo
RELOC 15 ;; SECREL

__SECTIONREL_gCurrentThreadInfo SETS "$__SECTIONREL_gCurrentThreadInfo":CC:"_"
__SECTIONREL_t_CurrentThreadInfo SETS "$__SECTIONREL_t_CurrentThreadInfo":CC:"_"
MEND
8 changes: 4 additions & 4 deletions src/coreclr/vm/arm64/asmmacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,13 @@ TrashRegister32Bit SETS "w":CC:("$TrashRegister32Bit":RIGHT:((:LEN:TrashRegister
;;
;; Macro to get a pointer to the Thread* object for the currently executing thread
;;
SETALIAS gCurrentThreadInfo, ?gCurrentThreadInfo@@3UThreadLocalInfo@@A
SETALIAS t_CurrentThreadInfo, ?t_CurrentThreadInfo@@3UThreadLocalInfo@@A

MACRO
INLINE_GETTHREAD $destReg, $trashReg

EXTERN $gCurrentThreadInfo
EXTERN $t_CurrentThreadInfo

INLINE_GET_TLS_VAR $destReg, $trashReg, $gCurrentThreadInfo
ldr $destReg, [$destReg] ;; return gCurrentThreadInfo.m_pThread
INLINE_GET_TLS_VAR $destReg, $trashReg, $t_CurrentThreadInfo
ldr $destReg, [$destReg] ;; return t_CurrentThreadInfo.m_pThread
MEND
4 changes: 2 additions & 2 deletions src/coreclr/vm/ceemain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ void EEStartupHelper()
#endif

// This isn't done as part of InitializeGarbageCollector() above because
// debugger must be initialized before creating EE thread objects
// debugger must be initialized before creating EE thread objects
FinalizerThread::FinalizerThreadCreate();

InitPreStubManager();
Expand Down Expand Up @@ -1735,7 +1735,7 @@ static uint32_t g_flsIndex = FLS_OUT_OF_INDEXES;
#define FLS_STATE_ARMED 1
#define FLS_STATE_INVOKED 2

static __declspec(thread) byte t_flsState;
static thread_local byte t_flsState;

// This is called when each *fiber* is destroyed. When the home fiber of a thread is destroyed,
// it means that the thread itself is destroyed.
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/eedbginterfaceimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,7 @@ void EEDbgInterfaceImpl::GetRuntimeOffsets(SIZE_T *pTLSIndex,

#ifdef TARGET_WINDOWS
*pTLSIndex = _tls_index;
*pTLSEEThreadOffset = Thread::GetOffsetOfThreadStatic(&gCurrentThreadInfo.m_pThread);
*pTLSEEThreadOffset = Thread::GetOffsetOfThreadStatic(&t_CurrentThreadInfo.m_pThread);
*pTLSIsSpecialOffset = Thread::GetOffsetOfThreadStatic(&t_ThreadType);
*pTLSCantStopOffset = Thread::GetOffsetOfThreadStatic(&t_CantStopCount);
#else
Expand Down
Loading