* [PATCH] Optimize SYSCALL_CANCEL and INTERNAL_SYSCALL_CANCEL code size
@ 2022-02-16 19:05 Adhemerval Zanella
0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2022-02-16 19:05 UTC (permalink / raw)
To: libc-alpha
Unfortunately gcc can not fold the two INLINE_SYSCALL_CALL. By avoiding
issuing it manually results in less code:
* before
text data bss dec hex filename
1729315 18776 51192 1799283 1b7473 aarch64-linux-gnu/libc.so
1733703 9744 37928 1781375 1b2e7f arm-linux-gnueabihf/libc.so
2270258 11220 39112 2320590 2368ce i686-linux-gnu/libc.so
2472053 23024 51600 2546677 26dbf5 powerpc64le-linux-gnu/libc.so
2192944 21308 38045 2252297 225e09 powerpc-linux-gnu/libc.so
2059244 20008 53320 2132572 208a5c s390x-linux-gnu/libc.so
2135603 20344 54800 2210747 21bbbb x86_64-linux-gnu/libc.so
* after
text data bss dec hex filename
1727803 18776 51192 1797771 1b6e8b aarch64-linux-gnu/libc.so
1731055 9744 37928 1778727 1b2427 arm-linux-gnueabihf/libc.so
2268002 11220 39112 2318334 235ffe i686-linux-gnu/libc.so6
2465785 23024 51600 2540409 26c379 powerpc64le-linux-gnu/libc.so
2185660 21308 38045 2245013 224195 powerpc-linux-gnu/libc.so
2057676 20008 53320 2131004 20843c s390x-linux-gnu/libc.so
2134387 20344 54800 2209531 21b6fb x86_64-linux-gnu/libc.so
Checked on x86_64-linux-gnu.
---
sysdeps/unix/sysdep.h | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h
index a1d9df4c73..6092f1a8a2 100644
--- a/sysdeps/unix/sysdep.h
+++ b/sysdeps/unix/sysdep.h
@@ -118,14 +118,12 @@
#define SYSCALL_CANCEL(...) \
({ \
long int sc_ret; \
- if (NO_SYSCALL_CANCEL_CHECKING) \
- sc_ret = INLINE_SYSCALL_CALL (__VA_ARGS__); \
- else \
- { \
- int sc_cancel_oldtype = LIBC_CANCEL_ASYNC (); \
- sc_ret = INLINE_SYSCALL_CALL (__VA_ARGS__); \
- LIBC_CANCEL_RESET (sc_cancel_oldtype); \
- } \
+ int sc_cancel_oldtype = 0; \
+ if (!NO_SYSCALL_CANCEL_CHECKING) \
+ sc_cancel_oldtype = LIBC_CANCEL_ASYNC (); \
+ sc_ret = INLINE_SYSCALL_CALL (__VA_ARGS__); \
+ if (!NO_SYSCALL_CANCEL_CHECKING) \
+ LIBC_CANCEL_RESET (sc_cancel_oldtype); \
sc_ret; \
})
@@ -134,14 +132,12 @@
#define INTERNAL_SYSCALL_CANCEL(...) \
({ \
long int sc_ret; \
- if (NO_SYSCALL_CANCEL_CHECKING) \
- sc_ret = INTERNAL_SYSCALL_CALL (__VA_ARGS__); \
- else \
- { \
- int sc_cancel_oldtype = LIBC_CANCEL_ASYNC (); \
- sc_ret = INTERNAL_SYSCALL_CALL (__VA_ARGS__); \
- LIBC_CANCEL_RESET (sc_cancel_oldtype); \
- } \
+ long int sc_cancel_oldtype = 0; \
+ if (!NO_SYSCALL_CANCEL_CHECKING) \
+ sc_cancel_oldtype = LIBC_CANCEL_ASYNC (); \
+ sc_ret = INTERNAL_SYSCALL_CALL (__VA_ARGS__); \
+ if (!NO_SYSCALL_CANCEL_CHECKING) \
+ LIBC_CANCEL_RESET (sc_cancel_oldtype); \
sc_ret; \
})
--
2.32.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-16 19:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 19:05 [PATCH] Optimize SYSCALL_CANCEL and INTERNAL_SYSCALL_CANCEL code size Adhemerval Zanella
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).