This change is based on Wine's winnt.h implementation. Using a register variable for NtCurrentTeb
allows the compiler to optimize the access more effectively. --- mingw-w64-headers/include/winnt.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mingw-w64-headers/include/winnt.h b/mingw-w64-headers/include/winnt.h index 96a610c1d..499f72219 100644 --- a/mingw-w64-headers/include/winnt.h +++ b/mingw-w64-headers/include/winnt.h @@ -10211,11 +10211,10 @@ typedef DWORD (WINAPI *PRTL_RUN_ONCE_INIT_FN)(PRTL_RUN_ONCE, PVOID, PVOID *); PVOID GetFiberData(VOID); #if defined (__aarch64__) || defined(__arm64ec__) + register struct _TEB *__mingw_current_teb __asm__("x18"); FORCEINLINE struct _TEB *NtCurrentTeb(VOID) { - struct _TEB *teb; - __asm ("mov %0, x18" : "=r" (teb)); - return teb; + return __mingw_current_teb; } FORCEINLINE PVOID GetCurrentFiber(VOID) {
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public