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) {
574 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";
575 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) : "";
576 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";
577 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) : "";
578 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) : "";
579 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) : "";
582 275 0 if (!extra_cflags) extra_cflags = "";
583 275 0 if (!extra_ldflags) extra_ldflags = "";
600 275 0 const char *std_flag = (strstr(ccflags, "-std=") == NULL) ? "-std=gnu99" : "";
607 1 274 if (ret != 0) {
637 0 274 if (ret != 0) {
661 30 244 if (so_file[0] != '/') {
662 30 0 if (realpath(so_file, abs_so_file)) {
673 274 0 if (SvTRUE(ERRSV)) {
0 274 if (SvTRUE(ERRSV)) {
674 0 0 warn("XS::JIT: Cannot load DynaLoader: %s", SvPV_nolen(ERRSV));
675 0 0 FREETMPS;
681 0 274 PUSHMARK(SP);
682 0 274 XPUSHs(sv_2mortal(newSVpv(so_file, 0)));
683 0 274 XPUSHs(sv_2mortal(newSViv(0))); /* flags */
690 274 0 if (count == 1) {
696 274 0 if (!libref_sv || !SvOK(libref_sv)) {
0 274 if (!libref_sv || !SvOK(libref_sv)) {
698 0 0 PUSHMARK(SP);
705 0 0 FREETMPS;
714 0 274 PUSHMARK(SP);
715 0 274 XPUSHs(libref_sv);
716 0 274 XPUSHs(sv_2mortal(newSVpv(boot_name, 0)));
723 274 0 if (count == 1) {
729 274 0 if (!symref_sv || !SvOK(symref_sv)) {
0 274 if (!symref_sv || !SvOK(symref_sv)) {
730 0 0 PUSHMARK(SP);
738 0 0 FREETMPS;
747 0 274 PUSHMARK(SP);
748 0 274 XPUSHs(sv_2mortal(newSVpv(bootstrap_name, 0)));
749 0 274 XPUSHs(symref_sv);
750 0 274 XPUSHs(sv_2mortal(newSVpv(so_file, 0)));
757 274 0 if (count == 1) {
762 274 0 if (!xs_sv || !SvOK(xs_sv)) {
0 274 if (!xs_sv || !SvOK(xs_sv)) {
766 0 0 FREETMPS;
772 0 274 PUSHMARK(SP);
773 0 274 XPUSHs(sv_2mortal(newSVpv(module_name, 0)));
778 274 0 if (SvTRUE(ERRSV)) {
0 274 if (SvTRUE(ERRSV)) {
779 0 0 warn("XS::JIT: boot function failed: %s", SvPV_nolen(ERRSV));
782 0 0 FREETMPS;
789 274 0 FREETMPS;
798 543 274 for (i = 0; i < num_functions && functions[i].target; i++) {
543 0 for (i = 0; i < num_functions && functions[i].target; i++) {
802 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) == ':') {
806 0 543 if (pkg_len >= sizeof(pkg)) pkg_len = sizeof(pkg) - 1;
812 194 349 if (stash) {
815 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)) {
835 277 1 if (!force && functions_already_loaded(aTHX_ functions, num_functions)) {
3 274 if (!force && functions_already_loaded(aTHX_ functions, num_functions)) {
845 275 0 SV **dlext_sv = config ? hv_fetch(config, "dlext", 5, 0) : NULL;
846 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";
853 274 1 if (!force) {
855 0 274 if (PerlLIO_stat(so_path, &st) == 0) {
863 0 275 if (!generated) {
869 0 275 if (!mkdir_p(dir_path)) {
877 0 275 if (!fp) {
887 1 274 if (!xs_jit_compile_file(aTHX_ c_path, so_path, extra_cflags, extra_ldflags)) {