Branch Coverage

Future.xs
Criterion Covered Total %
branch 267 372 71.7


line true false branch
50 23 0 if (!ctx_ptr || !*ctx_ptr) return;
0 23 if (!ctx_ptr || !*ctx_ptr) return;
54 20 3 if (ctx->is_freed_ptr) {
58 3 20 if (ctx->shared_cv) {
62 20 3 if (ctx->cvs) {
64 6033 20 for (i = 0; i < ctx->num_cvs; i++) {
65 6023 10 if (ctx->cvs[i]) {
72 23 0 if (ctx->tasks) SvREFCNT_dec((SV*)ctx->tasks);
73 23 0 if (ctx->final_cb) SvREFCNT_dec(ctx->final_cb);
79 6125 0 SvREFCNT_inc_simple_void(cv);
82 2 6123 if (!ctx) {
86 6019 104 if (ctx->cvs) {
90 16 6107 if (--ctx->remaining <= 0) {
92 16 0 if (IS_PVCV(cb)) {
15 1 if (IS_PVCV(cb)) {
15 0 if (IS_PVCV(cb)) {
98 0 15 PUSHMARK(SP);
105 14 0 FREETMPS;
115 30 0 if (!ctx_ptr || !*ctx_ptr) return;
0 30 if (!ctx_ptr || !*ctx_ptr) return;
119 26 4 if (ctx->is_freed_ptr) {
123 8 22 if (ctx->current_cv) {
127 30 0 if (ctx->tasks) SvREFCNT_dec((SV*)ctx->tasks);
128 30 0 if (ctx->final_cb) SvREFCNT_dec(ctx->final_cb);
136 5038 0 SvREFCNT_inc_simple_void(cv);
139 3 5035 if (!ctx) {
143 5030 5 if (!ctx->unsafe) {
145 5030 0 if (ctx->current_cv == cv) {
151 3 5032 if (items > 0 && SvTRUE(ST(0))) {
3 0 if (items > 0 && SvTRUE(ST(0))) {
159 5066 0 if (!ctx_ptr || !*ctx_ptr) return;
0 5066 if (!ctx_ptr || !*ctx_ptr) return;
162 5027 39 if (ctx->running) {
170 5077 9 while (ctx->delayed) {
172 5077 0 SV **task_ary = (AvREAL(ctx->tasks) && !SvMAGICAL(ctx->tasks)) ? AvARRAY(ctx->tasks) : NULL;
5073 4 SV **task_ary = (AvREAL(ctx->tasks) && !SvMAGICAL(ctx->tasks)) ? AvARRAY(ctx->tasks) : NULL;
173 25 5052 if (ctx->current_idx >= ctx->total_tasks) {
175 25 0 if (IS_PVCV(cb)) {
24 1 if (IS_PVCV(cb)) {
24 0 if (IS_PVCV(cb)) {
181 0 24 PUSHMARK(SP);
185 22 0 FREETMPS;
193 0 5049 SV **fetch_ptr = (task_ary && ctx->current_idx <= AvFILL(ctx->tasks))
5049 0 SV **fetch_ptr = (task_ary && ctx->current_idx <= AvFILL(ctx->tasks))
195 5049 3 : av_fetch(ctx->tasks, ctx->current_idx, 0);
196 5052 0 SV *task_sv = fetch_ptr ? *fetch_ptr : NULL;
200 5050 2 if (IS_PVCV(task_sv)) {
5041 9 if (IS_PVCV(task_sv)) {
5041 0 if (IS_PVCV(task_sv)) {
201 5036 5 if (!ctx->unsafe) {
202 0 5036 if (ctx->current_cv) {
209 3 2 } else if (!ctx->current_cv) {
218 5036 5 if (!ctx->unsafe) {
223 0 5041 PUSHMARK(SP);
224 0 5041 XPUSHs(next_rv);
227 5 5036 U32 flags = G_DISCARD | (ctx->unsafe ? 0 : G_EVAL);
230 5036 5 if (!ctx->unsafe) {
232 5036 0 if (SvTRUE(ERRSV)) {
5 5031 if (SvTRUE(ERRSV)) {
233 5 0 SV *err = sv_mortalcopy(ERRSV);
239 5036 0 FREETMPS;
241 0 5036 if (!*ctx_ptr) return;
247 9 0 if (*ctx_ptr) (*ctx_ptr)->running = 0;
251 24 0 if (!ctx_ptr || !*ctx_ptr) return;
0 24 if (!ctx_ptr || !*ctx_ptr) return;
255 21 3 if (ctx->is_freed_ptr) {
259 3 21 if (ctx->shared_cv) {
263 21 3 if (ctx->cvs) {
265 1049 21 for (i = 0; i < ctx->num_cvs; i++) {
266 1037 12 if (ctx->cvs[i]) {
273 24 0 if (ctx->tasks) SvREFCNT_dec((SV*)ctx->tasks);
274 24 0 if (ctx->final_cb) SvREFCNT_dec(ctx->final_cb);
282 1140 0 SvREFCNT_inc_simple_void(cv);
285 2 1138 if (!ctx) {
289 1033 105 if (ctx->cvs) {
295 16 1122 if (--ctx->remaining <= 0) {
297 16 0 if (IS_PVCV(cb)) {
15 1 if (IS_PVCV(cb)) {
15 0 if (IS_PVCV(cb)) {
303 0 15 PUSHMARK(SP);
310 14 0 FREETMPS;
322 1146 0 if (!ctx_ptr || !*ctx_ptr) return;
0 1146 if (!ctx_ptr || !*ctx_ptr) return;
325 1110 36 if (ctx->running) {
337 36 15 while (ctx->delayed) {
340 1169 0 while (!is_freed && ctx->active < ctx->limit && ctx->current_idx < ctx->total_tasks) {
1158 11 while (!is_freed && ctx->active < ctx->limit && ctx->current_idx < ctx->total_tasks) {
1154 4 while (!is_freed && ctx->active < ctx->limit && ctx->current_idx < ctx->total_tasks) {
341 1154 0 SV **task_ary = (AvREAL(ctx->tasks) && !SvMAGICAL(ctx->tasks)) ? AvARRAY(ctx->tasks) : NULL;
1151 3 SV **task_ary = (AvREAL(ctx->tasks) && !SvMAGICAL(ctx->tasks)) ? AvARRAY(ctx->tasks) : NULL;
342 0 1151 SV **fetch_ptr = (task_ary && ctx->current_idx <= AvFILL(ctx->tasks))
1151 0 SV **fetch_ptr = (task_ary && ctx->current_idx <= AvFILL(ctx->tasks))
344 1151 3 : av_fetch(ctx->tasks, ctx->current_idx, 0);
345 1154 0 SV *task_sv = fetch_ptr ? *fetch_ptr : NULL;
349 1152 2 if (IS_PVCV(task_sv)) {
1142 10 if (IS_PVCV(task_sv)) {
1142 0 if (IS_PVCV(task_sv)) {
354 1037 105 if (!ctx->unsafe) {
365 1037 105 if (!ctx->unsafe) {
370 0 1142 PUSHMARK(SP);
371 0 1142 XPUSHs(done_rv);
374 105 1037 U32 flags = G_DISCARD | (task_unsafe ? 0 : G_EVAL);
377 1037 105 if (!task_unsafe) {
379 1037 0 if (SvTRUE(ERRSV)) {
5 1032 if (SvTRUE(ERRSV)) {
380 5 0 SV *err = sv_mortalcopy(ERRSV);
381 4 1 if (!is_freed) {
384 5 0 if (old_is_freed_ptr) *old_is_freed_ptr = 1;
389 1137 0 FREETMPS;
391 12 1125 if (is_freed) goto done;
393 4 8 if (--ctx->remaining <= 0) {
395 4 0 if (IS_PVCV(cb)) {
4 0 if (IS_PVCV(cb)) {
4 0 if (IS_PVCV(cb)) {
401 0 4 PUSHMARK(SP);
404 4 0 if (old_is_freed_ptr) *old_is_freed_ptr = 1;
406 3 0 FREETMPS;
410 0 0 if (old_is_freed_ptr) *old_is_freed_ptr = 1;
419 0 15 if (!is_freed) {
424 15 15 if (is_freed && old_is_freed_ptr) {
15 0 if (is_freed && old_is_freed_ptr) {
434 0 6 I_EV_API ("EV::Future");
6 0 I_EV_API ("EV::Future");
0 6 I_EV_API ("EV::Future");
442 3 22 if (items > 2 && SvTRUE(ST(2))) unsafe = 1;
3 0 if (items > 2 && SvTRUE(ST(2))) unsafe = 1;
445 1 24 if (len <= 0) {
446 1 0 if (IS_PVCV(final_cb)) {
1 0 if (IS_PVCV(final_cb)) {
1 0 if (IS_PVCV(final_cb)) {
450 0 1 PUSHMARK(SP);
453 0 1 FREETMPS;
471 3 21 if (unsafe) {
483 3 21 U32 flags = G_DISCARD | (unsafe ? 0 : G_EVAL);
485 6139 16 for (i = 0; i < len; i++) {
486 0 6139 if (is_freed) break;
488 6139 0 SV **task_ary = (AvREAL(tasks) && !SvMAGICAL(tasks)) ? AvARRAY(tasks) : NULL;
6136 3 SV **task_ary = (AvREAL(tasks) && !SvMAGICAL(tasks)) ? AvARRAY(tasks) : NULL;
489 0 6136 SV **fetch_ptr = (task_ary && i <= AvFILL(tasks))
6135 1 SV **fetch_ptr = (task_ary && i <= AvFILL(tasks))
491 6136 3 : av_fetch(tasks, i, 0);
492 6138 1 SV *task_sv = fetch_ptr ? *fetch_ptr : NULL;
494 6136 3 if (IS_PVCV(task_sv)) {
6128 8 if (IS_PVCV(task_sv)) {
6128 0 if (IS_PVCV(task_sv)) {
496 6024 104 if (!unsafe) {
504 6024 104 if (!unsafe) {
507 0 6128 PUSHMARK(SP);
508 0 6128 XPUSHs(done_rv);
512 6024 104 if (!unsafe) {
514 6024 0 if (SvTRUE(ERRSV)) {
4 6020 if (SvTRUE(ERRSV)) {
515 4 0 SV *err = sv_mortalcopy(ERRSV);
516 3 1 if (!is_freed) {
523 6020 104 FREETMPS;
526 4 7 if (--ctx->remaining <= 0) {
528 4 0 if (IS_PVCV(cb)) {
4 0 if (IS_PVCV(cb)) {
4 0 if (IS_PVCV(cb)) {
533 0 4 PUSHMARK(SP);
537 3 0 FREETMPS;
546 4 15 if (!is_freed && ctx) {
4 0 if (!is_freed && ctx) {
556 3 29 if (items > 2 && SvTRUE(ST(2))) unsafe = 1;
3 0 if (items > 2 && SvTRUE(ST(2))) unsafe = 1;
559 1 31 if (len <= 0) {
560 1 0 if (IS_PVCV(final_cb)) {
1 0 if (IS_PVCV(final_cb)) {
1 0 if (IS_PVCV(final_cb)) {
564 0 1 PUSHMARK(SP);
567 0 1 FREETMPS;
587 5 19 if (!is_freed && ctx) {
5 0 if (!is_freed && ctx) {
598 3 22 if (items > 3 && SvTRUE(ST(3))) unsafe = 1;
3 0 if (items > 3 && SvTRUE(ST(3))) unsafe = 1;
601 1 24 if (len <= 0) {
602 1 0 if (IS_PVCV(final_cb)) {
1 0 if (IS_PVCV(final_cb)) {
1 0 if (IS_PVCV(final_cb)) {
606 0 1 PUSHMARK(SP);
609 0 1 FREETMPS;
615 1 23 if (limit < 1) limit = 1;
616 9 15 if (limit > len) limit = len;
636 3 21 if (unsafe) {
645 3 15 if (!is_freed && ctx) {
3 0 if (!is_freed && ctx) {