Skip to content

Commit 43c851e

Browse files
committed
cdata: Add a few comments about internal structs.
1 parent b7a3ffc commit 43c851e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/libfsm/print/cdata.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434

3535
/* Print mode that generates C data literals for the DFA, plus a small interepreter.
3636
* This mostly exists to sidestep very expensive compilation for large data sets
37-
* using the other C modes. -sv */
37+
* using the other C modes. When they generate long runs of nested switch/case
38+
* statements, gcc and clang spend lots of time and RAM on analyzing them, and it
39+
* can lead to builds taking several hours or even OOM-ing. -sv */
3840

3941
/* Whether to check the table buffers for previous instances of
4042
* the same sets of dst_states, endids, and eager_outputs. This
@@ -125,26 +127,32 @@ struct cdata_config {
125127
/* numeric type for entries in .bitset_words.pairs[] */
126128
enum id_type t_label_word_id;
127129

130+
/* buffer for edge destination states */
128131
struct dst_buf {
129132
size_t ceil;
130133
size_t used;
131134
uint32_t *buf;
132135
} dst_buf;
133136

137+
/* buffer for endids */
134138
struct endid_buf {
135139
size_t ceil;
136140
size_t used;
137141
unsigned *buf;
138142
} endid_buf;
139143
size_t max_endid;
140144

145+
/* buffer for eager output IDs */
141146
struct eager_output_buf {
142147
size_t ceil;
143148
size_t used;
144149
uint64_t *buf;
145150
} eager_output_buf;
146151
size_t max_eager_output_id;
147152

153+
/* Collection of distinct eager output IDs, in ascending order.
154+
* This is used to map sequentially allocated internal IDs to the
155+
* caller's eager output IDs, which are just arbitrary integers. */
148156
fsm_output_id_t *eager_output_ids;
149157
size_t distinct_eager_output_id_count;
150158

0 commit comments

Comments
 (0)