Branch Coverage

Future.xs
Criterion Covered Total %
branch 260 362 71.8


line true false branch
31 15 67 if (!*(g->is_freed)) {
69 24 0 if (!ctx_ptr || !*ctx_ptr) return;
0 24 if (!ctx_ptr || !*ctx_ptr) return;
73 20 4 if (ctx->is_freed_ptr) {
77 4 20 if (ctx->shared_cv) {
81 20 4 if (ctx->cvs) {
83 6033 20 for (i = 0; i < ctx->num_cvs; i++) {
84 6023 10 if (ctx->cvs[i]) {
91 24 0 if (ctx->tasks) SvREFCNT_dec((SV*)ctx->tasks);
92 24 0 if (ctx->final_cb) SvREFCNT_dec(ctx->final_cb);
98 6127 0 SvREFCNT_inc_simple_void(cv);
101 2 6125 if (!ctx) {
105 6019 106 if (ctx->cvs) {
109 17 6108 if (--ctx->remaining <= 0) {
111 17 0 if (IS_PVCV(cb)) {
16 1 if (IS_PVCV(cb)) {
16 0 if (IS_PVCV(cb)) {
117 0 16 PUSHMARK(SP);
124 15 0 FREETMPS;
134 30 0 if (!ctx_ptr || !*ctx_ptr) return;
0 30 if (!ctx_ptr || !*ctx_ptr) return;
138 26 4 if (ctx->is_freed_ptr) {
142 8 22 if (ctx->current_cv) {
146 30 0 if (ctx->tasks) SvREFCNT_dec((SV*)ctx->tasks);
147 30 0 if (ctx->final_cb) SvREFCNT_dec(ctx->final_cb);
155 5039 0 SvREFCNT_inc_simple_void(cv);
158 3 5036 if (!ctx) {
162 5030 6 if (!ctx->unsafe) {
164 5030 0 if (ctx->current_cv == cv) {
170 3 5033 if (items > 0 && SvTRUE(ST(0))) {
3 0 if (items > 0 && SvTRUE(ST(0))) {
178 5068 0 if (!ctx_ptr || !*ctx_ptr) return;
0 5068 if (!ctx_ptr || !*ctx_ptr) return;
181 5028 40 if (ctx->running) {
189 5078 9 while (ctx->delayed) {
191 5078 0 SV **task_ary = (AvREAL(ctx->tasks) && !SvMAGICAL(ctx->tasks)) ? AvARRAY(ctx->tasks) : NULL;
5074 4 SV **task_ary = (AvREAL(ctx->tasks) && !SvMAGICAL(ctx->tasks)) ? AvARRAY(ctx->tasks) : NULL;
192 25 5053 if (ctx->current_idx >= ctx->total_tasks) {
194 25 0 if (IS_PVCV(cb)) {
24 1 if (IS_PVCV(cb)) {
24 0 if (IS_PVCV(cb)) {
200 0 24 PUSHMARK(SP);
204 22 0 FREETMPS;
212 0 5050 SV **fetch_ptr = (task_ary && ctx->current_idx <= AvFILL(ctx->tasks))
5050 0 SV **fetch_ptr = (task_ary && ctx->current_idx <= AvFILL(ctx->tasks))
214 5050 3 : av_fetch(ctx->tasks, ctx->current_idx, 0);
215 5053 0 SV *task_sv = fetch_ptr ? *fetch_ptr : NULL;
219 5051 2 if (IS_PVCV(task_sv)) {
5042 9 if (IS_PVCV(task_sv)) {
5042 0 if (IS_PVCV(task_sv)) {
220 5036 6 if (!ctx->unsafe) {
221 0 5036 if (ctx->current_cv) {
228 4 2 } else if (!ctx->current_cv) {
237 5036 6 if (!ctx->unsafe) {
242 0 5042 PUSHMARK(SP);
243 0 5042 XPUSHs(next_rv);
246 6 5036 U32 flags = G_DISCARD | (ctx->unsafe ? 0 : G_EVAL);
249 5036 5 if (!ctx->unsafe) {
251 5036 0 if (SvTRUE(ERRSV)) {
5 5031 if (SvTRUE(ERRSV)) {
252 5 0 SV *err = sv_mortalcopy(ERRSV);
258 5036 0 FREETMPS;
260 0 5036 if (!*ctx_ptr) return;
266 9 0 if (*ctx_ptr) (*ctx_ptr)->running = 0;
270 25 0 if (!ctx_ptr || !*ctx_ptr) return;
0 25 if (!ctx_ptr || !*ctx_ptr) return;
274 21 4 if (ctx->is_freed_ptr) {
278 4 21 if (ctx->shared_cv) {
282 21 4 if (ctx->cvs) {
284 1049 21 for (i = 0; i < ctx->num_cvs; i++) {
285 1037 12 if (ctx->cvs[i]) {
292 25 0 if (ctx->tasks) SvREFCNT_dec((SV*)ctx->tasks);
293 25 0 if (ctx->final_cb) SvREFCNT_dec(ctx->final_cb);
301 1142 0 SvREFCNT_inc_simple_void(cv);
304 2 1140 if (!ctx) {
308 1033 107 if (ctx->cvs) {
314 17 1123 if (--ctx->remaining <= 0) {
316 17 0 if (IS_PVCV(cb)) {
16 1 if (IS_PVCV(cb)) {
16 0 if (IS_PVCV(cb)) {
322 0 16 PUSHMARK(SP);
329 15 0 FREETMPS;
341 1148 0 if (!ctx_ptr || !*ctx_ptr) return;
0 1148 if (!ctx_ptr || !*ctx_ptr) return;
344 1111 37 if (ctx->running) {
356 37 15 while (ctx->delayed) {
359 1171 0 while (!is_freed && ctx->active < ctx->limit && ctx->current_idx < ctx->total_tasks) {
1160 11 while (!is_freed && ctx->active < ctx->limit && ctx->current_idx < ctx->total_tasks) {
1156 4 while (!is_freed && ctx->active < ctx->limit && ctx->current_idx < ctx->total_tasks) {
360 1156 0 SV **task_ary = (AvREAL(ctx->tasks) && !SvMAGICAL(ctx->tasks)) ? AvARRAY(ctx->tasks) : NULL;
1153 3 SV **task_ary = (AvREAL(ctx->tasks) && !SvMAGICAL(ctx->tasks)) ? AvARRAY(ctx->tasks) : NULL;
361 0 1153 SV **fetch_ptr = (task_ary && ctx->current_idx <= AvFILL(ctx->tasks))
1153 0 SV **fetch_ptr = (task_ary && ctx->current_idx <= AvFILL(ctx->tasks))
363 1153 3 : av_fetch(ctx->tasks, ctx->current_idx, 0);
364 1156 0 SV *task_sv = fetch_ptr ? *fetch_ptr : NULL;
368 1154 2 if (IS_PVCV(task_sv)) {
1144 10 if (IS_PVCV(task_sv)) {
1144 0 if (IS_PVCV(task_sv)) {
373 1037 107 if (!ctx->unsafe) {
384 1037 107 if (!ctx->unsafe) {
389 0 1144 PUSHMARK(SP);
390 0 1144 XPUSHs(done_rv);
393 107 1037 U32 flags = G_DISCARD | (task_unsafe ? 0 : G_EVAL);
396 1037 106 if (!task_unsafe) {
398 1037 0 if (SvTRUE(ERRSV)) {
5 1032 if (SvTRUE(ERRSV)) {
399 5 0 SV *err = sv_mortalcopy(ERRSV);
400 4 1 if (!is_freed) {
403 5 0 if (old_is_freed_ptr) *old_is_freed_ptr = 1;
408 1138 0 FREETMPS;
410 12 1126 if (is_freed) goto done;
412 4 8 if (--ctx->remaining <= 0) {
414 4 0 if (IS_PVCV(cb)) {
4 0 if (IS_PVCV(cb)) {
4 0 if (IS_PVCV(cb)) {
420 0 4 PUSHMARK(SP);
423 4 0 if (old_is_freed_ptr) *old_is_freed_ptr = 1;
425 3 0 FREETMPS;
429 0 0 if (old_is_freed_ptr) *old_is_freed_ptr = 1;
438 0 15 if (!is_freed) {
443 15 15 if (is_freed && old_is_freed_ptr) {
15 0 if (is_freed && old_is_freed_ptr) {
453 0 7 I_EV_API ("EV::Future");
7 0 I_EV_API ("EV::Future");
0 7 I_EV_API ("EV::Future");
461 4 22 if (items > 2 && SvTRUE(ST(2))) unsafe = 1;
4 0 if (items > 2 && SvTRUE(ST(2))) unsafe = 1;
464 1 25 if (len <= 0) {
465 1 0 if (IS_PVCV(final_cb)) {
1 0 if (IS_PVCV(final_cb)) {
1 0 if (IS_PVCV(final_cb)) {
469 0 1 PUSHMARK(SP);
472 0 1 FREETMPS;
500 4 21 if (unsafe) {
512 4 21 U32 flags = G_DISCARD | (unsafe ? 0 : G_EVAL);
514 6141 16 for (i = 0; i < len; i++) {
515 0 6141 if (*is_freed) break;
517 6141 0 SV **task_ary = (AvREAL(tasks) && !SvMAGICAL(tasks)) ? AvARRAY(tasks) : NULL;
6138 3 SV **task_ary = (AvREAL(tasks) && !SvMAGICAL(tasks)) ? AvARRAY(tasks) : NULL;
518 0 6138 SV **fetch_ptr = (task_ary && i <= AvFILL(tasks))
6137 1 SV **fetch_ptr = (task_ary && i <= AvFILL(tasks))
520 6138 3 : av_fetch(tasks, i, 0);
521 6140 1 SV *task_sv = fetch_ptr ? *fetch_ptr : NULL;
523 6138 3 if (IS_PVCV(task_sv)) {
6130 8 if (IS_PVCV(task_sv)) {
6130 0 if (IS_PVCV(task_sv)) {
525 6024 106 if (!unsafe) {
533 6024 106 if (!unsafe) {
536 0 6130 PUSHMARK(SP);
537 0 6130 XPUSHs(done_rv);
542 6024 105 if (!unsafe) {
543 6024 0 if (SvTRUE(ERRSV)) {
4 6020 if (SvTRUE(ERRSV)) {
544 4 0 SV *err = sv_mortalcopy(ERRSV);
545 3 1 if (!*is_freed) {
552 6020 105 FREETMPS;
555 4 7 if (--ctx->remaining <= 0) {
557 4 0 if (IS_PVCV(cb)) {
4 0 if (IS_PVCV(cb)) {
4 0 if (IS_PVCV(cb)) {
562 0 4 PUSHMARK(SP);
566 3 0 FREETMPS;
583 4 29 if (items > 2 && SvTRUE(ST(2))) unsafe = 1;
4 0 if (items > 2 && SvTRUE(ST(2))) unsafe = 1;
586 1 32 if (len <= 0) {
587 1 0 if (IS_PVCV(final_cb)) {
1 0 if (IS_PVCV(final_cb)) {
1 0 if (IS_PVCV(final_cb)) {
591 0 1 PUSHMARK(SP);
594 0 1 FREETMPS;
634 4 22 if (items > 3 && SvTRUE(ST(3))) unsafe = 1;
4 0 if (items > 3 && SvTRUE(ST(3))) unsafe = 1;
637 1 25 if (len <= 0) {
638 1 0 if (IS_PVCV(final_cb)) {
1 0 if (IS_PVCV(final_cb)) {
1 0 if (IS_PVCV(final_cb)) {
642 0 1 PUSHMARK(SP);
645 0 1 FREETMPS;
651 1 24 if (limit < 1) limit = 1;
652 9 16 if (limit > len) limit = len;
682 4 21 if (unsafe) {