dds_analyze.c

filter: Statementstmt 97.0% 361 / 372 Branchbran 82.5% 261 / 316 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 90.4% 622 / 688 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« dds_engine.c ↑ Summary
1 #include "dds_engine.h"
2  
3 /*
4 * Breadth-first analysis
5 *
6 * Scalar slots and their referents have distinct catalogue roles. Queue depths
7 * count both visits. Depth buckets choose canonical names at minimum depth
8 * before depth-first emission chooses where to construct referents.
9 *
10 * Seed every root, drain the shallowest pending queue level, then reconcile
11 * discovered closure roots. New roots or improved names restart analysis
12 * before the catalogue is published.
13 */
14  
15 /* Record a scalar slot's canonical name, depth and alias properties when it
16 * may be shared; forced roots are always catalogued.
17 */
18 11828 static void dds_register_slot(pTHX_ dds_ctx *ctx, SV *sv, UV depth, SV *name, UV count, bool force)
19 {
20 dds_node *node;
21 dds_role *role;
22  
23 11828 ▶ if (!force && !dds_candidate(aTHX_ sv))
Branch: 2 branches
BranchTrueFalseTotal
if (!force && !dds_candidate(aTHX_ sv)) 9867 1961 11828
if (!force && !dds_candidate(aTHX_ sv)) 8589 1278 9867
24 8589 return;
25  
26 3239 node = dds_find(aTHX_ ctx, sv, TRUE);
27 3239 role = &node->slot;
28 3239 ▶ if (!role->present) {
Branch: 1 branch
BranchTrueFalseTotal
if (!role->present) { 2625 614 3239
29 2625 SV *clean = dds_clean_name(aTHX_ name);
30  
31 2625 role->present = TRUE;
32 2625 role->name = newSVsv(clean);
33 2625 ▶ if (sv_cmp(clean, name))
Branch: 1 branch
BranchTrueFalseTotal
if (sv_cmp(clean, name)) 148 2477 2625
34 148 role->original = newSVsv(name);
35 2625 role->depth = depth;
36 2625 role->count = count;
37 2625 role->readonly = cBOOL(SvREADONLY(sv));
38 2625 ▶ role->weak = SvROK(sv) && SvWEAKREF(sv);
Branch: 2 branches
BranchTrueFalseTotal
role->weak = SvROK(sv) && SvWEAKREF(sv); 1620 1005 2625
role->weak = SvROK(sv) && SvWEAKREF(sv); 46 1574 1620
39 } else {
40 1228 ▶ const char *old = DDS_PV(role->name), *new_name = DDS_PV(name);
Branch: 1 branch
BranchTrueFalseTotal
const char *old = DDS_PV(role->name), *new_name = DDS_PV(name); 614 0 614
41  
42 /* Prefer a direct slot name over an equally deep dereference. */
43 614 ▶ if (role->depth == depth && old[0] == '$' &&
Branch: 2 branches
BranchTrueFalseTotal
if (role->depth == depth && old[0] == '$' && 367 247 614
if (role->depth == depth && old[0] == '$' && 359 8 367
44 359 ▶ (old[1] == '$' || (old[1] == '{' && old[2] == '$')) &&
Branch: 3 branches
BranchTrueFalseTotal
(old[1] == '$' || (old[1] == '{' && old[2] == '$')) && 347 12 359
(old[1] == '$' || (old[1] == '{' && old[2] == '$')) && 0 347 347
(old[1] == '$' || (old[1] == '{' && old[2] == '$')) && 0 0 0
45 12 ▶ !(new_name[0] == '$' &&
Branch: 1 branch
BranchTrueFalseTotal
!(new_name[0] == '$' && 12 0 12
46 12 ▶ (new_name[1] == '$' || (new_name[1] == '{' && new_name[2] == '$'))))
Branch: 3 branches
BranchTrueFalseTotal
(new_name[1] == '$' || (new_name[1] == '{' && new_name[2] == '$')))) 12 0 12
(new_name[1] == '$' || (new_name[1] == '{' && new_name[2] == '$')))) 0 12 12
(new_name[1] == '$' || (new_name[1] == '{' && new_name[2] == '$')))) 0 0 0
47 12 sv_setsv(role->name, name);
48 }
49  
50 3239 role->encounters++;
51 }
52  
53 /* Queue a borrowed value at its traversal depth, owning a copy of its path and
54 * retaining the value if callbacks have already been enabled.
55 */
56 10806 static void dds_enqueue(pTHX_ dds_ctx *ctx, SV *sv, UV depth, SV *name, bool direct)
57 {
58 dds_queue_entry *entry;
59 dds_queue_level *level;
60 10806 UV position = ctx->queue_count;
61 10806 bool empty = ctx->queue_head == ctx->queue_count;
62  
63 10806 ▶ if (ctx->queue_count == ctx->queue_capacity) {
Branch: 1 branch
BranchTrueFalseTotal
if (ctx->queue_count == ctx->queue_capacity) { 706 10100 10806
64 706 ▶ ctx->queue_capacity = ctx->queue_capacity ? ctx->queue_capacity * 2 : 64;
Branch: 1 branch
BranchTrueFalseTotal
ctx->queue_capacity = ctx->queue_capacity ? ctx->queue_capacity * 2 : 64; 62 644 706
65 706 ▶ Renew(ctx->queue, ctx->queue_capacity, dds_queue_entry);
Branch: 1 branch
BranchTrueFalseTotal
Renew(ctx->queue, ctx->queue_capacity, dds_queue_entry); 0 706 706
66 }
67  
68 10806 entry = &ctx->queue[ctx->queue_count++];
69 10806 entry->sv = sv;
70 10806 entry->depth = depth;
71 10806 entry->name = newSVsv(name);
72 10806 entry->direct = direct;
73 10806 entry->next = 0;
74  
75 10806 ▶ if (depth >= ctx->queue_level_capacity) {
Branch: 1 branch
BranchTrueFalseTotal
if (depth >= ctx->queue_level_capacity) { 663 10143 10806
76 663 ▶ UV old = ctx->queue_level_capacity, capacity = old ? old : 16;
Branch: 1 branch
BranchTrueFalseTotal
UV old = ctx->queue_level_capacity, capacity = old ? old : 16; 19 644 663
77  
78 682 ▶ while (capacity <= depth)
Branch: 1 branch
BranchTrueFalseTotal
while (capacity <= depth) 19 663 682
79 19 capacity *= 2;
80 663 ▶ Renew(ctx->queue_levels, capacity, dds_queue_level);
Branch: 1 branch
BranchTrueFalseTotal
Renew(ctx->queue_levels, capacity, dds_queue_level); 0 663 663
81 663 ▶ Zero(ctx->queue_levels + old, capacity - old, dds_queue_level);
Branch: 1 branch
BranchTrueFalseTotal
Zero(ctx->queue_levels + old, capacity - old, dds_queue_level); 0 663 663
82 663 ctx->queue_level_capacity = capacity;
83 }
84  
85 /* Glob slots add a different depth offset from ordinary children.
86 * FIFO within each depth keeps first-name ties stable while ensuring
87 * that no referent expands before a shorter queued route to it. */
88 10806 level = &ctx->queue_levels[depth];
89 10806 ▶ if (level->tail)
Branch: 1 branch
BranchTrueFalseTotal
if (level->tail) 6858 3948 10806
90 6858 ctx->queue[level->tail - 1].next = position + 1;
91 else
92 3948 level->head = position + 1;
93 10806 level->tail = position + 1;
94  
95 10806 ▶ if (empty || depth < ctx->queue_depth)
Branch: 2 branches
BranchTrueFalseTotal
if (empty || depth < ctx->queue_depth) 7585 3221 10806
if (empty || depth < ctx->queue_depth) 6 7579 7585
96 3227 ctx->queue_depth = depth;
97 10806 ▶ if (ctx->queue_count - ctx->queue_head > ctx->queue_peak)
Branch: 1 branch
BranchTrueFalseTotal
if (ctx->queue_count - ctx->queue_head > ctx->queue_peak) 6216 4590 10806
98 6216 ctx->queue_peak = ctx->queue_count - ctx->queue_head;
99  
100 10806 ▶ if (ctx->callbacks)
Branch: 1 branch
BranchTrueFalseTotal
if (ctx->callbacks) 730 10076 10806
101 730 av_push(ctx->keepalive, SvREFCNT_inc(sv));
102 10806 }
103  
104 /* Remove the next item from the shallowest nonempty depth bucket, preserving
105 * FIFO order among paths at that depth.
106 */
107 10806 static UV dds_dequeue(dds_ctx *ctx)
108 {
109 dds_queue_level *level;
110 UV position;
111  
112 12074 ▶ while (!ctx->queue_levels[ctx->queue_depth].head)
Branch: 1 branch
BranchTrueFalseTotal
while (!ctx->queue_levels[ctx->queue_depth].head) 1268 10806 12074
113 1268 ctx->queue_depth++;
114 10806 level = &ctx->queue_levels[ctx->queue_depth];
115 10806 position = level->head - 1;
116 10806 level->head = ctx->queue[position].next;
117 10806 ▶ if (!level->head)
Branch: 1 branch
BranchTrueFalseTotal
if (!level->head) 3948 6858 10806
118 3948 level->tail = 0;
119 10806 ctx->queue_head++;
120  
121 10806 return position;
122 }
123  
124 /* Return the borrowed scalar, hash, array, code or format slot selected from a
125 * glob, without creating an absent slot.
126 */
127 665 static SV *dds_glob_slot(pTHX_ GV *gv, UV slot)
128 {
129 665 switch (slot) {
130 133 case 0:
131 133 return GvSV(gv);
132 133 case 1:
133 133 return (SV *)GvHV(gv);
134 133 case 2:
135 133 return (SV *)GvAV(gv);
136 133 case 3:
137 133 return (SV *)GvCV(gv);
138 133 case 4:
139 133 return (SV *)GvFORM(gv);
140 }
141 0 return NULL;
142 }
143  
144 /* Schedule a reference or magical scalar for inspection, or schedule the
145 * enabled slots of a directly encountered glob.
146 */
147 11858 static void dds_enqueue_value(pTHX_ dds_ctx *ctx, SV *sv, UV depth, SV *name)
148 {
149 11858 ▶ if (SvROK(sv) || SvGMAGICAL(sv))
Branch: 2 branches
BranchTrueFalseTotal
if (SvROK(sv) || SvGMAGICAL(sv)) 1211 10647 11858
if (SvROK(sv) || SvGMAGICAL(sv)) 9 1202 1211
150 10656 dds_enqueue(aTHX_ ctx, sv, depth, name, FALSE);
151 1202 ▶ else if (SvTYPE(sv) == SVt_PVGV && ctx->style.dumpglob) {
Branch: 2 branches
BranchTrueFalseTotal
else if (SvTYPE(sv) == SVt_PVGV && ctx->style.dumpglob) { 136 1066 1202
else if (SvTYPE(sv) == SVt_PVGV && ctx->style.dumpglob) { 133 3 136
152 133 ▶ UV i, limit = ctx->style.deparse && ctx->style.deparseglob ? 5 : 3;
Branch: 2 branches
BranchTrueFalseTotal
UV i, limit = ctx->style.deparse && ctx->style.deparseglob ? 5 : 3; 133 0 133
UV i, limit = ctx->style.deparse && ctx->style.deparseglob ? 5 : 3; 133 0 133
153 static const char *slots[] = {"SCALAR", "HASH", "ARRAY", "CODE", "FORMAT"};
154 133 SV *glob_name = dds_glob_name(aTHX_(GV *) sv);
155  
156 133 ▶ if (strnEQ(DDS_PV(glob_name), "*Symbol::GEN", 12)) {
Branch: 1 branch
BranchTrueFalseTotal
if (strnEQ(DDS_PV(glob_name), "*Symbol::GEN", 12)) { 66 67 133
157 66 SV *base = dds_underef(aTHX_ name);
158  
159 66 ▶ glob_name = dds_child_name(aTHX_ base ? base : name, '*', NULL, 0);
Branch: 1 branch
BranchTrueFalseTotal
glob_name = dds_child_name(aTHX_ base ? base : name, '*', NULL, 0); 65 1 66
160 }
161  
162 798 ▶ for (i = 0; i < limit; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < limit; i++) { 665 133 798
163 665 SV *value = dds_glob_slot(aTHX_(GV *) sv, i);
164 SV *path;
165  
166 665 ▶ if (!value || (i == 0 && !SvOK(value)))
Branch: 3 branches
BranchTrueFalseTotal
if (!value || (i == 0 && !SvOK(value))) 150 515 665
if (!value || (i == 0 && !SvOK(value))) 24 126 150
if (!value || (i == 0 && !SvOK(value))) 0 24 24
167 515 continue;
168  
169 150 path = DDS_TEMP(newSVsv(glob_name));
170 150 sv_catpvf(path, "{%s}", slots[i]);
171 150 dds_enqueue(aTHX_ ctx, value, depth + 1, path, TRUE);
172 }
173 }
174 11858 }
175  
176 /* Register a child scalar slot and queue its value using the corresponding
177 * path, with scratch values scoped to this visit.
178 */
179 9867 static void dds_analyze_child(pTHX_ dds_ctx *ctx, SV *sv, UV depth, SV *parent, char kind, SV *key,
180 IV child_index)
181 {
182 SV *path;
183  
184 9867 ENTER;
185 9867 SAVETMPS;
186 9867 path = dds_child_name(aTHX_ parent, kind, key, child_index);
187 9867 dds_register_slot(aTHX_ ctx, sv, depth + 1, path, SvREFCNT(sv) + dds_weak_count(aTHX_ sv),
188 FALSE);
189 9867 dds_enqueue_value(aTHX_ ctx, sv, depth + 2, path);
190 9867 ▶ FREETMPS;
Branch: 1 branch
BranchTrueFalseTotal
FREETMPS; 9867 0 9867
191 9867 LEAVE;
192 9867 }
193  
194 #if defined(class_object_to_hash) && defined(PERL_MAGIC_class_storage)
195 /* Choose a private class-field variable name that does not collide with any
196 * current root expression.
197 */
198 static SV *dds_class_fields_name(pTHX_ dds_ctx *ctx)
199 {
200 SV *name = DDS_TEMP(newSV(0));
201 bool conflict;
202  
203 do {
204 UV i;
205 const char *identifier;
206  
207 conflict = FALSE;
208 sv_setpvf(name, "$__DDS_class_fields_%" UVuf, ++ctx->class_serial);
209 identifier = DDS_PV(name) + 1;
210  
211 for (i = 0; i < ctx->root_count; i++) {
212 if (strstr(DDS_PV(ctx->roots[i].name), identifier)) {
213 conflict = TRUE;
214 break;
215 }
216 }
217 } while (conflict);
218  
219 return name;
220 }
221  
222 /* Snapshot XPerl class fields into owned metadata and queue that snapshot
223 * separately from the object's ordinary payload.
224 */
225 static void dds_analyze_class(pTHX_ dds_ctx *ctx, dds_node *node, SV *target, UV depth)
226 {
227 MAGIC *storage;
228 SV *rv;
229  
230 if (!SvOBJECT(target) || !SvMAGICAL(target))
231 return;
232 storage = mg_find(target, PERL_MAGIC_class_storage);
233 if (!storage || !storage->mg_obj)
234 return;
235  
236 /* The snapshot shares field slots with the object. Keep it separate
237 * from the public payload so alias fixups finish before hydration. */
238 rv = DDS_TEMP(newRV_inc(target));
239 node->class_fields = class_object_to_hash(rv);
240 (void)hv_delete((HV *)SvRV(node->class_fields), "$self", 5, G_DISCARD);
241 node->class_fields_name = newSVsv(dds_class_fields_name(aTHX_ ctx));
242 if (strchr("@%&", DDS_PV(node->ref.name)[0]))
243 node->class_package = newSVsv(dds_class(aTHX_ target));
244  
245 if (ctx->class_tail)
246 ctx->class_tail->class_next = node;
247 else
248 ctx->class_head = node;
249 ctx->class_tail = node;
250  
251 dds_enqueue(aTHX_ ctx, node->class_fields, depth + 2, node->class_fields_name, FALSE);
252 }
253 #endif
254  
255 /* Test object-address and class-name ignore policies before expanding a
256 * referent.
257 */
258 10803 static bool dds_ignored(pTHX_ dds_ctx *ctx, SV *target)
259 {
260 10803 HV *style = dds_hash(aTHX_ ctx->object, "style", FALSE);
261 10803 HV *ignore = dds_hash(aTHX_ style, "ignore", FALSE);
262 10803 SV *address = DDS_TEMP(newSVpvf("#%" UVuf, PTR2UV(target)));
263 10803 SV *class_name = dds_class(aTHX_ target);
264  
265 10803 ▶ if (SvTRUE(dds_hget_sv(aTHX_ ignore, address)))
Branch: 1 branch
BranchTrueFalseTotal
if (SvTRUE(dds_hget_sv(aTHX_ ignore, address))) 0 10803 10803
266 0 return TRUE;
267 10803 ▶ if (SvOK(class_name)) {
Branch: 1 branch
BranchTrueFalseTotal
if (SvOK(class_name)) { 531 10272 10803
268 531 SV *key = DDS_TEMP(newSVpvs("."));
269  
270 531 DDS_CAT(key, class_name);
271 531 ▶ if (SvTRUE(dds_hget_sv(aTHX_ ignore, key)))
Branch: 1 branch
BranchTrueFalseTotal
if (SvTRUE(dds_hget_sv(aTHX_ ignore, key))) 4 527 531
272 4 return TRUE;
273 }
274 10799 return FALSE;
275 }
276  
277 /* Discover a closure's captured variables, choose distinct lexical names and
278 * queue their values for graph analysis.
279 */
280 53 static void dds_collect_lexicals(pTHX_ dds_ctx *ctx, SV *target, HV *lexrefs, HV *names, HV *used)
281 {
282 SV *args[1], *result;
283 HV *values;
284 HE *he;
285  
286 53 args[0] = DDS_TEMP(newRV_inc(target));
287 53 result = dds_call(aTHX_ ctx, "Data::Dump::Streamer::_get_lexicals", NULL, G_SCALAR, 1, args);
288 53 ▶ if (!SvROK(result) || SvTYPE(SvRV(result)) != SVt_PVHV)
Branch: 2 branches
BranchTrueFalseTotal
if (!SvROK(result) || SvTYPE(SvRV(result)) != SVt_PVHV) 53 0 53
if (!SvROK(result) || SvTYPE(SvRV(result)) != SVt_PVHV) 0 53 53
289 0 return;
290  
291 53 values = (HV *)SvRV(result);
292 53 hv_iterinit(values);
293 137 ▶ while ((he = hv_iternext(values))) {
Branch: 1 branch
BranchTrueFalseTotal
while ((he = hv_iternext(values))) { 84 53 137
294 84 SV *name = hv_iterkeysv(he), *rv = HeVAL(he), *address;
295 STRLEN len, i;
296 84 const char *p = SvPV(name, len);
297 84 bool numeric = TRUE;
298  
299 84 ▶ if (!SvROK(rv))
Branch: 1 branch
BranchTrueFalseTotal
if (!SvROK(rv)) 0 84 84
300 54 continue;
301  
302 128 ▶ for (i = 0; i < len; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < len; i++) 86 42 128
303 86 ▶ if (!isDIGIT_A(p[i])) {
Branch: 1 branch
BranchTrueFalseTotal
if (!isDIGIT_A(p[i])) { 42 44 86
304 42 numeric = FALSE;
305 42 break;
306 }
307 84 ▶ if (numeric)
Branch: 1 branch
BranchTrueFalseTotal
if (numeric) 42 42 84
308 42 continue;
309  
310 42 address = DDS_TEMP(newSVuv(PTR2UV(SvRV(rv))));
311 42 ▶ if (hv_exists_ent(lexrefs, address, 0))
Branch: 1 branch
BranchTrueFalseTotal
if (hv_exists_ent(lexrefs, address, 0)) 12 30 42
312 12 continue;
313  
314 30 ▶ if (hv_exists_ent(used, name, 0)) {
Branch: 1 branch
BranchTrueFalseTotal
if (hv_exists_ent(used, name, 0)) { 7 23 30
315 7 HV *style = dds_hash(aTHX_ ctx->object, "style", FALSE);
316 7 SV *format = dds_hget(aTHX_ style, "eclipsename");
317 SV *args2[3], *new_name;
318 7 UV n = SvUV(dds_hget_sv(aTHX_ used, name)) + 1;
319  
320 7 hv_store_ent(used, name, newSVuv(n), 0);
321 7 args2[0] = name;
322 7 args2[1] = format;
323 7 args2[2] = DDS_TEMP(newSVuv(n));
324 7 new_name = dds_call(aTHX_ ctx, "Data::Dump::Streamer::_xs_eclipse_name", NULL, G_SCALAR,
325 3, args2);
326 7 name = new_name;
327 } else
328 23 hv_store_ent(used, name, newSVuv(0), 0);
329  
330 30 hv_store_ent(lexrefs, address, newSVsv(rv), 0);
331 30 hv_store_ent(names, address, newSVsv(name), 0);
332 30 hv_store_ent(ctx->lexical_names, address, newSVsv(name), 0);
333 30 dds_enqueue_value(aTHX_ ctx, rv, 2, name);
334 }
335 }
336  
337 /* Visit existing array slots, counting all visits but registering and
338 * expanding only values that need graph analysis.
339 */
340 3148 static void dds_analyze_array(pTHX_ dds_ctx *ctx, SV *target, UV depth, SV *name)
341 {
342 SSize_t k, last;
343  
344 3148 ▶ if (SvTIED_mg(target, PERL_MAGIC_tied))
Branch: 2 branches
BranchTrueFalseTotal
if (SvTIED_mg(target, PERL_MAGIC_tied)) 284 2864 3148
if (SvTIED_mg(target, PERL_MAGIC_tied)) 1 283 284
345 1 dds_callback_guard(aTHX_ ctx);
346 3148 last = av_len((AV *)target);
347 10936 ▶ for (k = 0; k <= last; k++) {
Branch: 1 branch
BranchTrueFalseTotal
for (k = 0; k <= last; k++) { 7788 3148 10936
348 7788 SV **value = av_fetch((AV *)target, k, 0);
349  
350 7788 ▶ if (!value)
Branch: 1 branch
BranchTrueFalseTotal
if (!value) 0 7788 7788
351 0 continue;
352  
353 7788 ctx->visits++;
354 7788 ▶ if (!dds_candidate(aTHX_ * value) && !SvROK(*value) && !SvGMAGICAL(*value) &&
Branch: 3 branches
BranchTrueFalseTotal
if (!dds_candidate(aTHX_ * value) && !SvROK(*value) && !SvGMAGICAL(*value) && 7078 710 7788
if (!dds_candidate(aTHX_ * value) && !SvROK(*value) && !SvGMAGICAL(*value) && 1561 5517 7078
if (!dds_candidate(aTHX_ * value) && !SvROK(*value) && !SvGMAGICAL(*value) && 1558 3 1561
355 1558 ▶ SvTYPE(*value) != SVt_PVGV)
Branch: 1 branch
BranchTrueFalseTotal
SvTYPE(*value) != SVt_PVGV) 1558 0 1558
356 1558 continue;
357 6230 dds_analyze_child(aTHX_ ctx, *value, depth, name, '[', NULL, k);
358 }
359 3148 }
360  
361 /* Visit hash values in the selected key order, retaining any thaw action and
362 * measuring key widths for later alignment.
363 */
364 1723 static void dds_analyze_hash(pTHX_ dds_ctx *ctx, dds_node *node, SV *target, UV depth, SV *name)
365 {
366 1723 SV *thaw = NULL;
367 1723 AV *keys = dds_keys(aTHX_ ctx, (HV *)target, 0, &thaw);
368 SSize_t k;
369 1722 UV max = 0, sum = 0, count = 0;
370  
371 1722 ▶ if (thaw) {
Branch: 1 branch
BranchTrueFalseTotal
if (thaw) { 0 1722 1722
372 0 ▶ if (!node)
Branch: 1 branch
BranchTrueFalseTotal
if (!node) 0 0 0
373 0 node = dds_find(aTHX_ ctx, target, TRUE);
374 0 SvREFCNT_dec(node->thaw);
375 0 node->thaw = newSVsv(thaw);
376 }
377  
378 18478 ▶ for (k = 0; k <= av_len(keys); k++) {
Branch: 1 branch
BranchTrueFalseTotal
for (k = 0; k <= av_len(keys); k++) { 16756 1722 18478
379 16756 SV **key = av_fetch(keys, k, 0);
380 HE *he;
381 SV *value;
382  
383 16756 ▶ if (!key || !SvOK(*key))
Branch: 2 branches
BranchTrueFalseTotal
if (!key || !SvOK(*key)) 16756 0 16756
if (!key || !SvOK(*key)) 16756 0 16756
384 break;
385 16756 he = hv_fetch_ent((HV *)target, *key, 0, 0);
386 16756 ▶ value = he ? HeVAL(he) : &PL_sv_undef;
Branch: 1 branch
BranchTrueFalseTotal
value = he ? HeVAL(he) : &PL_sv_undef; 16756 0 16756
387 16756 ctx->visits++;
388  
389 16756 ▶ if (ctx->style.indentkeys) {
Branch: 1 branch
BranchTrueFalseTotal
if (ctx->style.indentkeys) { 16756 0 16756
390 STRLEN width;
391  
392 16756 ENTER;
393 16756 SAVETMPS;
394 16756 width = sv_len_utf8(dds_quote(aTHX_ * key, TRUE));
395 16756 sum += width;
396 16756 ▶ if (max < width)
Branch: 1 branch
BranchTrueFalseTotal
if (max < width) 2066 14690 16756
397 2066 max = width;
398 16756 ▶ FREETMPS;
Branch: 1 branch
BranchTrueFalseTotal
FREETMPS; 16756 0 16756
399 16756 LEAVE;
400 }
401  
402 16756 count++;
403 16756 ▶ if (!dds_candidate(aTHX_ value) && !SvROK(value) && !SvGMAGICAL(value) &&
Branch: 3 branches
BranchTrueFalseTotal
if (!dds_candidate(aTHX_ value) && !SvROK(value) && !SvGMAGICAL(value) && 16722 34 16756
if (!dds_candidate(aTHX_ value) && !SvROK(value) && !SvGMAGICAL(value) && 13821 2901 16722
if (!dds_candidate(aTHX_ value) && !SvROK(value) && !SvGMAGICAL(value) && 13819 2 13821
404 13819 ▶ SvTYPE(value) != SVt_PVGV)
Branch: 1 branch
BranchTrueFalseTotal
SvTYPE(value) != SVt_PVGV) 13816 3 13819
405 13816 continue;
406 2940 dds_analyze_child(aTHX_ ctx, value, depth, name, '{', *key, 0);
407 }
408  
409 1722 ▶ if (node) {
Branch: 1 branch
BranchTrueFalseTotal
if (node) { 1006 716 1722
410 1006 ▶ NV avg = count ? (NV)sum / count : 0;
Branch: 1 branch
BranchTrueFalseTotal
NV avg = count ? (NV)sum / count : 0; 992 14 1006
411  
412 1006 ▶ node->key_width = max > 8 && (2.0 / 3.0 * max) > avg ? (UV)(0.5 + avg) : max;
Branch: 2 branches
BranchTrueFalseTotal
node->key_width = max > 8 && (2.0 / 3.0 * max) > avg ? (UV)(0.5 + avg) : max; 0 1006 1006
node->key_width = max > 8 && (2.0 / 3.0 * max) > avg ? (UV)(0.5 + avg) : max; 0 0 0
413 1006 node->key_count = count;
414 }
415 1722 }
416  
417 /* Analyze one queued value in its own temporary scope. Callback guards retain
418 * live traversal work before Perl code can mutate the graph. */
419 10806 static void dds_analyze_entry(pTHX_ dds_ctx *ctx, UV position, UV pass, HV *lexrefs, HV *lexnames,
420 HV *used_names)
421 {
422 10806 dds_queue_entry entry = ctx->queue[position];
423 dds_active active;
424 10806 SV *target, *name = entry.name;
425 10806 UV depth = entry.depth;
426 10806 dds_node *node = NULL;
427 10806 bool replacement = FALSE;
428  
429 10806 ENTER;
430 10806 SAVETMPS;
431  
432 /* Transfer this queue entry's name to the work-item scope.
433 * Nodes and newly queued entries take their own copies. */
434 10806 ctx->queue[position].name = NULL;
435 10806 DDS_TEMP(name);
436 10806 Zero(&active, 1, dds_active);
437 10806 active.sv = entry.sv;
438 10806 ctx->active = &active;
439 10806 ctx->visits++;
440  
441 10808 ▶ if (strnEQ(DDS_PV(name), "*DB::args", 9) && (DDS_PV(name)[9] == '\0' || DDS_PV(name)[9] == '{'))
Branch: 3 branches
BranchTrueFalseTotal
if (strnEQ(DDS_PV(name), "*DB::args", 9) && (DDS_PV(name)[9] == '\0' || DDS_PV(name)[9] == '{')) 1 10805 10806
if (strnEQ(DDS_PV(name), "*DB::args", 9) && (DDS_PV(name)[9] == '\0' || DDS_PV(name)[9] == '{')) 1 0 1
if (strnEQ(DDS_PV(name), "*DB::args", 9) && (DDS_PV(name)[9] == '\0' || DDS_PV(name)[9] == '{')) 0 1 1
442 0 goto entry_done;
443  
444 10806 ▶ if (SvGMAGICAL(entry.sv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (SvGMAGICAL(entry.sv)) { 10 10796 10806
445 10 av_push(ctx->keepalive, SvREFCNT_inc(entry.sv));
446 10 dds_callback_guard(aTHX_ ctx);
447 10 mg_get(entry.sv);
448 }
449  
450 10806 ▶ if (!entry.direct && !SvROK(entry.sv))
Branch: 2 branches
BranchTrueFalseTotal
if (!entry.direct && !SvROK(entry.sv)) 10656 150 10806
if (!entry.direct && !SvROK(entry.sv)) 3 10653 10656
451 3 goto entry_done;
452 10803 ▶ target = entry.direct ? entry.sv : SvRV(entry.sv);
Branch: 1 branch
BranchTrueFalseTotal
target = entry.direct ? entry.sv : SvRV(entry.sv); 150 10653 10803
453 10803 ▶ if (dds_ignored(aTHX_ ctx, target))
Branch: 1 branch
BranchTrueFalseTotal
if (dds_ignored(aTHX_ ctx, target)) 4 10799 10803
454 4 goto entry_done;
455  
456 /* Resolve a freezer once per object, then analyze its proxy. */
457 10799 ▶ if (SvOBJECT(target)) {
Branch: 1 branch
BranchTrueFalseTotal
if (SvOBJECT(target)) { 527 10272 10799
458 SV *args[1], *frozen;
459  
460 527 node = dds_find(aTHX_ ctx, target, TRUE);
461 527 ▶ if (node->frozen)
Branch: 1 branch
BranchTrueFalseTotal
if (node->frozen) 180 347 527
462 190 goto entry_done;
463 347 node->frozen = TRUE;
464 347 ▶ args[0] = entry.direct ? DDS_TEMP(newRV_inc(target)) : entry.sv;
Branch: 1 branch
BranchTrueFalseTotal
args[0] = entry.direct ? DDS_TEMP(newRV_inc(target)) : entry.sv; 27 320 347
465 347 av_push(ctx->keepalive, SvREFCNT_inc(target));
466 347 frozen = dds_freeze(aTHX_ ctx, args[0]);
467 346 ▶ if (SvROK(frozen)) {
Branch: 1 branch
BranchTrueFalseTotal
if (SvROK(frozen)) { 89 257 346
468 89 AV *values = (AV *)SvRV(frozen);
469 89 SV **proxy = av_fetch(values, 0, 0);
470 89 SV **thaw = av_fetch(values, 1, 0);
471 89 SV **postop = av_fetch(values, 2, 0);
472  
473 89 ▶ if (thaw && SvTRUE(*thaw))
Branch: 2 branches
BranchTrueFalseTotal
if (thaw && SvTRUE(*thaw)) 32 57 89
if (thaw && SvTRUE(*thaw)) 4 28 32
474 4 node->thaw = newSVsv(*thaw);
475 89 ▶ if (postop && SvTRUE(*postop))
Branch: 2 branches
BranchTrueFalseTotal
if (postop && SvTRUE(*postop)) 28 61 89
if (postop && SvTRUE(*postop)) 28 0 28
476 28 node->postop = newSVsv(*postop);
477  
478 89 ▶ if (proxy && SvOK(*proxy) && !SvROK(*proxy) && !SvTRUE(*proxy)) {
Branch: 4 branches
BranchTrueFalseTotal
if (proxy && SvOK(*proxy) && !SvROK(*proxy) && !SvTRUE(*proxy)) { 86 3 89
if (proxy && SvOK(*proxy) && !SvROK(*proxy) && !SvTRUE(*proxy)) { 82 4 86
if (proxy && SvOK(*proxy) && !SvROK(*proxy) && !SvTRUE(*proxy)) { 10 72 82
if (proxy && SvOK(*proxy) && !SvROK(*proxy) && !SvTRUE(*proxy)) { 10 0 10
479 10 node->ignored = TRUE;
480 10 goto entry_done;
481 }
482  
483 79 ▶ if (proxy && SvOK(*proxy) && (!SvROK(*proxy) || SvRV(*proxy) != target)) {
Branch: 4 branches
BranchTrueFalseTotal
if (proxy && SvOK(*proxy) && (!SvROK(*proxy) || SvRV(*proxy) != target)) { 76 3 79
if (proxy && SvOK(*proxy) && (!SvROK(*proxy) || SvRV(*proxy) != target)) { 72 4 76
if (proxy && SvOK(*proxy) && (!SvROK(*proxy) || SvRV(*proxy) != target)) { 72 0 72
if (proxy && SvOK(*proxy) && (!SvROK(*proxy) || SvRV(*proxy) != target)) { 72 0 72
484 72 node->proxy = newSVsv(*proxy);
485 72 ▶ if (!SvROK(*proxy))
Branch: 1 branch
BranchTrueFalseTotal
if (!SvROK(*proxy)) 0 72 72
486 0 goto entry_done;
487 72 target = SvRV(*proxy);
488 72 replacement = TRUE;
489 72 node = NULL;
490 }
491 }
492 }
493  
494 /* Only possible sharing needs a persistent catalogue entry.
495 * A unique ordinary referent can expand without one. */
496 10608 ▶ if (!node) {
Branch: 1 branch
BranchTrueFalseTotal
if (!node) { 10344 264 10608
497 /* One owned proxy RV can represent several occurrences
498 * of the original object, even with referent count one. */
499 20505 ▶ bool force = replacement || entry.direct || strchr("@%&", DDS_PV(name)[0]) != NULL;
Branch: 3 branches
BranchTrueFalseTotal
bool force = replacement || entry.direct || strchr("@%&", DDS_PV(name)[0]) != NULL; 10272 72 10344
bool force = replacement || entry.direct || strchr("@%&", DDS_PV(name)[0]) != NULL; 10161 111 10272
bool force = replacement || entry.direct || strchr("@%&", DDS_PV(name)[0]) != NULL; 115 10046 10161
500  
501 10344 ▶ if (!force && !entry.direct && dds_candidate(aTHX_ entry.sv)) {
Branch: 3 branches
BranchTrueFalseTotal
if (!force && !entry.direct && dds_candidate(aTHX_ entry.sv)) { 10046 298 10344
if (!force && !entry.direct && dds_candidate(aTHX_ entry.sv)) { 10046 0 10046
if (!force && !entry.direct && dds_candidate(aTHX_ entry.sv)) { 2375 7671 10046
502 2375 dds_node *slot = dds_find(aTHX_ ctx, entry.sv, FALSE);
503  
504 2375 ▶ force = slot && slot->slot.original;
Branch: 2 branches
BranchTrueFalseTotal
force = slot && slot->slot.original; 1681 694 2375
force = slot && slot->slot.original; 15 1666 1681
505 }
506 10344 ▶ if (force || dds_candidate(aTHX_ target))
Branch: 2 branches
BranchTrueFalseTotal
if (force || dds_candidate(aTHX_ target)) 10031 313 10344
if (force || dds_candidate(aTHX_ target)) 6981 3050 10031
507 7294 node = dds_find(aTHX_ ctx, target, TRUE);
508 }
509  
510 10608 ▶ if (node) {
Branch: 1 branch
BranchTrueFalseTotal
if (node) { 7558 3050 10608
511 7558 dds_role *role = &node->ref;
512  
513 7558 ▶ if (role->present) {
Branch: 1 branch
BranchTrueFalseTotal
if (role->present) { 4819 2739 7558
514 4819 role->encounters++;
515 4819 ctx->repeats++;
516 4819 goto entry_done;
517 }
518  
519 2739 role->present = TRUE;
520 2739 role->name = newSVsv(name);
521 2739 role->depth = depth;
522 2739 role->count = SvREFCNT(target) + dds_weak_count(aTHX_ target);
523 2739 role->encounters = 1;
524 2739 node->expanded = TRUE;
525 }
526  
527 #if defined(class_object_to_hash) && defined(PERL_MAGIC_class_storage)
528 if (node)
529 dds_analyze_class(aTHX_ ctx, node, target, depth);
530 #endif
531  
532 /* Child slots are one level deeper; their referents add another. */
533 5789 ▶ if (SvTYPE(target) == SVt_PVAV) {
Branch: 1 branch
BranchTrueFalseTotal
if (SvTYPE(target) == SVt_PVAV) { 3148 2641 5789
534 3148 dds_analyze_array(aTHX_ ctx, target, depth, name);
535 2641 ▶ } else if (SvTYPE(target) == SVt_PVHV) {
Branch: 1 branch
BranchTrueFalseTotal
} else if (SvTYPE(target) == SVt_PVHV) { 1723 918 2641
536 1723 dds_analyze_hash(aTHX_ ctx, node, target, depth, name);
537 918 ▶ } else if (SvTYPE(target) == SVt_PVCV) {
Branch: 1 branch
BranchTrueFalseTotal
} else if (SvTYPE(target) == SVt_PVCV) { 81 837 918
538 81 ▶ if (!pass)
Branch: 1 branch
BranchTrueFalseTotal
if (!pass) 53 28 81
539 53 dds_collect_lexicals(aTHX_ ctx, target, lexrefs, lexnames, used_names);
540 837 ▶ } else if (SvTYPE(target) <= SVt_PVMG || SvTYPE(target) == SVt_PVGV) {
Branch: 2 branches
BranchTrueFalseTotal
} else if (SvTYPE(target) <= SVt_PVMG || SvTYPE(target) == SVt_PVGV) { 267 570 837
} else if (SvTYPE(target) <= SVt_PVMG || SvTYPE(target) == SVt_PVGV) { 140 127 267
541 697 dds_analyze_child(aTHX_ ctx, target, depth, name, '$', NULL, 0);
542 }
543  
544 140 entry_done:
545 10804 ctx->active = NULL;
546 10804 ▶ FREETMPS;
Branch: 1 branch
BranchTrueFalseTotal
FREETMPS; 10804 0 10804
547 10804 LEAVE;
548 10804 }
549  
550 /* Match discovered closure values to roots, then prepend any missing
551 * roots in lexical order. Return whether names or root membership changed. */
552 12 static bool dds_add_lexical_roots(pTHX_ dds_ctx *ctx, HV *lexrefs, HV *lexnames)
553 {
554 12 AV *add = (AV *)DDS_TEMP((SV *)newAV());
555 12 AV *unames = dds_array(aTHX_ ctx->object, "unames", TRUE);
556 HE *he;
557 UV i;
558 12 bool again = FALSE;
559  
560 12 hv_iterinit(lexrefs);
561 42 ▶ while ((he = hv_iternext(lexrefs))) {
Branch: 1 branch
BranchTrueFalseTotal
while ((he = hv_iternext(lexrefs))) { 30 12 42
562 30 SV *address = hv_iterkeysv(he), *rv = HeVAL(he);
563 30 SV *lexname = dds_hget_sv(aTHX_ lexnames, address);
564 30 bool found = FALSE;
565  
566 30 hv_store_ent(ctx->lexical_names, address, newSVsv(lexname), 0);
567 76 ▶ for (i = 0; i < ctx->root_count; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < ctx->root_count; i++) { 49 27 76
568 49 ▶ if (ctx->roots[i].sv == SvRV(rv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ctx->roots[i].sv == SvRV(rv)) { 3 46 49
569 3 SV **user = av_fetch(unames, i, 0);
570  
571 3 found = TRUE;
572 3 ▶ if (!user || !SvTRUE(*user)) {
Branch: 2 branches
BranchTrueFalseTotal
if (!user || !SvTRUE(*user)) { 1 2 3
if (!user || !SvTRUE(*user)) { 0 1 1
573 2 const char *p = DDS_PV(lexname);
574 2 ▶ SV *n = DDS_TEMP(newSVpvf("%s%s", p[0] == '$' ? "" : "*", p + 1));
Branch: 1 branch
BranchTrueFalseTotal
SV *n = DDS_TEMP(newSVpvf("%s%s", p[0] == '$' ? "" : "*", p + 1)); 2 0 2
575  
576 2 av_store(unames, i, newSVsv(n));
577 2 again = TRUE;
578 } else {
579 2 ▶ const char *p = DDS_PV(*user), *old = DDS_PV(lexname);
Branch: 1 branch
BranchTrueFalseTotal
const char *p = DDS_PV(*user), *old = DDS_PV(lexname); 1 0 1
580 1 ▶ SV *renamed = DDS_TEMP(newSVpvf("%c%s", old[0], p[0] == '*' ? p + 1 : p));
Branch: 1 branch
BranchTrueFalseTotal
SV *renamed = DDS_TEMP(newSVpvf("%c%s", old[0], p[0] == '*' ? p + 1 : p)); 0 1 1
581  
582 1 hv_store_ent(lexnames, address, newSVsv(renamed), 0);
583 }
584 3 break;
585 }
586 }
587 30 ▶ if (!found)
Branch: 1 branch
BranchTrueFalseTotal
if (!found) 27 3 30
588 27 av_push(add, newSVsv(lexname));
589 }
590  
591 12 ▶ if (av_len(add) >= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (av_len(add) >= 0) { 11 1 12
592 11 UV n = av_len(add) + 1, old_count = ctx->root_count;
593  
594 11 sortsv(AvARRAY(add), n, Perl_sv_cmp);
595 11 ▶ Renew(ctx->roots, old_count + n, dds_root);
Branch: 1 branch
BranchTrueFalseTotal
Renew(ctx->roots, old_count + n, dds_root); 0 11 11
596 11 ▶ Move(ctx->roots, ctx->roots + n, old_count, dds_root);
Branch: 1 branch
BranchTrueFalseTotal
Move(ctx->roots, ctx->roots + n, old_count, dds_root); 0 11 11
597 11 ▶ Zero(ctx->roots, n, dds_root);
Branch: 1 branch
BranchTrueFalseTotal
Zero(ctx->roots, n, dds_root); 0 11 11
598 11 av_unshift(unames, n);
599  
600 38 ▶ for (i = 0; i < n; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < n; i++) { 27 11 38
601 27 SV *lexname = *av_fetch(add, i, 0), *rv = NULL;
602 27 const char *p = DDS_PV(lexname);
603  
604 27 hv_iterinit(lexnames);
605 57 ▶ while ((he = hv_iternext(lexnames))) {
Branch: 1 branch
BranchTrueFalseTotal
while ((he = hv_iternext(lexnames))) { 57 0 57
606 57 ▶ if (sv_cmp(HeVAL(he), lexname) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (sv_cmp(HeVAL(he), lexname) == 0) { 27 30 57
607 54 rv = dds_hget(aTHX_ lexrefs, DDS_PV(hv_iterkeysv(he)));
608 27 break;
609 }
610 }
611  
612 27 ▶ if (!rv || !SvROK(rv))
Branch: 2 branches
BranchTrueFalseTotal
if (!rv || !SvROK(rv)) 27 0 27
if (!rv || !SvROK(rv)) 0 27 27
613 0 croak("Lost closure root");
614 27 ▶ if (SvTYPE(SvRV(rv)) == SVt_PVAV || SvTYPE(SvRV(rv)) == SVt_PVHV ||
Branch: 2 branches
BranchTrueFalseTotal
if (SvTYPE(SvRV(rv)) == SVt_PVAV || SvTYPE(SvRV(rv)) == SVt_PVHV || 24 3 27
if (SvTYPE(SvRV(rv)) == SVt_PVAV || SvTYPE(SvRV(rv)) == SVt_PVHV || 24 0 24
615 24 ▶ SvTYPE(SvRV(rv)) == SVt_PVCV)
Branch: 1 branch
BranchTrueFalseTotal
SvTYPE(SvRV(rv)) == SVt_PVCV) 0 24 24
616 3 ctx->roots[i].sv = newSVsv(rv);
617 else
618 24 ctx->roots[i].sv = SvREFCNT_inc(SvRV(rv));
619 27 ctx->roots[i].count = SvREFCNT(ctx->roots[i].sv);
620 27 ctx->roots[i].lexical = TRUE;
621 27 ▶ av_store(unames, i, newSVpvf("%s%s", p[0] == '$' ? "" : "*", p + 1));
Branch: 1 branch
BranchTrueFalseTotal
av_store(unames, i, newSVpvf("%s%s", p[0] == '$' ? "" : "*", p + 1)); 24 3 27
622 }
623  
624 11 ctx->root_count = ctx->root_capacity = old_count + n;
625 11 again = TRUE;
626 }
627  
628 12 return again;
629 }
630  
631 /* Build the breadth-first catalogue of identities, minimum depths and
632 * canonical names, repeating when closure discovery adds or renames roots.
633 */
634 1518 void dds_analyze(pTHX_ dds_ctx *ctx)
635 {
636 1518 UV pass = 0, i;
637 1518 HV *lexrefs = (HV *)DDS_TEMP((SV *)newHV());
638 1518 HV *lexnames = (HV *)DDS_TEMP((SV *)newHV());
639 1518 HV *used_names = (HV *)DDS_TEMP((SV *)newHV());
640 bool again;
641  
642 1518 dds_load_style(aTHX_ ctx);
643  
644 do {
645 1530 again = FALSE;
646 1530 dds_clear_catalogue(aTHX_ ctx);
647  
648 /* Seed every root before expanding any referent. */
649 3491 ▶ for (i = 0; i < ctx->root_count; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < ctx->root_count; i++) { 1961 1530 3491
650 1961 dds_root *root = &ctx->roots[i];
651 1961 SV *name = dds_name(aTHX_ ctx, root->sv, i);
652  
653 1961 SvREFCNT_dec(root->name);
654 1961 root->name = newSVsv(name);
655 1961 ▶ root->analyzed_ref = SvROK(root->sv) ? SvRV(root->sv) : NULL;
Branch: 1 branch
BranchTrueFalseTotal
root->analyzed_ref = SvROK(root->sv) ? SvRV(root->sv) : NULL; 1302 659 1961
656 1961 dds_register_slot(aTHX_ ctx, root->sv, 1, name, root->count, TRUE);
657 1961 dds_enqueue_value(aTHX_ ctx, root->sv, 2, name);
658 1961 ▶ if (root->lexical)
Branch: 1 branch
BranchTrueFalseTotal
if (root->lexical) 27 1934 1961
659 27 hv_store_ent(ctx->lexical_added, name, newSViv(1), 0);
660 }
661  
662 12334 ▶ while (ctx->queue_head < ctx->queue_count)
Branch: 1 branch
BranchTrueFalseTotal
while (ctx->queue_head < ctx->queue_count) 10806 1528 12334
663 10806 dds_analyze_entry(aTHX_ ctx, dds_dequeue(ctx), pass, lexrefs, lexnames, used_names);
664  
665 1528 ctx->active = NULL;
666  
667 /* Closure discovery may add roots or improve their names. Rebuild
668 * the catalogue so those roots participate in minimum-depth naming. */
669 1528 ▶ if (!pass && HvTOTALKEYS(lexrefs))
Branch: 2 branches
BranchTrueFalseTotal
if (!pass && HvTOTALKEYS(lexrefs)) 1516 12 1528
if (!pass && HvTOTALKEYS(lexrefs)) 12 1504 1516
670 12 again = dds_add_lexical_roots(aTHX_ ctx, lexrefs, lexnames);
671  
672 1528 pass++;
673 1528 ▶ } while (again && pass < 3);
Branch: 2 branches
BranchTrueFalseTotal
} while (again && pass < 3); 12 1516 1528
} while (again && pass < 3); 12 0 12
674  
675 /* Publish the closure names used by the Perl deparser facade. */
676 {
677 HE *he;
678 1516 HV *lexicals = dds_hash(aTHX_ ctx->object, "lexicals", TRUE);
679  
680 1516 hv_iterinit(lexnames);
681 1546 ▶ while ((he = hv_iternext(lexnames)))
Branch: 1 branch
BranchTrueFalseTotal
while ((he = hv_iternext(lexnames))) 30 1516 1546
682 30 hv_store_ent(ctx->lexical_names, hv_iterkeysv(he), newSVsv(HeVAL(he)), 0);
683 1516 hv_stores(lexicals, "a2n", newRV_inc((SV *)ctx->lexical_names));
684 1516 ▶ if (HvTOTALKEYS(ctx->lexical_added))
Branch: 1 branch
BranchTrueFalseTotal
if (HvTOTALKEYS(ctx->lexical_added)) 11 1505 1516
685 11 hv_stores(lexicals, "added", newRV_inc((SV *)ctx->lexical_added));
686 }
687  
688 1516 ctx->cataloged = TRUE;
689 1516 hv_stores(ctx->object, "cataloged", newSViv(1));
690 1516 }
« dds_engine.c ↑ Summary