[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH glibc 31/34] hurd: Microoptimize _hurd_self_sigstate ()
From: |
Sergey Bugaev |
Subject: |
[RFC PATCH glibc 31/34] hurd: Microoptimize _hurd_self_sigstate () |
Date: |
Sun, 19 Mar 2023 18:10:14 +0300 |
When THREAD_GETMEM is defined with inline assembly, the compiler may not
optimize away the two reads of _hurd_sigstate. Help it out a little bit
by only reading it once. This also makes for a slightly cleaner code.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
---
hurd/hurd/signal.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h
index c33f974b..662e955e 100644
--- a/hurd/hurd/signal.h
+++ b/hurd/hurd/signal.h
@@ -166,13 +166,15 @@ extern void _hurd_sigstate_delete (thread_t thread);
_HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate *
_hurd_self_sigstate (void)
{
- if (THREAD_GETMEM (THREAD_SELF, _hurd_sigstate) == NULL)
+ struct hurd_sigstate *ss = THREAD_GETMEM (THREAD_SELF, _hurd_sigstate);
+ if (__glibc_unlikely (ss == NULL))
{
thread_t self = __mach_thread_self ();
- THREAD_SETMEM (THREAD_SELF, _hurd_sigstate, _hurd_thread_sigstate
(self));
+ ss = _hurd_thread_sigstate (self);
+ THREAD_SETMEM (THREAD_SELF, _hurd_sigstate, ss);
__mach_port_deallocate (__mach_task_self (), self);
}
- return THREAD_GETMEM (THREAD_SELF, _hurd_sigstate);
+ return ss;
}
# endif
#endif
--
2.39.2
- [RFC PATCH glibc 17/34] hurd: Implement x86_64/intr-msg.h, (continued)
- [RFC PATCH glibc 17/34] hurd: Implement x86_64/intr-msg.h, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 16/34] hurd: Add sys/ucontext.h and sigcontext.h for x86_64, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 18/34] hurd: Port trampoline.c to x86_64, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 19/34] hurd: Move a couple of singal-related files to x86, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 24/34] hurd: Only check for TLS initialization inside rtld or in static builds, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 21/34] x86_64: Add rtld-stpncpy & rtld-strncpy, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 23/34] elf: Stop including tls.h in ldsodefs.h, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 25/34] hurd: Improve reply port handling when exiting signal handlers, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 22/34] htl: Implement thread_set_pcsptp for x86_64, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 29/34] hurd: Add vm_param.h for x86_64, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 31/34] hurd: Microoptimize _hurd_self_sigstate (),
Sergey Bugaev <=
- [RFC PATCH glibc 26/34] hurd: Remove __hurd_local_reply_port, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 20/34] htl: Add tcb-offsets.sym for x86_64, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 27/34] hurd: Don't leak __hurd_reply_port0, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 28/34] hurd: Implement _hurd_longjmp_thread_state for x86_64, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 30/34] hurd: Implement longjmp for x86_64, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 32/34] hurd: Implement sigreturn for x86_64, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 33/34] hurd: Create abilist files for lib{mach, hurd}user, Sergey Bugaev, 2023/03/19