summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2021-07-02 14:53:52 +0200
committerDenys Vlasenko2021-07-02 14:53:52 +0200
commitef5463cf16f88c0992b2073a30ab6081c86fdf23 (patch)
treedef2ea3c1470aa0126db226e7e7d5098c31e8dcd
parent966cafcc77d8cda5d1a95bc73080e9a9b9010a45 (diff)
downloadbusybox-ef5463cf16f88c0992b2073a30ab6081c86fdf23.zip
busybox-ef5463cf16f88c0992b2073a30ab6081c86fdf23.tar.gz
awk: shuffle globals for smaller offsets
function old new delta awk_main 832 829 -3 evaluate 3229 3223 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-9) Total: -9 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/awk.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/editors/awk.c b/editors/awk.c
index 9f5a940..068ed68 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -536,6 +536,11 @@ struct globals {
smallint nextfile;
smallint is_f0_split;
smallint t_rollback;
+
+ /* former statics from various functions */
+ smallint next_token__concat_inserted;
+ uint32_t next_token__save_tclass;
+ uint32_t next_token__save_info;
};
struct globals2 {
uint32_t t_info; /* often used */
@@ -548,15 +553,11 @@ struct globals2 {
/* former statics from various functions */
char *split_f0__fstrings;
- uint32_t next_token__save_tclass;
- uint32_t next_token__save_info;
- smallint next_token__concat_inserted;
-
- smallint next_input_file__files_happen;
rstream next_input_file__rsm;
+ smallint next_input_file__files_happen;
- var *evaluate__fnargs;
unsigned evaluate__seed;
+ var *evaluate__fnargs;
regex_t evaluate__sreg;
var ptest__tmpvar;
@@ -575,10 +576,10 @@ struct globals2 {
#define G1 (ptr_to_globals[-1])
#define G (*(struct globals2 *)ptr_to_globals)
/* For debug. nm --size-sort awk.o | grep -vi ' [tr] ' */
-/*char G1size[sizeof(G1)]; - 0x74 */
-/*char Gsize[sizeof(G)]; - 0x1c4 */
+//char G1size[sizeof(G1)]; // 0x70
+//char Gsize[sizeof(G)]; // 0x2f8
/* Trying to keep most of members accessible with short offsets: */
-/*char Gofs_seed[offsetof(struct globals2, evaluate__seed)]; - 0x90 */
+//char Gofs_seed[offsetof(struct globals2, evaluate__seed)]; // 0x7c
#define t_double (G1.t_double )
#define beginseq (G1.beginseq )
#define mainseq (G1.mainseq )
@@ -1056,9 +1057,9 @@ static int istrue(var *v)
*/
static uint32_t next_token(uint32_t expected)
{
-#define concat_inserted (G.next_token__concat_inserted)
-#define save_tclass (G.next_token__save_tclass)
-#define save_info (G.next_token__save_info)
+#define concat_inserted (G1.next_token__concat_inserted)
+#define save_tclass (G1.next_token__save_tclass)
+#define save_info (G1.next_token__save_info)
char *p;
const char *tl;