Browse code

Rearrange some fields in structs to avoid holes.

Török Edvin authored on 2010/06/09 19:42:47
Showing 6 changed files
... ...
@@ -56,12 +56,12 @@ struct cli_bc {
56 56
   uint16_t *globaltys;
57 57
   size_t num_globals;
58 58
   enum bc_state state;
59
-  uint16_t start_tid;
60 59
   struct bitset_tag *uses_apis;
61 60
   char *lsig;
62 61
   char *vnameprefix;
63 62
   char **vnames;
64 63
   unsigned vnames_cnt;
64
+  uint16_t start_tid;
65 65
   struct cli_bc_dbgnode *dbgnodes;
66 66
   unsigned dbgnode_cnt;
67 67
   unsigned hook_lsig_id;
... ...
@@ -39,8 +39,8 @@ typedef uint16_t funcid_t;
39 39
 struct cli_bc_callop {
40 40
     operand_t* ops;
41 41
     uint16_t* opsizes;
42
-    uint8_t numOps;
43 42
     funcid_t funcid;
43
+    uint8_t numOps;
44 44
 };
45 45
 
46 46
 struct branch {
... ...
@@ -59,8 +59,8 @@ typedef uint8_t interp_op_t;
59 59
 struct cli_bc_inst {
60 60
     enum bc_opcode opcode;
61 61
     uint16_t type;
62
-    interp_op_t interp_op;/* opcode for interpreter */
63 62
     operand_t dest;
63
+    interp_op_t interp_op;/* opcode for interpreter */
64 64
     union {
65 65
 	operand_t unaryop;
66 66
 	struct cli_bc_cast cast;
... ...
@@ -96,8 +96,8 @@ struct cli_bc_func {
96 96
 
97 97
 struct cli_bc_dbgnode_element {
98 98
     unsigned nodeid;
99
-    char *string;
100 99
     unsigned len;
100
+    char *string;
101 101
     uint64_t constant;
102 102
 };
103 103
 
... ...
@@ -139,6 +139,8 @@ struct bc_jsnorm {
139 139
 
140 140
 struct cli_bc_ctx {
141 141
     uint8_t timeout;/* must be first byte in struct! */
142
+    uint16_t funcid;
143
+    unsigned numParams;
142 144
     /* id and params of toplevel function called */
143 145
     const struct cli_bc *bc;
144 146
     const struct cli_bc_func *func;
... ...
@@ -147,43 +149,41 @@ struct cli_bc_ctx {
147 147
     uint16_t *opsizes;
148 148
     char *values;
149 149
     operand_t *operands;
150
-    uint16_t funcid;
151
-    unsigned numParams;
152 150
     uint32_t file_size;
151
+    int outfd;
153 152
     off_t off;
154 153
     fmap_t *fmap;
155 154
     fmap_t *save_map;
156 155
     const char *virname;
157 156
     struct cli_bc_hooks hooks;
158 157
     const struct cli_exe_section *sections;
159
-    int outfd;
160 158
     char *tempfile;
161 159
     void *ctx;
162 160
     unsigned written;
163 161
     unsigned filewritten;
164 162
     unsigned found;
163
+    unsigned ninflates;
165 164
     bc_dbg_callback_trace trace;
166 165
     bc_dbg_callback_trace_op trace_op;
167 166
     bc_dbg_callback_trace_val trace_val;
168 167
     bc_dbg_callback_trace_ptr trace_ptr;
169
-    unsigned trace_level;
170 168
     const char *directory;
171 169
     const char *file;
172 170
     const char *scope;
171
+    unsigned trace_level;
173 172
     uint32_t scopeid;
174 173
     unsigned line;
175 174
     unsigned col;
176 175
     mpool_t *mpool;
177 176
     struct bc_inflate* inflates;
178
-    unsigned ninflates;
179 177
     struct bc_buffer *buffers;
180 178
     unsigned nbuffers;
181
-    struct cli_hashset *hashsets;
182 179
     unsigned nhashsets;
183
-    struct bc_jsnorm* jsnorms;
184 180
     unsigned njsnorms;
185
-    char *jsnormdir;
186 181
     unsigned jsnormwritten;
182
+    struct cli_hashset *hashsets;
183
+    struct bc_jsnorm* jsnorms;
184
+    char *jsnormdir;
187 185
     struct cli_map *maps;
188 186
     unsigned nmaps;
189 187
     unsigned containertype;
... ...
@@ -199,8 +199,8 @@ struct stack_entry {
199 199
     struct stack_entry *prev;
200 200
     const struct cli_bc_func *func;
201 201
     operand_t ret;
202
-    struct cli_bc_bb *bb;
203 202
     unsigned bb_inst;
203
+    struct cli_bc_bb *bb;
204 204
     char *values;
205 205
 };
206 206
 
... ...
@@ -64,10 +64,10 @@ struct cli_ac_patt {
64 64
     uint16_t parts, partno, special, special_pattern;
65 65
     struct cli_ac_special **special_table;
66 66
     struct cli_ac_patt *next, *next_same;
67
-    uint8_t depth;
68 67
     uint16_t rtype, type;
69 68
     uint32_t offdata[4], offset_min, offset_max;
70 69
     uint32_t boundary;
70
+    uint8_t depth;
71 71
 };
72 72
 
73 73
 struct cli_ac_node {
... ...
@@ -52,6 +52,7 @@ struct cli_lsig_tdb {
52 52
     uint32_t *val, *range;
53 53
     char *str;
54 54
     uint32_t cnt[3];
55
+    uint32_t subsigs;
55 56
 
56 57
     const uint32_t *target;
57 58
     const uint32_t *engine, *nos, *ep, *filesize;
... ...
@@ -62,7 +63,6 @@ struct cli_lsig_tdb {
62 62
     */
63 63
     const char *icongrp1, *icongrp2;
64 64
     uint32_t *macro_ptids;
65
-    uint32_t subsigs;
66 65
 #ifdef USE_MPOOL
67 66
     mpool_t *mempool;
68 67
 #endif
... ...
@@ -71,10 +71,10 @@ struct cli_lsig_tdb {
71 71
 struct cli_bc;
72 72
 struct cli_ac_lsig {
73 73
     uint32_t id;
74
+    unsigned bc_idx;
74 75
     char *logic;
75 76
     const char *virname;
76 77
     struct cli_lsig_tdb tdb;
77
-    unsigned bc_idx;
78 78
 };
79 79
 
80 80
 struct cli_matcher {
... ...
@@ -121,10 +121,10 @@ struct pdf_obj {
121 121
 struct pdf_struct {
122 122
     struct pdf_obj *objs;
123 123
     unsigned nobjs;
124
+    unsigned flags;
124 125
     const char *map;
125 126
     off_t size;
126 127
     off_t offset;
127
-    unsigned flags;
128 128
     cli_ctx *ctx;
129 129
     const char *dir;
130 130
     unsigned files;