diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-02-15 14:55:14 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-02-15 14:55:14 +0100 |
commit | ae8643e671db5c574ecba6aa7fe9012f286dc257 (patch) | |
tree | e854aec6fd7680ef8c06bd667cbb42fe4885e6a6 /syscall.c | |
parent | cb26b754935ffac5476f7f6e581346374eddf713 (diff) | |
download | strace-ae8643e671db5c574ecba6aa7fe9012f286dc257.tar.gz strace-ae8643e671db5c574ecba6aa7fe9012f286dc257.tar.bz2 strace-ae8643e671db5c574ecba6aa7fe9012f286dc257.tar.xz |
A better handling of current_wordsize
On x86_64:
text data bss dec hex filename
435661 26628 47424 509713 7c711 strace_old
435501 26612 47440 509553 7c671 strace_new_clever_wordsize
On x32 and arm it should be even better, current_wordsize becomes
a constant there.
* defs.h: Declare current_wordsize as a variable if needed,
else declare as a constant define.
Remove declatation of personality_wordsize[].
* syscall.c: Make personality_wordsize[] static.
Declare current_wordsize as a variable if needed.
(set_personality): Set current_wordsize only if non-constant.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'syscall.c')
-rw-r--r-- | syscall.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -214,15 +214,18 @@ unsigned nioctlents = nioctlents0; int *qual_flags = qual_flags0; #if SUPPORTED_PERSONALITIES > 1 -int current_personality; +unsigned current_personality; -const int personality_wordsize[SUPPORTED_PERSONALITIES] = { +# ifndef current_wordsize +unsigned current_wordsize; +static const int personality_wordsize[SUPPORTED_PERSONALITIES] = { PERSONALITY0_WORDSIZE, PERSONALITY1_WORDSIZE, # if SUPPORTED_PERSONALITIES > 2 PERSONALITY2_WORDSIZE, # endif }; +# endif void set_personality(int personality) @@ -268,6 +271,9 @@ set_personality(int personality) } current_personality = personality; +# ifndef current_wordsize + current_wordsize = personality_wordsize[personality]; +# endif } static void |