Skip to content

Commit 2e24382

Browse files
committed
RExC_state_t: reorder to eliminate holes
This combined with the previous previous commits on this branch takes the struct down from 416 bytes including 9 bytes of holes to 384 bytes with only one byte of holes on a 64-bit Linux debuging build.
1 parent 1e9a5f6 commit 2e24382

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

regcomp_internal.h

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ struct RExC_state_t {
5454
regnode_offset emit; /* Code-emit pointer */
5555
I32 naughty; /* How bad is this pattern? */
5656
bool sawback; /* Did we see \1, ...? */
57+
58+
bool utf8; /* whether the pattern is utf8 or not */
59+
bool orig_utf8; /* whether the pattern was originally in utf8 */
60+
/* XXX use this for future optimisation of case
61+
* where pattern must be upgraded to utf8. */
62+
bool uni_semantics; /* If a d charset modifier should use unicode
63+
rules, even if the pattern is not in
64+
utf8 */
65+
5766
SSize_t size; /* Number of regnode equivalents in
5867
pattern */
5968
Size_t sets_depth; /* Counts recursion depth of already-
@@ -127,37 +136,29 @@ struct RExC_state_t {
127136
accept */
128137
I32 seen_zerolen;
129138
regnode *end_op; /* END node in program */
130-
bool utf8; /* whether the pattern is utf8 or not */
131-
bool orig_utf8; /* whether the pattern was originally in utf8 */
132-
/* XXX use this for future optimisation of case
133-
* where pattern must be upgraded to utf8. */
134-
bool uni_semantics; /* If a d charset modifier should use unicode
135-
rules, even if the pattern is not in
136-
utf8 */
137-
139+
bool in_lookaround;
140+
bool contains_locale;
141+
bool recode_x_to_native;
142+
bool in_multi_char_class;
138143
I32 recurse_count; /* Number of recurse regops we have generated */
139144
regnode **recurse; /* Recurse regops */
140145
U8 *study_chunk_recursed; /* bitmap of which subs we have moved
141146
through */
142147
U32 study_chunk_recursed_bytes; /* bytes in bitmap */
143-
bool in_lookaround;
144-
bool contains_locale;
145-
bool recode_x_to_native;
146-
bool in_multi_char_class;
147148
int code_index; /* next code_blocks[] slot */
148149
struct reg_code_blocks *code_blocks;/* positions of literal (?{})
149150
within pattern */
150151
SSize_t maxlen; /* minimum possible number of chars in string to match */
151152
scan_frame *frame_head;
152153
scan_frame *frame_last;
153154
U32 frame_count;
154-
AV *warn_text;
155-
HV *unlexed_names;
156-
SV *runtime_code_qr; /* qr with the runtime code blocks */
157155
bool seen_d_op;
158156
bool strict;
159157
bool study_started;
160158
bool in_script_run;
159+
AV *warn_text;
160+
HV *unlexed_names;
161+
SV *runtime_code_qr; /* qr with the runtime code blocks */
161162
bool use_BRANCHJ;
162163
bool sWARN_EXPERIMENTAL__VLB;
163164
bool sWARN_EXPERIMENTAL__REGEX_SETS;
@@ -170,12 +171,12 @@ struct RExC_state_t {
170171
* See GH Issue #21558 and also ba6e2c38aafc23cf114f3ba0d0ff3baead34328b
171172
*/
172173
#if defined(DEBUGGING) || !defined(USE_DYNAMIC_LOADING)
173-
const char *lastparse;
174174
I32 lastnum;
175-
U32 study_chunk_recursed_count;
175+
const char *lastparse;
176176
AV *paren_name_list; /* idx -> name */
177177
SV *mysv1;
178178
SV *mysv2;
179+
U32 study_chunk_recursed_count;
179180
#endif
180181
};
181182

0 commit comments

Comments
 (0)