Branch Coverage

XS.xs
Criterion Covered Total %
branch 233 496 46.9


line true false branch
202 0 1608 ASSUME(origin->state == XSPR_STATE_FINISHED);
204 770 838 if (callback->type == XSPR_CALLBACK_CHAIN) {
207 2 836 } else if (callback->type == XSPR_CALLBACK_FINALLY_CHAIN) {
208 1 1 xspr_promise_finish(aTHX_
213 11 825 } else if (callback->type == XSPR_CALLBACK_PERL || callback->type == XSPR_CALLBACK_FINALLY) {
11 0 } else if (callback->type == XSPR_CALLBACK_PERL || callback->type == XSPR_CALLBACK_FINALLY) {
217 11 825 if (callback->type == XSPR_CALLBACK_FINALLY) {
223 11 0 if (callback_fn && SvOK(callback_fn)) {
0 11 if (callback_fn && SvOK(callback_fn)) {
0 0 if (callback_fn && SvOK(callback_fn)) {
0 0 if (callback_fn && SvOK(callback_fn)) {
229 804 21 if (RESULT_IS_RESOLVED(origin->finished.result)) {
231 21 0 } else if (RESULT_IS_REJECTED(origin->finished.result)) {
234 21 0 if (callback_fn && SvOK(callback_fn)) {
0 21 if (callback_fn && SvOK(callback_fn)) {
0 0 if (callback_fn && SvOK(callback_fn)) {
0 0 if (callback_fn && SvOK(callback_fn)) {
244 836 0 if (callback_fn != NULL) {
247 11 825 if (callback->type == XSPR_CALLBACK_FINALLY) {
258 33 803 if (next_promise == NULL) {
259 1 32 if (callback->type == XSPR_CALLBACK_FINALLY && RESULT_IS_RESOLVED(callback_result) && RESULT_IS_REJECTED(origin->finished.result)) {
1 0 if (callback->type == XSPR_CALLBACK_FINALLY && RESULT_IS_RESOLVED(callback_result) && RESULT_IS_REJECTED(origin->finished.result)) {
1 0 if (callback->type == XSPR_CALLBACK_FINALLY && RESULT_IS_RESOLVED(callback_result) && RESULT_IS_REJECTED(origin->finished.result)) {
274 795 8 if (callback_result->count > 0 && callback_result->state == XSPR_RESULT_RESOLVED) {
790 5 if (callback_result->count > 0 && callback_result->state == XSPR_RESULT_RESOLVED) {
277 774 16 if (promise != NULL) {
279 2 772 if (callback_result->count > 1) {
282 0 772 else if (promise == next_promise) {
298 2 770 if (callback->type == XSPR_CALLBACK_FINALLY) {
312 31 772 if (finish_promise) {
316 8 23 if ((callback->type == XSPR_CALLBACK_FINALLY) && RESULT_IS_RESOLVED(callback_result)) {
7 1 if ((callback->type == XSPR_CALLBACK_FINALLY) && RESULT_IS_RESOLVED(callback_result)) {
319 4 3 if (RESULT_IS_REJECTED(final_result)) {
338 4 27 if (final_result_needs_decref) {
346 0 0 } else if (next_promise) {
360 770 844 if (callback->type == XSPR_CALLBACK_CHAIN) {
363 828 16 } else if (callback->type == XSPR_CALLBACK_PERL) {
366 796 32 if (callback->perl.next != NULL)
369 14 2 } else if (callback->type == XSPR_CALLBACK_FINALLY) {
371 13 1 if (callback->finally.next != NULL)
374 2 0 } else if (callback->type == XSPR_CALLBACK_FINALLY_CHAIN) {
390 0 0 if (MY_CXT.in_flush) {
397 0 0 while (MY_CXT.queue_head != NULL) {
408 0 0 if (cur->next == NULL) {
434 0 0 if (MY_CXT.queue_head == NULL) {
435 0 0 ASSUME(MY_CXT.queue_tail == NULL);
441 0 0 ASSUME(MY_CXT.queue_tail != NULL);
455 0 0 PUSHMARK(SP);
457 0 0 if (maybe_arg0) {
458 0 0 EXTEND(SP, 2);
462 0 0 EXTEND(SP, 1);
470 0 0 FREETMPS;
484 0 10 PUSHMARK(SP);
485 0 10 EXTEND(SP, argscount);
488 10 10 for (i=0; i
496 10 0 FREETMPS;
505 0 0 if (MY_CXT.queue_head == NULL || MY_CXT.backend_scheduled || MY_CXT.in_flush) {
0 0 if (MY_CXT.queue_head == NULL || MY_CXT.backend_scheduled || MY_CXT.in_flush) {
0 0 if (MY_CXT.queue_head == NULL || MY_CXT.backend_scheduled || MY_CXT.in_flush) {
512 0 0 if (!MY_CXT.pxs_flush_cr) {
515 0 0 if (method_gv != NULL && isGV(method_gv) && GvCV(method_gv) != NULL) {
0 0 if (method_gv != NULL && isGV(method_gv) && GvCV(method_gv) != NULL) {
0 0 if (method_gv != NULL && isGV(method_gv) && GvCV(method_gv) != NULL) {
533 0 837 if (!SvROK(perl_fn)) {
540 0 837 PUSHMARK(SP);
541 0 837 EXTEND(SP, input_count);
542 840 837 for (i = 0; i < input_count; i++) {
555 837 0 if (SvTRUE(ERRSV)) {
837 0 if (SvTRUE(ERRSV)) {
837 0 if (SvTRUE(ERRSV)) {
0 837 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
837 0 if (SvTRUE(ERRSV)) {
0 837 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
837 0 if (SvTRUE(ERRSV)) {
837 0 if (SvTRUE(ERRSV)) {
837 0 if (SvTRUE(ERRSV)) {
837 0 if (SvTRUE(ERRSV)) {
837 0 if (SvTRUE(ERRSV)) {
831 6 if (SvTRUE(ERRSV)) {
831 0 if (SvTRUE(ERRSV)) {
0 831 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
6 831 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
0 0 if (SvTRUE(ERRSV)) {
557 6 0 result->results[0] = newSVsv(ERRSV);
560 820 831 for (i = 0; i < count; i++) {
566 837 0 FREETMPS;
581 1661 1620 if (--(result->refs) == 0) {
582 33 1628 if (RESULT_IS_REJECTED(result) && result->rejection_should_warn) {
10 23 if (RESULT_IS_REJECTED(result) && result->rejection_should_warn) {
586 0 10 Copy(result->results, warn_args, result->count, SV*);
592 1657 1661 for (i = 0; i < result->count; i++) {
623 0 1620 ASSUME(promise->state == XSPR_STATE_PENDING);
634 0 1620 if (promise->on_ready_immediate != NULL) {
642 12 1620 for (i = 0; i < count; i++) {
646 9 3 if (pending_callbacks[i]->type == XSPR_CALLBACK_PERL && RESULT_IS_REJECTED(result) && result->rejection_should_warn) {
5 4 if (pending_callbacks[i]->type == XSPR_CALLBACK_PERL && RESULT_IS_REJECTED(result) && result->rejection_should_warn) {
3 2 if (pending_callbacks[i]->type == XSPR_CALLBACK_PERL && RESULT_IS_REJECTED(result) && result->rejection_should_warn) {
648 3 0 if (on_reject && SvOK(on_reject)) {
0 3 if (on_reject && SvOK(on_reject)) {
0 0 if (on_reject && SvOK(on_reject)) {
0 0 if (on_reject && SvOK(on_reject)) {
653 0 12 if (MY_CXT.deferral_cr) {
661 0 1620 if (promise->self_sv_ref != NULL) {
669 0 0 if (!SvWEAKREF(promise->self_sv_ref)) {
677 0 1620 if (MY_CXT.deferral_cr) {
689 0 1661 Newxz(result->results, count, SV*);
702 9 7 for (i=0; icount; i++) {
725 1635 2389 if (--(promise->refs) == 0) {
726 15 1620 if (promise->state == XSPR_STATE_PENDING) {
731 6 15 for (i = 0; i < count; i++) {
736 1620 0 } else if (promise->state == XSPR_STATE_FINISHED) {
743 0 1635 if (promise->on_ready_immediate != NULL) {
770 21 807 if (SvOK(on_resolve))
21 0 if (SvOK(on_resolve))
0 21 if (SvOK(on_resolve))
772 796 32 if (SvOK(on_reject))
796 0 if (SvOK(on_reject))
0 796 if (SvOK(on_reject))
775 796 32 if (next)
785 0 14 if (SvOK(on_finally))
0 0 if (SvOK(on_finally))
0 0 if (SvOK(on_finally))
788 13 1 if (next)
826 18 1596 if (promise->state == XSPR_STATE_PENDING) {
828 0 18 Renew(promise->pending.callbacks, promise->pending.callbacks_count, xspr_callback_t*);
831 1596 0 } else if (promise->state == XSPR_STATE_FINISHED) {
833 0 1596 if (MY_CXT.deferral_cr) {
848 790 0 if (input == NULL || !sv_isobject(input)) {
16 774 if (input == NULL || !sv_isobject(input)) {
853 773 1 if (sv_derived_from(input, PROMISE_CLASS)) {
854 773 0 IV tmp = SvIV((SV*)SvRV(input));
862 1 0 if (method_gv != NULL && isGV(method_gv) && GvCV(method_gv) != NULL) {
1 0 if (method_gv != NULL && isGV(method_gv) && GvCV(method_gv) != NULL) {
1 0 if (method_gv != NULL && isGV(method_gv) && GvCV(method_gv) != NULL) {
865 0 1 if (!converter_cv) croak("Need " CONVERTER_CR_NAME "!");
871 1 0 if (new_result->state == XSPR_RESULT_RESOLVED &&
1 0 if (new_result->state == XSPR_RESULT_RESOLVED &&
872 1 0 new_result->results != NULL &&
873 1 0 new_result->count == 1 &&
874 1 0 SvROK(new_result->results[0]) &&
877 1 0 IV tmp = SvIV((SV*)SvRV(new_result->results[0]));
900 0 109 return INT2PTR(DEFERRED_CLASS_TYPE*, SvUV(referent));
905 0 2471 return INT2PTR(PROMISE_CLASS_TYPE*, SvUV(referent));
925 1635 0 if (dml_svgv) {
929 1635 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
1635 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
0 1635 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
0 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
1631 4 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
1631 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
0 1631 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
0 4 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
0 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
0 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
0 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
0 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
0 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
4 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
4 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
0 4 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
0 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
0 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
4 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
0 0 promise->detect_leak_pid = detect_leak_perl && SvTRUE(detect_leak_perl) ? getpid() : 0;
936 77 765 if (GIMME_V != G_VOID) {
809 33 if (GIMME_V != G_VOID) {
958 5 1664 if (promise->detect_leak_pid && PXS_IS_GLOBAL_DESTRUCTION && promise->detect_leak_pid == getpid()) {
3 2 if (promise->detect_leak_pid && PXS_IS_GLOBAL_DESTRUCTION && promise->detect_leak_pid == getpid()) {
2 1 if (promise->detect_leak_pid && PXS_IS_GLOBAL_DESTRUCTION && promise->detect_leak_pid == getpid()) {
959 0 2 warn( "======================================================================\nXXXXXX - %s survived until global destruction; memory leak likely!\n======================================================================\n", SvPV_nolen(self_sv) );
967 3 3 HV *stash = (self_sv == NULL) ? NULL : SvSTASH( SvRV(self_sv) );
969 3 3 if (stash != NULL) {
970 3 0 pkgname = HvNAME(stash);
3 0 pkgname = HvNAME(stash);
0 3 pkgname = HvNAME(stash);
0 0 pkgname = HvNAME(stash);
3 0 pkgname = HvNAME(stash);
0 3 pkgname = HvNAME(stash);
973 3 3 if (pkgname == NULL) pkgname = DEFERRED_CLASS;
975 2 4 if (my_items == 0) {
987 799 795 for (i = 0; i < argslen; i++) {
1001 23 22 for (i = 0; i < argslen; i++) {
1004 22 1 if (!has_defined && SvOK(result->results[i])) {
6 16 if (!has_defined && SvOK(result->results[i])) {
6 0 if (!has_defined && SvOK(result->results[i])) {
0 6 if (!has_defined && SvOK(result->results[i])) {
1009 6 16 if (!has_defined) {
1010 3 3 const char* funcname = (self_sv == NULL) ? "rejected" : "reject";
1048 0 774 if (immortalize) _IMMORTALIZE_PROMISE_SV(promise_sv, promise_p);
1060 0 10 if (immortalize) _IMMORTALIZE_PROMISE_SV(promise_sv, promise_p);
1093 0 0 exs_call_method_void(
1101 0 0 exs_call_method_void(
1124 0 0 exs_call_method_void(
1132 0 0 exs_call_method_void(
1153 0 0 exs_call_method_void(
1161 0 0 exs_call_method_void(
1305 0 0 if (MY_CXT.deferral_cr) {
1309 0 0 if (MY_CXT.deferral_arg) {
1313 0 0 if (MY_CXT.stop_cr) {
1319 0 0 MY_CXT.deferral_arg = SvOK(deferral_arg) ? SvREFCNT_inc(deferral_arg) : NULL;
0 0 MY_CXT.deferral_arg = SvOK(deferral_arg) ? SvREFCNT_inc(deferral_arg) : NULL;
0 0 MY_CXT.deferral_arg = SvOK(deferral_arg) ? SvREFCNT_inc(deferral_arg) : NULL;
1323 0 0 MY_CXT.stop_cr = stop_cr ? SvREFCNT_inc(stop_cr) : NULL;
1348 0 21 if (self->promise->state != XSPR_STATE_PENDING) {
1354 21 0 if (GIMME_V == G_VOID) {
19 2 if (GIMME_V == G_VOID) {
1369 0 12 if (self->promise->state != XSPR_STATE_PENDING) {
1375 11 1 if (GIMME_V == G_VOID) {
12 0 if (GIMME_V == G_VOID) {
1399 2 0 if (self->promise->state == XSPR_STATE_FINISHED) {
1403 2 0 if (GIMME_V == G_VOID) {
2 0 if (GIMME_V == G_VOID) {
1432 3 807 _CROAK_IF_LOOKS_LIKE_INFINITE_RECURSION;
1438 0 807 if (on_resolve == NULL) on_resolve = &PL_sv_undef;
1439 796 11 if (on_reject == NULL) on_reject = &PL_sv_undef;
1451 0 21 _CROAK_IF_LOOKS_LIKE_INFINITE_RECURSION;
1465 0 14 _CROAK_IF_LOOKS_LIKE_INFINITE_RECURSION;
1559 0 0 ASSUME(self->promise->state == XSPR_STATE_FINISHED);
1564 0 0 if (RESULT_IS_RESOLVED(self->promise->finished.result)) {
1567 0 0 if (!result_count) XSRETURN_EMPTY;
1569 0 0 switch (GIMME_V) {
1572 0 0 EXTEND(SP, result_count);
0 0 EXTEND(SP, result_count);
1574 0 0 for (i=0; i
1581 0 0 EXTEND(SP, 1);
1594 0 0 if (result_count) {
1658 0 0 PUSHMARK(SP);
1660 0 0 int count = call_method("AWAIT_GET", GIMME_V);