Skip to content

Commit 3a420a5

Browse files
committed
Use named fields for match frame members
1 parent 574f568 commit 3a420a5

File tree

2 files changed

+231
-116
lines changed

2 files changed

+231
-116
lines changed

src/pcre2_intmodedep.h

Lines changed: 113 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -891,16 +891,12 @@ we don't generate any code when all is well. */
891891
typedef struct heapframe {
892892

893893
/* The first set of fields are variables that have to be preserved over calls
894-
to RRMATCH(), but which do not need to be copied to new frames. */
894+
to RMATCH(), but which do not need to be copied to new frames. */
895895

896896
PCRE2_SPTR ecode; /* The current position in the pattern */
897-
PCRE2_SPTR temp_sptr[2]; /* Used for short-term PCRE2_SPTR values */
898-
PCRE2_SIZE length; /* Used for character, string, or code lengths */
899897
PCRE2_SIZE back_frame; /* Amount to subtract on RRETURN */
900-
PCRE2_SIZE temp_size; /* Used for short-term PCRE2_SIZE values */
901898
uint32_t rdepth; /* Function "recursion" depth within pcre2_match() */
902899
uint32_t group_frame_type; /* Type information for group frames */
903-
uint32_t temp_32[4]; /* Used for short-term 32-bit or BOOL values */
904900
uint8_t return_id; /* Where to go on in internal "return" */
905901
uint8_t op; /* Processing opcode */
906902

@@ -924,6 +920,118 @@ typedef struct heapframe {
924920
PCRE2_UCHAR occu[1]; /* Used for other case code units */
925921
#endif
926922

923+
union {
924+
struct {
925+
PCRE2_SIZE length;
926+
} op_char;
927+
928+
struct {
929+
PCRE2_SIZE length;
930+
PCRE2_SIZE oclength;
931+
PCRE2_SPTR start_eptr;
932+
PCRE2_SPTR charptr;
933+
uint32_t min;
934+
uint32_t max;
935+
uint32_t c;
936+
uint32_t oc;
937+
} char_repeat;
938+
939+
struct {
940+
PCRE2_SPTR start_eptr;
941+
uint32_t min;
942+
uint32_t max;
943+
uint32_t c;
944+
uint32_t oc;
945+
} charnot_repeat;
946+
947+
struct {
948+
PCRE2_SPTR start_eptr;
949+
PCRE2_SPTR byte_map_address;
950+
uint32_t min;
951+
uint32_t max;
952+
} class_repeat;
953+
954+
struct {
955+
PCRE2_SPTR start_eptr;
956+
PCRE2_SPTR xclass_data;
957+
uint32_t min;
958+
uint32_t max;
959+
} xclass_repeat;
960+
961+
struct {
962+
PCRE2_SPTR start_eptr;
963+
PCRE2_SPTR eclass_data;
964+
PCRE2_SIZE eclass_len;
965+
uint32_t min;
966+
uint32_t max;
967+
} eclass_repeat;
968+
969+
struct {
970+
PCRE2_SPTR start_eptr;
971+
uint32_t min;
972+
uint32_t max;
973+
uint32_t ctype;
974+
uint32_t propvalue;
975+
} type_repeat;
976+
977+
struct {
978+
PCRE2_SPTR start;
979+
PCRE2_SIZE offset;
980+
PCRE2_SIZE length;
981+
uint32_t min;
982+
uint32_t max;
983+
uint32_t caseless;
984+
uint32_t caseopts;
985+
} ref_repeat;
986+
987+
struct {
988+
PCRE2_SPTR next_branch;
989+
uint32_t frame_type;
990+
} op_bra;
991+
992+
struct {
993+
PCRE2_SPTR next_ecode;
994+
} op_brazero;
995+
996+
struct {
997+
PCRE2_SPTR start_eptr;
998+
PCRE2_SPTR start_group;
999+
uint32_t frame_type;
1000+
uint32_t matched_once;
1001+
uint32_t zero_allowed;
1002+
} op_brapos;
1003+
1004+
struct {
1005+
PCRE2_SPTR start_branch;
1006+
uint32_t frame_type;
1007+
} op_recurse;
1008+
1009+
struct {
1010+
uint32_t frame_type;
1011+
} op_assert;
1012+
1013+
struct {
1014+
PCRE2_SPTR saved_end_subject;
1015+
PCRE2_SPTR saved_eptr;
1016+
PCRE2_SIZE true_end_extra;
1017+
uint32_t frame_type;
1018+
uint32_t extra_size;
1019+
uint32_t saved_moptions;
1020+
} op_assert_scs;
1021+
1022+
struct {
1023+
PCRE2_SPTR start_branch;
1024+
PCRE2_SIZE length;
1025+
uint32_t positive;
1026+
} op_cond;
1027+
1028+
struct {
1029+
PCRE2_SPTR eptr;
1030+
uint32_t min;
1031+
uint32_t max;
1032+
} op_vreverse;
1033+
};
1034+
9271035
/* The rest have to be copied from the previous frame whenever a new frame
9281036
becomes current. The final field is specified as a large vector so that
9291037
runtime array bound checks don't catch references to it. However, for any

0 commit comments

Comments
 (0)