Branch Coverage

lib/Future/AsyncAwait.xs
Criterion Covered Total %
branch 372 598 62.2


line true false branch
204 271 34 if(!SvOK(regsv)) {
205 2 269 if(!add)
225 0 2 if(hookfuncs->flags)
230 0 2 if(regs->count == regs->size) {
232 0 0 Renew(regs->arr, regs->size, struct HookRegistration);
400 278 153 if((mg = mg_findext((SV *)cv, PERL_MAGIC_ext, &vtbl_suspendedstate)))
428 11 95 if(state->awaiting_future) {
433 11 95 if(state->returning_future) {
438 11 95 if(state->frames) {
440 12 11 while((frame = next)) {
443 3 9 if(frame->stacklen) {
450 3 9 if(frame->marklen) {
454 4 8 if(frame->saved) {
456 13 4 for(idx = 0; idx < frame->savedlen; idx++) {
500 0 0 if(name)
527 0 0 if(frame->el.loop.state_u.ary.ary)
549 2 10 if(frame->mortals) {
551 2 2 for(i = 0; i < frame->mortallen; i++)
561 11 95 if(state->padslots) {
563 46 11 for(i = 0; i < state->padlen - 1; i++) {
564 16 30 if(state->padslots[i])
573 11 95 if(state->defav) {
578 13 93 if(state->modhookdata) {
581 10 3 if(regs)
582 0 10 RUN_HOOKS_REV(free, (CV *)sv, state->modhookdata);
10 10 RUN_HOOKS_REV(free, (CV *)sv, state->modhookdata);
586 0 13 if(hookp && SvOK(*hookp) && SvUV(*hookp)) {
0 0 if(hookp && SvOK(*hookp) && SvUV(*hookp)) {
0 0 if(hookp && SvOK(*hookp) && SvUV(*hookp)) {
604 30 160 if(frame->stacklen) {
609 78 30 for(i = 0; i < frame->stacklen; i++) {
617 19 171 if(frame->marklen) {
621 21 19 for(i = 0; i < frame->marklen; i++) {
636 56 134 if(savedlen)
651 94 190 while(PL_savestack_ix > old_saveix) {
669 6 9 saved->type = count == 1 ? SAVEt_CLEARSV : SAVEt_CLEARPADRANGE;
697 0 0 PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : NULL;
730 0 0 if(var == (int *)&PL_tmps_floor) {
783 8 0 if(var < PL_curpad || var > PL_curpad + AvFILL(PL_comppad))
0 8 if(var < PL_curpad || var > PL_curpad + AvFILL(PL_comppad))
0 8 if(var < PL_curpad || var > PL_curpad + AvFILL(PL_comppad))
791 8 0 saved->saved.sv = val; /* steal ownership */
808 0 0 if(var == (STRLEN *)&PL_tmps_floor) {
833 0 8 if(gv != PL_errgv) {
835 0 0 const char *stashname = HvNAME(GvSTASH(gv));
0 0 const char *stashname = HvNAME(GvSTASH(gv));
0 0 const char *stashname = HvNAME(GvSTASH(gv));
0 0 const char *stashname = HvNAME(GvSTASH(gv));
0 0 const char *stashname = HvNAME(GvSTASH(gv));
837 0 0 if(name && stashname)
861 0 0 if(padav != PL_comppad)
864 0 0 SvREFCNT_inc(PL_curpad[padix]); /* un-mortalize */
871 0 0 AvARRAY(padav)[padix] = SvREFCNT_inc(val);
893 0 0 if(name)
906 0 190 if(OLDSAVEIX(cx) != PL_savestack_ix)
910 138 52 if(frame->scopes) {
943 0 31 if(!CxPADLOOP(cx))
964 31 0 if(CxITERVAR(cx) != &PAD_SVl(cx->blk_loop.my_op->op_targ))
0 0 if(CxITERVAR(cx) != &PAD_SVl(cx->blk_loop.my_op->op_targ))
0 31 if(CxITERVAR(cx) != &PAD_SVl(cx->blk_loop.my_op->op_targ))
966 31 0 SvREFCNT_inc(cx->blk_loop.itersave);
974 3 0 SvREFCNT_inc(frame->el.loop.state_u.lazysv.cur);
975 3 0 SvREFCNT_inc(frame->el.loop.state_u.lazysv.end);
993 6 0 if(frame->el.loop.state_u.ary.ary)
1009 0 19 if(cx->blk_oldsp != height)
1025 0 143 if(!(cx->cx_type & CXp_TRYBLOCK))
1027 0 143 if(cx->blk_eval.old_namesv)
1029 0 143 if(cx->blk_eval.cv)
1031 0 143 if(cx->blk_eval.cur_top_env != PL_top_env)
1045 3 140 if(CxTRY(cx))
1060 190 0 if(oldtmpsfloor == -2) {
1069 26 164 if(frame->mortallen) {
1071 34 26 for(i = 0; i < frame->mortallen; i++) {
1094 328 0 for(cxix = cxstack_ix; cxix; cxix--) {
1096 190 138 if(CxTYPE(cx) == CXt_SUB)
1125 481 138 for(i = 1; i <= pad_max; i++) {
1126 481 0 PADNAME *pname = (i <= padnames_max) ? padnames[i] : NULL;
1128 351 130 if(!padname_is_normal_lexical(pname)) {
1133 0 130 if(PadnameIsSTATE(pname)) {
1134 0 0 state->padslots[i-1] = SvREFCNT_inc(padsvs[i]);
1157 2 136 if(PL_curpm)
1168 138 0 if(!CvSIGNATURE(cv))
1177 138 0 if(PAD_SVl(0) == (SV *)state->defav) {
1251 0 129 if(CATCH_GET)
1262 0 129 CLEAR_ERRSV();
0 129 CLEAR_ERRSV();
129 0 CLEAR_ERRSV();
1267 0 3 if(CATCH_GET)
1274 0 3 CLEAR_ERRSV();
0 3 CLEAR_ERRSV();
3 0 CLEAR_ERRSV();
1282 27 151 if(frame->stacklen) {
1284 0 27 EXTEND(SP, frame->stacklen);
1286 73 27 for(i = 0; i < frame->stacklen; i++) {
1294 16 162 if(frame->marklen) {
1295 18 16 for(i = 0; i < frame->marklen; i++) {
1297 0 18 PUSHMARK(PL_stack_base + absmark);
1305 81 178 for(i = frame->savedlen - 1; i >= 0; i--) {
1328 0 0 PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : NULL;
1347 7 0 save_pushptrptr(saved->u.gv, SvREFCNT_inc(saved->saved.sv), SAVEt_SV);
1397 52 126 if(frame->saved)
1408 24 154 if(frame->mortallen) {
1409 32 24 for(i = 0; i < frame->mortallen; i++) {
1417 18 160 switch(frame->type) {
1437 0 18 if(PL_stack_base[cx->blk_loop.state_u.stack.basesp+1] == frame->loop_list_first_item)
1461 127 0 if(state->padlen) {
1466 435 127 for(i = 1; i < state->padlen; i++) {
1467 324 111 if(!state->padslots[i-1])
1480 178 127 for(frame = state->frames; frame; frame = next) {
1489 2 125 if(state->curpm)
1492 127 0 if(state->defav) {
1497 127 0 PAD_SVl(0) = SvREFCNT_inc((SV *)state->defav);
1506 6 7 for(frame = state->frames; frame; frame = frame->next) {
1509 3 6 for(i = frame->savedlen - 1; i >= 0; i--) {
1512 0 3 switch(saved->type) {
1545 4 0 if(!padix) {
1565 26 1 if(class == &PL_sv_placeholder)
1577 0 108 EXTEND(SP, 1);
1582 0 108 PUSHMARK(mark);
1588 125 108 for (svp = SP; svp >= bottom; svp--) {
1592 84 24 if(f) {
1608 108 0 SV *ret = SvREFCNT_inc(POPs);
1610 108 0 FREETMPS;
1626 0 13 PUSHMARK(SP);
1627 10 3 if(f) {
1643 13 0 SV *ret = SvREFCNT_inc(POPs);
1645 13 0 FREETMPS;
1661 0 107 PUSHMARK(SP);
1669 107 0 SV *f = SvREFCNT_inc(POPs);
1671 107 0 FREETMPS;
1674 0 107 if(!SvROK(f))
1688 438 0 if(!f || !SvOK(f))
0 438 if(!f || !SvOK(f))
1690 0 438 if(!SvROK(f))
1696 0 438 PUSHMARK(SP);
1697 0 438 EXTEND(SP, 1);
1708 438 0 FREETMPS;
1721 0 136 PUSHMARK(SP);
1722 0 136 EXTEND(SP, 1);
1739 0 138 PUSHMARK(SP);
1740 0 138 EXTEND(SP, 2);
1747 138 0 FREETMPS;
1759 0 4 PUSHMARK(SP);
1760 0 4 EXTEND(SP, 2);
1767 4 0 FREETMPS;
1779 0 138 PUSHMARK(SP);
1780 0 138 EXTEND(SP, 2);
1787 138 0 FREETMPS;
1798 0 9 PUSHMARK(SP);
1799 0 9 EXTEND(SP, 1);
1816 0 0 if(!state) {
1817 0 0 if(!precreate_padix)
1820 0 0 if(!(flags & FAA_MODHOOK_CREATE))
1826 0 0 if((flags & FAA_MODHOOK_CREATE) && !state->modhookdata)
0 0 if((flags & FAA_MODHOOK_CREATE) && !state->modhookdata)
1841 4 0 if(precreate_padix) {
1859 96 27 if(state && state->returning_future) {
96 0 if(state && state->returning_future) {
1864 2 94 if(f && !SvROK(f)) {
1867 2 0 if(SvTRUE(ERRSV)) {
1 1 if(SvTRUE(ERRSV)) {
1871 1 0 if(!CvANON(curcv))
1872 1 0 warn("Abandoned async sub %s::%s failed: %" SVf,
1 0 warn("Abandoned async sub %s::%s failed: %" SVf,
1 0 warn("Abandoned async sub %s::%s failed: %" SVf,
0 1 warn("Abandoned async sub %s::%s failed: %" SVf,
0 0 warn("Abandoned async sub %s::%s failed: %" SVf,
0 1 warn("Abandoned async sub %s::%s failed: %" SVf,
1875 0 0 warn("Abandoned async sub CODE(0x%p) in package %s failed: %" SVf,
0 0 warn("Abandoned async sub CODE(0x%p) in package %s failed: %" SVf,
0 0 warn("Abandoned async sub CODE(0x%p) in package %s failed: %" SVf,
0 0 warn("Abandoned async sub CODE(0x%p) in package %s failed: %" SVf,
0 0 warn("Abandoned async sub CODE(0x%p) in package %s failed: %" SVf,
0 0 warn("Abandoned async sub CODE(0x%p) in package %s failed: %" SVf,
1882 121 0 if(SvTRUE(ERRSV)) {
13 108 if(SvTRUE(ERRSV)) {
1883 13 0 ret = future_fail(f, ERRSV);
1897 121 123 while(SP > oldsp)
1900 121 2 if(ret) {
1901 0 121 EXTEND(SP, 1);
1906 96 27 if(f)
1930 8 296 AV *precancel = precreate_padix ? (AV *)PAD_SVl(precreate_padix + PRECREATE_CANCEL) : NULL;
1934 181 123 if(state && state->awaiting_future && CATCH_GET) {
147 34 if(state && state->awaiting_future && CATCH_GET) {
14 133 if(state && state->awaiting_future && CATCH_GET) {
1943 167 123 if(state && state->curcop)
133 34 if(state && state->curcop)
1954 164 3 if(!SvROK(state->returning_future) || future_is_cancelled(state->returning_future)) {
4 160 if(!SvROK(state->returning_future) || future_is_cancelled(state->returning_future)) {
1955 3 4 if(!SvROK(state->returning_future)) {
1957 2 1 if(!CvANON(curcv))
1958 2 0 warn("Suspended async sub %s::%s lost its returning future", HvNAME(GvSTASH(gv)), GvNAME(gv));
2 0 warn("Suspended async sub %s::%s lost its returning future", HvNAME(GvSTASH(gv)), GvNAME(gv));
0 2 warn("Suspended async sub %s::%s lost its returning future", HvNAME(GvSTASH(gv)), GvNAME(gv));
0 0 warn("Suspended async sub %s::%s lost its returning future", HvNAME(GvSTASH(gv)), GvNAME(gv));
0 2 warn("Suspended async sub %s::%s lost its returning future", HvNAME(GvSTASH(gv)), GvNAME(gv));
1960 1 0 warn("Suspended async sub CODE(0x%p) in package %s lost its returning future", curcv, HvNAME(GvSTASH(gv)));
1 0 warn("Suspended async sub CODE(0x%p) in package %s lost its returning future", curcv, HvNAME(GvSTASH(gv)));
0 1 warn("Suspended async sub CODE(0x%p) in package %s lost its returning future", curcv, HvNAME(GvSTASH(gv)));
0 0 warn("Suspended async sub CODE(0x%p) in package %s lost its returning future", curcv, HvNAME(GvSTASH(gv)));
0 1 warn("Suspended async sub CODE(0x%p) in package %s lost its returning future", curcv, HvNAME(GvSTASH(gv)));
1967 0 7 PUSHMARK(SP);
1973 127 33 if(state && state->awaiting_future) {
1986 127 127 while(sp > PL_stack_base + orig_height)
1994 0 127 while(PL_markstack_ptr > PL_markstack + orig_height)
1996 0 127 PUSHMARK(SP);
2001 0 127 if(hookp && SvOK(*hookp) && SvUV(*hookp)) {
0 0 if(hookp && SvOK(*hookp) && SvUV(*hookp)) {
0 0 if(hookp && SvOK(*hookp) && SvUV(*hookp)) {
2004 0 0 if(!state->modhookdata)
2012 12 115 if(regs)
2013 12 0 RUN_HOOKS_REV(pre_resume, curcv, state->modhookdata);
12 12 RUN_HOOKS_REV(pre_resume, curcv, state->modhookdata);
2017 12 115 if(regs)
2018 0 12 RUN_HOOKS_FWD(post_resume, curcv, state->modhookdata);
12 12 RUN_HOOKS_FWD(post_resume, curcv, state->modhookdata);
2029 0 283 if(!sv_isobject(f))
2032 9 274 if(PL_op->op_flags & OPf_SPECIAL) {
2037 136 138 if(future_is_ready(f)) {
2040 129 7 if(state)
2052 107 31 if(!state) {
2063 3 104 HV *premodhookdata = precreate_padix ? (HV *)PAD_SVl(precreate_padix + PRECREATE_MODHOOKDATA) : NULL;
2064 3 0 if(premodhookdata) {
2069 10 97 if(regs) {
2070 10 0 if(!state->modhookdata)
2072 0 10 RUN_HOOKS_FWD(post_cv_copy, runcv, curcv, state->modhookdata);
10 10 RUN_HOOKS_FWD(post_cv_copy, runcv, curcv, state->modhookdata);
2084 12 126 if(regs)
2085 0 12 RUN_HOOKS_REV(pre_suspend, curcv, state->modhookdata);
12 12 RUN_HOOKS_REV(pre_suspend, curcv, state->modhookdata);
2090 12 126 if(regs)
2091 12 0 RUN_HOOKS_FWD(post_suspend, curcv, state->modhookdata);
12 12 RUN_HOOKS_FWD(post_suspend, curcv, state->modhookdata);
2096 0 138 if(hookp && SvOK(*hookp) && SvUV(*hookp)) {
0 0 if(hookp && SvOK(*hookp) && SvUV(*hookp)) {
0 0 if(hookp && SvOK(*hookp) && SvUV(*hookp)) {
2099 0 0 if(!state->modhookdata)
2113 0 138 if(SvREFCNT(curcv) < 2) {
2120 107 31 if(!state->returning_future) {
2123 3 104 if(precancel) {
2125 3 3 for(i = 0; i < av_count(precancel); i++)
2137 107 31 if(defer_mortal_curcv)
2140 0 138 PUSHMARK(SP);
2144 107 31 if(!SvWEAKREF(state->returning_future))
2146 0 138 if(!SvROK(state->returning_future))
2152 0 138 if(!SvROK(state->returning_future))
2156 0 138 if(!SvROK(state->awaiting_future))
2171 1 3 if(state && state->returning_future) {
1 0 if(state && state->returning_future) {
2196 130 2144 if(OP_CLASS(op) == OA_COP)
360 1914 if(OP_CLASS(op) == OA_COP)
2201 15 5 if((op_first = cUNOPx(op)->op_first)->op_type != OP_ENTERITER)
2209 15 0 kid = OpSIBLING(op_first);
2211 2 13 if(!op_first->op_targ)
2218 3 0 if((op_first = cUNOPx(op)->op_first)->op_type != OP_PUSHMARK)
2221 3 0 kid = OpSIBLING(op_first);
2223 1 2 op->op_type == OP_MAPSTART ? FORBID_MAP : FORBID_GREP, last_cop);
2225 1 0 kid = OpSIBLING(kid);
2229 112 18 if(op->op_ppaddr != &pp_await)
2231 3 109 if(!forbid)
2248 3 0 croak("await is not allowed inside %s at %s line %d.\n",
2253 961 1308 if(op->op_flags & OPf_KIDS) {
2254 945 16 if(!kid)
2256 1170 946 for(; kid; kid = OpSIBLING(kid))
2131 946 for(; kid; kid = OpSIBLING(kid))
2280 2 125 if(!ctx->body)
2294 117 5 if(ctx->body->op_type == OP_LINESEQ) {
2300 5 112 if(o->op_type == OP_NULL && o->op_flags & OPf_KIDS &&
5 0 if(o->op_type == OP_NULL && o->op_flags & OPf_KIDS &&
2301 5 0 cUNOPo->op_first->op_type == OP_LINESEQ) {
2305 114 3 if(o->op_type == OP_NEXTSTATE &&
2306 114 0 (OpSIBLING(o)->op_type == OP_ARGCHECK
7 107 (OpSIBLING(o)->op_type == OP_ARGCHECK
2314 7 0 o = OpSIBLING(OpSIBLING(o));
2315 7 0 OpMORESIB_set(OpSIBLING(argcheckop), NULL);
2329 4 118 if(precreate_padix) {
2346 7 115 if(argcheckop) {
2350 14 0 while(OpSIBLING(o))
7 7 while(OpSIBLING(o))
2363 122 2 if(ctx->cv && CvLVALUE(ctx->cv))
1 121 if(ctx->cv && CvLVALUE(ctx->cv))
2380 115 10 if(asynccvp && SvUV(*asynccvp) == PTR2UV(PL_compcv))
2 113 if(asynccvp && SvUV(*asynccvp) == PTR2UV(PL_compcv))
2382 3 9 else if(PL_compcv == PL_main_cv)
2385 1 2 croak(CvEVAL(PL_compcv) ?
0 1 croak(CvEVAL(PL_compcv) ?
2394 9 112 if(PL_compcv == PL_main_cv)
2415 4 0 if(!asynccvp || SvUV(*asynccvp) != PTR2UV(PL_compcv))
0 4 if(!asynccvp || SvUV(*asynccvp) != PTR2UV(PL_compcv))
2416 0 0 croak(CvEVAL(PL_compcv) ?
0 0 croak(CvEVAL(PL_compcv) ?
2421 0 4 if(!hv_fetchs(GvHV(PL_hintgv), "Future::AsyncAwait/experimental(cancel)", 0)) {
2466 0 0 if(hookfuncs_v1->flags)
2488 0 20 RETVAL = cxstack_ix;
2539 0 48 if(svp = hv_fetchs(PL_modglobal, "Future::AsyncAwait/on_loaded", FALSE)) {
2540 0 0 run_on_loaded = (AV *)SvREFCNT_inc(*svp);
2546 0 48 if(run_on_loaded) {
2550 0 0 for(i = 0; i < AvFILL(run_on_loaded); i += 2) {
0 0 for(i = 0; i < AvFILL(run_on_loaded); i += 2) {