Branch Coverage

src/future.c
Criterion Covered Total %
branch 5 708 0.7


line true false branch
113 0 0 if(!SvROK(sv) || !SvOBJECT(SvRV(sv)))
0 0 if(!SvROK(sv) || !SvOBJECT(SvRV(sv)))
116 0 0 if(sv_derived_from(sv, "Future") || sv_derived_from(sv, "Future::XS"))
0 0 if(sv_derived_from(sv, "Future") || sv_derived_from(sv, "Future::XS"))
128 0 0 struct FutureXS *self = INT2PTR(struct FutureXS *, SvIV(SvRV(sv)));
135 0 0 if(!cls)
147 0 0 if(capture_times)
154 0 0 if(future_debug)
155 0 0 self->constructed_at = newSVpvf("constructed at %s line %d", CopFILE(PL_curcop), CopLINE(PL_curcop));
190 0 0 EXTEND(SP, 1);
191 0 0 PUSHMARK(SP);
202 0 0 FREETMPS;
212 0 0 while(callbacksav && AvFILLp(callbacksav) > -1) {
0 0 while(callbacksav && AvFILLp(callbacksav) > -1) {
216 0 0 if(flags & CB_SEQ_ANY) {
223 0 0 SvREFCNT_dec(CB_NONSEQ_CODE(cb));
246 0 0 if(future_debug &&
0 0 if(future_debug &&
247 0 0 (!self->ready || (self->failure && !self->reported))) {
0 0 (!self->ready || (self->failure && !self->reported))) {
248 0 0 if(!self->ready)
249 0 0 warn("%" SVf " was %" SVf " and was lost near %s line %d before it was ready\n",
254 0 0 warn("%" SVf " was %" SVf " and was lost near %s line %d with an unreported failure of: %" SVf "\n",
273 0 0 while(revocationsav && AvFILLp(revocationsav) > -1) {
0 0 while(revocationsav && AvFILLp(revocationsav) > -1) {
303 0 0 return self->ready && !self->failure && !self->cancelled;
0 0 return self->ready && !self->failure && !self->cancelled;
0 0 return self->ready && !self->failure && !self->cancelled;
309 0 0 return self->ready && self->failure;
0 0 return self->ready && self->failure;
321 0 0 if(!self->on_cancel)
337 0 0 if(cb->flags & CB_SEQ_ANY) {
344 0 0 new->code = CB_NONSEQ_CODE(cb);
347 0 0 if(!self->callbacks)
362 0 0 EXTEND(SP, 3);
363 0 0 PUSHMARK(SP);
375 0 0 FREETMPS;
387 0 0 bool is_done = !self->cancelled && !is_fail;
0 0 bool is_done = !self->cancelled && !is_fail;
389 0 0 AV *result = (is_done) ? self->result :
390 0 0 (is_fail) ? self->failure :
393 0 0 SV *code = (is_done) ? cb->seq.thencode :
394 0 0 (is_fail) ? cb->seq.elsecode :
397 0 0 if(is_fail && result && av_count(result) > 1 && cb->seq.catches) {
0 0 if(is_fail && result && av_count(result) > 1 && cb->seq.catches) {
0 0 if(is_fail && result && av_count(result) > 1 && cb->seq.catches) {
0 0 if(is_fail && result && av_count(result) > 1 && cb->seq.catches) {
0 0 if(is_fail && result && av_count(result) > 1 && cb->seq.catches) {
399 0 0 if(SvOK(category)) {
0 0 if(SvOK(category)) {
0 0 if(SvOK(category)) {
401 0 0 if(he && HeVAL(he))
0 0 if(he && HeVAL(he))
406 0 0 if(!code || !SvOK(code))
0 0 if(!code || !SvOK(code))
0 0 if(!code || !SvOK(code))
0 0 if(!code || !SvOK(code))
414 0 0 PUSHMARK(SP);
415 0 0 if(flags & CB_SELF)
416 0 0 XPUSHs(selfsv);
417 0 0 if(flags & CB_RESULT)
418 0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
426 0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
0 0 if(SvROK(ERRSV) || SvTRUE(ERRSV)) {
431 0 0 if(!fseq)
434 0 0 future_failv(fseq, &ERRSV, 1);
436 0 0 FREETMPS;
446 0 0 FREETMPS;
449 0 0 if(!sv_is_future(f2)) {
468 0 0 bool is_done = !is_cancelled && !is_fail;
0 0 bool is_done = !is_cancelled && !is_fail;
470 0 0 AV *result = (is_done) ? self->result :
471 0 0 (is_fail) ? self->failure :
474 0 0 if(is_done && !(flags & CB_DONE))
0 0 if(is_done && !(flags & CB_DONE))
476 0 0 if(is_fail && !(flags & CB_FAIL))
0 0 if(is_fail && !(flags & CB_FAIL))
478 0 0 if(is_cancelled && !(flags & CB_CANCEL))
0 0 if(is_cancelled && !(flags & CB_CANCEL))
481 0 0 if(flags & CB_IS_FUTURE) {
487 0 0 PUSHMARK(SP);
488 0 0 XPUSHs(CB_NONSEQ_CODE(cb)); // really a Future RV
0 0 XPUSHs(CB_NONSEQ_CODE(cb)); // really a Future RV
489 0 0 if(result)
490 0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
493 0 0 if(is_done)
495 0 0 else if(is_fail)
500 0 0 FREETMPS;
503 0 0 else if(flags & CB_SEQ_ANY) {
506 0 0 if(!SvOK(fseq)) {
0 0 if(!SvOK(fseq)) {
0 0 if(!SvOK(fseq)) {
507 0 0 if(self->constructed_at)
517 0 0 if(f2 == fseq)
523 0 0 if(future_is_ready(f2)) {
524 0 0 if(!future_is_cancelled(f2))
526 0 0 else if(flags & CB_CANCEL)
541 0 0 SV *code = CB_NONSEQ_CODE(cb);
548 0 0 PUSHMARK(SP);
549 0 0 if(flags & CB_SELF)
550 0 0 XPUSHs(selfsv);
551 0 0 if((flags & CB_RESULT) && result)
0 0 if((flags & CB_RESULT) && result)
552 0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
0 0 XPUSHs_from_AV(result);
558 0 0 FREETMPS;
566 0 0 if(rev->toclear_sv_at && SvROK(rev->toclear_sv_at)) {
0 0 if(rev->toclear_sv_at && SvROK(rev->toclear_sv_at)) {
574 0 0 if(!SvOK(rev->precedent_f))
0 0 if(!SvOK(rev->precedent_f))
0 0 if(!SvOK(rev->precedent_f))
582 0 0 if(self->empty_revocation_slots >= 8 && on_cancel &&
0 0 if(self->empty_revocation_slots >= 8 && on_cancel &&
0 0 if(self->empty_revocation_slots >= 8 && on_cancel &&
583 0 0 self->empty_revocation_slots >= AvFILL(on_cancel)/2) {
588 0 0 **end = AvARRAY(on_cancel) + AvFILL(on_cancel);
590 0 0 while(rdsv <= end) {
591 0 0 if(SvOK(*rdsv))
0 0 if(SvOK(*rdsv))
0 0 if(SvOK(*rdsv))
611 0 0 if(capture_times)
618 0 0 if(self->precedent_f) {
624 0 0 if(self->revoke_when_ready) {
626 0 0 for(size_t i = 0; i < av_count(revocations); i++) {
0 0 for(size_t i = 0; i < av_count(revocations); i++) {
639 0 0 if(!self->callbacks)
645 0 0 size_t i, n = av_count(callbacks);
646 0 0 for(i = 0; i < n; i++) {
661 0 0 if(self->ready) {
669 0 0 if(cb->flags & CB_SEQ_CANCEL)
673 0 0 if(cb->seq.thencode)
675 0 0 if(cb->seq.elsecode)
688 0 0 if(!CvANON(cv)) {
694 0 0 while(cop && OP_CLASS(cop) != OA_COP)
0 0 while(cop && OP_CLASS(cop) != OA_COP)
0 0 while(cop && OP_CLASS(cop) != OA_COP)
0 0 while(cop && OP_CLASS(cop) != OA_COP)
697 0 0 if(!cop)
700 0 0 return newSVpvf("__ANON__(%s line %d)", CopFILE((COP *)cop), CopLINE((COP *)cop));
707 0 0 if(self->cancelled)
710 0 0 if(self->ready)
723 0 0 if(self->cancelled)
726 0 0 if(self->ready)
730 0 0 if(n == 1 &&
0 0 if(n == 1 &&
742 0 0 EXTEND(SP, 1);
743 0 0 PUSHMARK(SP);
754 0 0 FREETMPS;
762 0 0 EXTEND(SP, 1);
763 0 0 PUSHMARK(SP);
774 0 0 FREETMPS;
782 0 0 EXTEND(SP, 1);
783 0 0 PUSHMARK(SP);
793 0 0 for(SSize_t i = 0; i < count; i++)
798 0 0 FREETMPS;
814 0 0 if(self->cancelled)
817 0 0 if(self->ready)
830 0 0 if(self->ready)
836 0 0 if(!self->on_cancel)
842 0 0 if(is_future) {
850 0 0 if(!codeself->revoke_when_ready)
865 0 0 if(is_future)
873 0 0 if(self->ready)
889 0 0 if(is_future)
897 0 0 if(self->ready)
913 0 0 if(is_future)
921 0 0 if(self->ready)
937 0 0 PUSHMARK(SP);
938 0 0 mXPUSHs(newSVsv(f));
943 0 0 FREETMPS;
951 0 0 if(await && !self->ready)
0 0 if(await && !self->ready)
954 0 0 if(!self->ready)
957 0 0 if(self->failure) {
961 0 0 if(av_count(self->failure) > 1) {
0 0 if(av_count(self->failure) > 1) {
966 0 0 PUSHMARK(SP);
967 0 0 EXTEND(SP, 1 + av_count(self->failure));
0 0 EXTEND(SP, 1 + av_count(self->failure));
0 0 EXTEND(SP, 1 + av_count(self->failure));
0 0 EXTEND(SP, 1 + av_count(self->failure));
0 0 EXTEND(SP, 1 + av_count(self->failure));
969 0 0 for(SSize_t i = 0; i < av_count(self->failure); i++)
0 0 for(SSize_t i = 0; i < av_count(self->failure); i++)
980 0 0 FREETMPS;
984 0 0 if(!SvROK(exception) && SvPV_nolen(exception)[SvCUR(exception)-1] == '\n')
0 0 if(!SvROK(exception) && SvPV_nolen(exception)[SvCUR(exception)-1] == '\n')
0 0 if(!SvROK(exception) && SvPV_nolen(exception)[SvCUR(exception)-1] == '\n')
990 0 0 if(self->cancelled)
994 0 0 if(!self->result)
1004 0 0 if(!self->ready)
1007 0 0 if(!self->failure)
1017 0 0 if(self->ready)
1023 0 0 if(self->subs) {
1024 0 0 for(Size_t i = 0; i < av_count(self->subs); i++)
0 0 for(Size_t i = 0; i < av_count(self->subs); i++)
1031 0 0 for(int i = on_cancel ? AvFILL(on_cancel) : -1; i >= 0; i--) {
0 0 for(int i = on_cancel ? AvFILL(on_cancel) : -1; i >= 0; i--) {
0 0 for(int i = on_cancel ? AvFILL(on_cancel) : -1; i >= 0; i--) {
1033 0 0 if(!SvOK(code))
0 0 if(!SvOK(code))
0 0 if(!SvOK(code))
1036 0 0 if(sv_is_future(code)) {
1042 0 0 PUSHMARK(SP);
1048 0 0 FREETMPS;
1057 0 0 PUSHMARK(SP);
1064 0 0 FREETMPS;
1094 0 0 if(flags & FUTURE_THEN_WITH_F)
1119 0 0 if(flags & FUTURE_THEN_WITH_F)
1134 0 0 for(Size_t i = 0; i < n; i++) {
1135 0 0 if(!SvROK(subs[i]) || !SvOBJECT(SvRV(subs[i])))
0 0 if(!SvROK(subs[i]) || !SvOBJECT(SvRV(subs[i])))
1138 0 0 if(SvSTASH(SvRV(subs[i])) != future_stash) {
1144 0 0 SV *f = proto ? future_new_proto(proto) : future_new(cls);
1147 0 0 if(!self->subs)
1150 0 0 for(Size_t i = 0; i < n; i++)
1165 0 0 if(srcself->failure) {
1166 0 0 self->failure = newAV_svn_dup(AvARRAY(srcself->failure), av_count(srcself->failure));
1170 0 0 self->result = newAV_svn_dup(AvARRAY(srcself->result), av_count(srcself->result));
1177 0 0 if(!self->subs)
1180 0 0 for(Size_t i = 0; i < av_count(self->subs); i++) {
0 0 for(Size_t i = 0; i < av_count(self->subs); i++) {
1182 0 0 if(!future_is_ready(sub))
1192 0 0 if(!SvOK(f))
0 0 if(!SvOK(f))
0 0 if(!SvOK(f))
1203 0 0 if(self->pending_subs)
1207 0 0 self->result = newAV_svn_dup(AvARRAY(self->subs), av_count(self->subs));
1217 0 0 for(Size_t i = 0; i < n; i++) {
1219 0 0 if(!future_is_ready(subs[i]))
1223 0 0 if(!self->pending_subs) {
1238 0 0 for(Size_t i = 0; i < n; i++) {
1239 0 0 if(!future_is_ready(subs[i]))
1254 0 0 if(!SvOK(f))
0 0 if(!SvOK(f))
0 0 if(!SvOK(f))
1263 0 0 if(self->result || self->failure)
0 0 if(self->result || self->failure)
1270 0 0 if(self->pending_subs && this_cancelled)
0 0 if(self->pending_subs && this_cancelled)
1273 0 0 if(this_cancelled) {
1290 0 0 if(!n) {
1296 0 0 for(Size_t i = 0; i < n; i++) {
1298 0 0 if(future_is_ready(subs[i]) && !future_is_cancelled(subs[i])) {
0 0 if(future_is_ready(subs[i]) && !future_is_cancelled(subs[i])) {
1304 0 0 if(immediate_ready) {
1324 0 0 for(Size_t i = 0; i < n; i++) {
1325 0 0 if(future_is_cancelled(subs[i]))
1341 0 0 for(Size_t i = 0; i < av_count(self->subs); i++) {
0 0 for(Size_t i = 0; i < av_count(self->subs); i++) {
1345 0 0 av_push_svn(result, AvARRAY(subself->result), av_count(subself->result));
1355 0 0 if(!SvOK(f))
0 0 if(!SvOK(f))
0 0 if(!SvOK(f))
1364 0 0 if(self->result || self->failure)
0 0 if(self->result || self->failure)
1367 0 0 if(future_is_cancelled(thissub)) {
1372 0 0 else if(future_is_failed(thissub)) {
1379 0 0 if(self->pending_subs)
1391 0 0 if(!n) {
1397 0 0 for(Size_t i = 0; i < n; i++) {
1398 0 0 if(future_is_cancelled(subs[i])) {
1403 0 0 if(future_is_failed(subs[i])) {
1409 0 0 if(immediate_fail) {
1426 0 0 for(Size_t i = 0; i < n; i++) {
1427 0 0 if(future_is_ready(subs[i]))
1434 0 0 if(!self->pending_subs) {
1450 0 0 if(!SvOK(f))
0 0 if(!SvOK(f))
0 0 if(!SvOK(f))
1459 0 0 if(self->result || self->failure)
0 0 if(self->result || self->failure)
1466 0 0 if(self->pending_subs && this_cancelled)
0 0 if(self->pending_subs && this_cancelled)
1469 0 0 if(this_cancelled) {
1472 0 0 else if(future_is_failed(thissub)) {
1473 0 0 if(self->pending_subs)
1491 0 0 if(!n) {
1497 0 0 for(Size_t i = 0; i < n; i++) {
1498 0 0 if(future_is_done(subs[i])) {
1504 0 0 if(immediate_done) {
1521 0 0 for(Size_t i = 0; i < n; i++) {
1522 0 0 if(future_is_ready(subs[i]))
1529 0 0 if(!self->pending_subs) {
1546 0 0 for(Size_t i = 0; self->subs && i < av_count(self->subs); i++) {
0 0 for(Size_t i = 0; self->subs && i < av_count(self->subs); i++) {
0 0 for(Size_t i = 0; self->subs && i < av_count(self->subs); i++) {
1572 0 0 if(want) {
1573 0 0 XPUSHs(sv_mortalcopy(sub));
1598 0 0 if(self->label)
1615 0 0 if(!self->udata)
1625 0 0 if(!self->udata)
1629 0 0 return he ? HeVAL(he) : &PL_sv_undef;
1716 0 4 if(!val || !val[0])
0 0 if(!val || !val[0])
1718 0 0 if(val[0] == '0' && strlen(val) == 1)
0 0 if(val[0] == '0' && strlen(val) == 1)
1731 2 0 capture_times = future_debug || getenv_bool("PERL_FUTURE_TIMES");
0 2 capture_times = future_debug || getenv_bool("PERL_FUTURE_TIMES");
1732 0 2 sv_setsv(get_sv("Future::TIMES", GV_ADDMULTI), capture_times ? &PL_sv_yes : &PL_sv_no);
1744 0 2 newCONSTSUB(gv_stashpvn("Future::XS", 10, TRUE), "DEBUG", newSVbool(future_debug));