Branch Coverage

lib/XS/JIT/xs_jit.c
Criterion Covered Total %
branch 141 254 55.5


line true false branch
53 0 0 if (buf->data) {
62 26456 389 if (buf->capacity >= needed) return 1;
64 113 276 size_t new_cap = buf->capacity ? buf->capacity : BUFFER_CHUNK;
65 116 389 while (new_cap < needed) new_cap *= 2;
68 0 389 if (!new_data) return 0;
77 0 24525 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;
520 542 276 for (i = 0; i < num_funcs; i++) {
521 0 542 if (!functions[i].target) break;
540 0 275 if (tmp[len - 1] == '/') tmp[len - 1] = 0;
542 10532 275 for (p = tmp + 1; *p; p++) {
543 1069 9463 if (*p == '/') {
549 1 274 return mkdir(tmp, 0755) == 0 || errno == EEXIST;
1 0 return mkdir(tmp, 0755) == 0 || errno == EEXIST;
562 0 549 if (!fp) {
569 3 549 while ((n = fread(buf, 1, sizeof(buf), fp)) > 0)
584 0 275 if (!config) {
599 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";
600 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) : "";
601 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";
602 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) : "";
603 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) : "";
604 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) : "";
607 275 0 if (!extra_cflags) extra_cflags = "";
608 275 0 if (!extra_ldflags) extra_ldflags = "";
623 275 0 const char *std_flag = (strstr(ccflags, "-std=") == NULL) ? "-std=gnu99" : "";
631 1 274 if (ret != 0) {
632 1 0 warn("XS::JIT: Compilation failed: %s\n--- compiler output ---\n%s",
666 0 274 if (ret != 0) {
667 0 0 warn("XS::JIT: Linking failed: %s\n--- linker output ---\n%s",
691 30 244 if (so_file[0] != '/') {
692 30 0 if (realpath(so_file, abs_so_file)) {
703 274 0 if (SvTRUE(ERRSV)) {
0 274 if (SvTRUE(ERRSV)) {
704 0 0 warn("XS::JIT: Cannot load DynaLoader: %s", SvPV_nolen(ERRSV));
705 0 0 FREETMPS;
711 0 274 PUSHMARK(SP);
712 0 274 XPUSHs(sv_2mortal(newSVpv(so_file, 0)));
713 0 274 XPUSHs(sv_2mortal(newSViv(0))); /* flags */
720 274 0 if (count == 1) {
726 274 0 if (!libref_sv || !SvOK(libref_sv)) {
0 274 if (!libref_sv || !SvOK(libref_sv)) {
728 0 0 PUSHMARK(SP);
735 0 0 FREETMPS;
744 0 274 PUSHMARK(SP);
745 0 274 XPUSHs(libref_sv);
746 0 274 XPUSHs(sv_2mortal(newSVpv(boot_name, 0)));
753 274 0 if (count == 1) {
759 274 0 if (!symref_sv || !SvOK(symref_sv)) {
0 274 if (!symref_sv || !SvOK(symref_sv)) {
760 0 0 PUSHMARK(SP);
768 0 0 FREETMPS;
777 0 274 PUSHMARK(SP);
778 0 274 XPUSHs(sv_2mortal(newSVpv(bootstrap_name, 0)));
779 0 274 XPUSHs(symref_sv);
780 0 274 XPUSHs(sv_2mortal(newSVpv(so_file, 0)));
787 274 0 if (count == 1) {
792 274 0 if (!xs_sv || !SvOK(xs_sv)) {
0 274 if (!xs_sv || !SvOK(xs_sv)) {
796 0 0 FREETMPS;
802 0 274 PUSHMARK(SP);
803 0 274 XPUSHs(sv_2mortal(newSVpv(module_name, 0)));
808 274 0 if (SvTRUE(ERRSV)) {
0 274 if (SvTRUE(ERRSV)) {
809 0 0 warn("XS::JIT: boot function failed: %s", SvPV_nolen(ERRSV));
812 0 0 FREETMPS;
819 274 0 FREETMPS;
828 543 274 for (i = 0; i < num_functions && functions[i].target; i++) {
543 0 for (i = 0; i < num_functions && functions[i].target; i++) {
832 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) == ':') {
836 0 543 if (pkg_len >= sizeof(pkg)) pkg_len = sizeof(pkg) - 1;
842 194 349 if (stash) {
845 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)) {
865 277 1 if (!force && functions_already_loaded(aTHX_ functions, num_functions)) {
3 274 if (!force && functions_already_loaded(aTHX_ functions, num_functions)) {
875 275 0 SV **dlext_sv = config ? hv_fetch(config, "dlext", 5, 0) : NULL;
876 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";
883 274 1 if (!force) {
885 0 274 if (PerlLIO_stat(so_path, &st) == 0) {
893 0 275 if (!generated) {
899 0 275 if (!mkdir_p(dir_path)) {
907 0 275 if (!fp) {
917 1 274 if (!xs_jit_compile_file(aTHX_ c_path, so_path, extra_cflags, extra_ldflags)) {