Branch Coverage

lib/XS/JIT/xs_jit.c
Criterion Covered Total %
branch 137 246 55.6


line true false branch
53 0 0 if (buf->data) {
62 28651 402 if (buf->capacity >= needed) return 1;
64 126 276 size_t new_cap = buf->capacity ? buf->capacity : BUFFER_CHUNK;
65 129 402 while (new_cap < needed) new_cap *= 2;
68 0 402 if (!new_data) return 0;
77 0 26733 if (!strbuf_ensure(buf, buf->len + slen + 1)) return 0;
91 0 2320 if (needed < 0) {
96 0 2320 if (!strbuf_ensure(buf, buf->len + needed + 1)) {
110 33768 1920 for (i = 0; name[i] && j < outlen - 1; i++) {
33768 0 for (i = 0; name[i] && j < outlen - 1; i++) {
112 1941 31827 if (c == ':') {
114 1941 0 if (name[i+1] == ':') i++;
115 23290 8537 } else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
0 23290 } else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
7505 1032 } else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
527 6978 } else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
1559 0 } else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
116 527 1032 (c >= '0' && c <= '9') || c == '_') {
527 0 (c >= '0' && c <= '9') || c == '_') {
133 11 0 SV **archname_sv = config ? hv_fetch(config, "archname", 8, 0) : NULL;
134 11 0 const char *archname = (archname_sv && *archname_sv) ? SvPV_nolen(*archname_sv) : "unknown";
11 0 const char *archname = (archname_sv && *archname_sv) ? SvPV_nolen(*archname_sv) : "unknown";
143 11 0 if (SvTRUE(ERRSV)) {
0 11 if (SvTRUE(ERRSV)) {
145 0 0 FREETMPS;
150 0 11 PUSHMARK(SP);
151 0 11 XPUSHs(input);
157 11 0 if (count == 1) {
162 11 0 if (result) {
169 11 0 FREETMPS;
178 286 0 return cache_dir ? cache_dir : "_CACHED_XS";
185 0 11 if (!key) return 0;
188 11 0 SV **dlext_sv = config ? hv_fetch(config, "dlext", 5, 0) : NULL;
189 11 0 const char *dlext = (dlext_sv && *dlext_sv) ? SvPV_nolen(*dlext_sv) : "so";
11 0 const char *dlext = (dlext_sv && *dlext_sv) ? SvPV_nolen(*dlext_sv) : "so";
207 0 11 if (!xs_jit_cache_path(aTHX_ code, name, cache_dir, path, sizeof(path))) {
221 471 71 if (is_xs_native) {
233 71 0 if (has_varargs) {
301 542 276 for (i = 0; i < num_funcs; i++) {
302 0 542 if (!functions[i].target) break;
523 542 276 for (i = 0; i < num_funcs; i++) {
524 0 542 if (!functions[i].target) break;
543 0 275 if (tmp[len - 1] == '/') tmp[len - 1] = 0;
545 10532 275 for (p = tmp + 1; *p; p++) {
546 1069 9463 if (*p == '/') {
552 1 274 return mkdir(tmp, 0755) == 0 || errno == EEXIST;
1 0 return mkdir(tmp, 0755) == 0 || errno == EEXIST;
559 0 275 if (!config) {
571 275 0 const char *cc = (cc_sv && *cc_sv) ? SvPV_nolen(*cc_sv) : "cc";
275 0 const char *cc = (cc_sv && *cc_sv) ? SvPV_nolen(*cc_sv) : "cc";
572 275 0 const char *ccflags = (ccflags_sv && *ccflags_sv) ? SvPV_nolen(*ccflags_sv) : "";
275 0 const char *ccflags = (ccflags_sv && *ccflags_sv) ? SvPV_nolen(*ccflags_sv) : "";
573 275 0 const char *optimize = (optimize_sv && *optimize_sv) ? SvPV_nolen(*optimize_sv) : "-O2";
275 0 const char *optimize = (optimize_sv && *optimize_sv) ? SvPV_nolen(*optimize_sv) : "-O2";
574 275 0 const char *cccdlflags = (cccdlflags_sv && *cccdlflags_sv) ? SvPV_nolen(*cccdlflags_sv) : "";
275 0 const char *cccdlflags = (cccdlflags_sv && *cccdlflags_sv) ? SvPV_nolen(*cccdlflags_sv) : "";
575 275 0 const char *lddlflags = (lddlflags_sv && *lddlflags_sv) ? SvPV_nolen(*lddlflags_sv) : "";
275 0 const char *lddlflags = (lddlflags_sv && *lddlflags_sv) ? SvPV_nolen(*lddlflags_sv) : "";
576 275 0 const char *archlib = (archlib_sv && *archlib_sv) ? SvPV_nolen(*archlib_sv) : "";
275 0 const char *archlib = (archlib_sv && *archlib_sv) ? SvPV_nolen(*archlib_sv) : "";
579 275 0 if (!extra_cflags) extra_cflags = "";
580 275 0 if (!extra_ldflags) extra_ldflags = "";
597 275 0 const char *std_flag = (strstr(ccflags, "-std=") == NULL) ? "-std=gnu99" : "";
604 1 274 if (ret != 0) {
614 0 274 if (ret != 0) {
638 30 244 if (so_file[0] != '/') {
639 30 0 if (realpath(so_file, abs_so_file)) {
650 274 0 if (SvTRUE(ERRSV)) {
0 274 if (SvTRUE(ERRSV)) {
651 0 0 warn("XS::JIT: Cannot load DynaLoader: %s", SvPV_nolen(ERRSV));
652 0 0 FREETMPS;
658 0 274 PUSHMARK(SP);
659 0 274 XPUSHs(sv_2mortal(newSVpv(so_file, 0)));
660 0 274 XPUSHs(sv_2mortal(newSViv(0))); /* flags */
667 274 0 if (count == 1) {
673 274 0 if (!libref_sv || !SvOK(libref_sv)) {
0 274 if (!libref_sv || !SvOK(libref_sv)) {
675 0 0 PUSHMARK(SP);
682 0 0 FREETMPS;
691 0 274 PUSHMARK(SP);
692 0 274 XPUSHs(libref_sv);
693 0 274 XPUSHs(sv_2mortal(newSVpv(boot_name, 0)));
700 274 0 if (count == 1) {
706 274 0 if (!symref_sv || !SvOK(symref_sv)) {
0 274 if (!symref_sv || !SvOK(symref_sv)) {
707 0 0 PUSHMARK(SP);
715 0 0 FREETMPS;
724 0 274 PUSHMARK(SP);
725 0 274 XPUSHs(sv_2mortal(newSVpv(bootstrap_name, 0)));
726 0 274 XPUSHs(symref_sv);
727 0 274 XPUSHs(sv_2mortal(newSVpv(so_file, 0)));
734 274 0 if (count == 1) {
739 274 0 if (!xs_sv || !SvOK(xs_sv)) {
0 274 if (!xs_sv || !SvOK(xs_sv)) {
743 0 0 FREETMPS;
749 0 274 PUSHMARK(SP);
750 0 274 XPUSHs(sv_2mortal(newSVpv(module_name, 0)));
755 274 0 if (SvTRUE(ERRSV)) {
0 274 if (SvTRUE(ERRSV)) {
756 0 0 warn("XS::JIT: boot function failed: %s", SvPV_nolen(ERRSV));
759 0 0 FREETMPS;
766 274 0 FREETMPS;
775 543 274 for (i = 0; i < num_functions && functions[i].target; i++) {
543 0 for (i = 0; i < num_functions && functions[i].target; i++) {
779 543 0 if (last_colon && last_colon > target && *(last_colon - 1) == ':') {
543 0 if (last_colon && last_colon > target && *(last_colon - 1) == ':') {
543 0 if (last_colon && last_colon > target && *(last_colon - 1) == ':') {
783 0 543 if (pkg_len >= sizeof(pkg)) pkg_len = sizeof(pkg) - 1;
789 194 349 if (stash) {
792 111 83 if (gv && *(SV**)gv && GvCV(*(GV**)gv)) {
111 0 if (gv && *(SV**)gv && GvCV(*(GV**)gv)) {
3 108 if (gv && *(SV**)gv && GvCV(*(GV**)gv)) {
812 277 1 if (!force && functions_already_loaded(aTHX_ functions, num_functions)) {
3 274 if (!force && functions_already_loaded(aTHX_ functions, num_functions)) {
822 275 0 SV **dlext_sv = config ? hv_fetch(config, "dlext", 5, 0) : NULL;
823 275 0 const char *dlext = (dlext_sv && *dlext_sv) ? SvPV_nolen(*dlext_sv) : "so";
275 0 const char *dlext = (dlext_sv && *dlext_sv) ? SvPV_nolen(*dlext_sv) : "so";
830 274 1 if (!force) {
832 0 274 if (PerlLIO_stat(so_path, &st) == 0) {
840 0 275 if (!generated) {
846 0 275 if (!mkdir_p(dir_path)) {
854 0 275 if (!fp) {
864 1 274 if (!xs_jit_compile_file(aTHX_ c_path, so_path, extra_cflags, extra_ldflags)) {