Branch Coverage

Wasm3.xs
Criterion Covered Total %
branch 127 234 54.2


line true false branch
65 1 7 if (stacksize > 0xffffffff) {
104 11 11 for (unsigned a=0; a
114 4 0 *( (int32_t*) wasm3_datum_ptr ) = SvIV( cur_sv );
118 2 0 *( (int64_t*) wasm3_datum_ptr ) = SvIV( cur_sv );
122 2 0 *( (float*) wasm3_datum_ptr ) = SvNV( cur_sv );
126 3 0 *( (double*) wasm3_datum_ptr ) = SvNV( cur_sv );
137 25 10 for (unsigned r=0; r
186 16 6 for (unsigned a=0; a
199 5 1 if (ret_svs) {
201 5 0 if (ret_svs) {
203 7 5 while (*p++) got_count++;
206 5 0 if (got_count == rets_count) {
208 7 5 for (unsigned r=0; r
218 5 0 if (ret_svs) {
219 7 5 while (got_count--) SvREFCNT_dec(ret_svs[got_count]);
228 1 5 if (errstr) m3ApiTrap(errstr);
263 0 1 _croak_if_wasi_failed(self_sv, res);
280 0 3 if (-1 == res) {
281 0 0 if (errno == EBADF) croak("Bad file descriptor given: %d\n", fd);
291 0 3 if (fd2 == -1) croak("dup(%d): %s", fd, strerror(errno));
299 0 1 if (argslen % 2) {
312 5 1 for (int a=0; a
316 1 4 if (strEQ("in", argname)) {
317 0 1 if (in_seen) _croak_dupe_arg("in");
322 1 3 else if (strEQ("out", argname)) {
323 0 1 if (out_seen) _croak_dupe_arg("out");
328 1 2 else if (strEQ("err", argname)) {
329 0 1 if (err_seen) _croak_dupe_arg("err");
334 1 1 else if (strEQ("env", argname)) {
335 0 1 if (env_seen) _croak_dupe_arg("env");
338 1 0 _croak_if_not_avref(argval, "env");
0 1 _croak_if_not_avref(argval, "env");
343 0 1 if (avlen % 2) {
349 0 1 Newx(init_options.envp, 1 + envlen, const char*);
354 2 1 for (int e=0; e
378 1 0 else if (strEQ("preopen", argname)) {
379 0 1 if (preopen_seen) _croak_dupe_arg("preopen");
382 1 0 if (!SvROK(argval) || (SvTYPE(SvRV(argval)) != SVt_PVHV)) {
0 1 if (!SvROK(argval) || (SvTYPE(SvRV(argval)) != SVt_PVHV)) {
390 0 1 Newx(init_options.preopens, size, uvwasi_preopen_t);
393 1 1 for (I32 i=0; i
412 0 1 _croak_if_wasi_failed(self_sv, res);
474 6 0 const char* modbytes_orig = SvPVbyte(modbytes_sv, modlen);
483 0 6 if (err) {
506 0 6 _warn_if_global_destruct(self_sv, env_sp);
0 0 _warn_if_global_destruct(self_sv, env_sp);
517 0 1 _function_sig_xsub(self_sv, name_sv, m3_GetArgCount, m3_GetArgType);
0 1 _function_sig_xsub(self_sv, name_sv, m3_GetArgCount, m3_GetArgType);
4 1 _function_sig_xsub(self_sv, name_sv, m3_GetArgCount, m3_GetArgType);
523 0 1 _function_sig_xsub(self_sv, name_sv, m3_GetRetCount, m3_GetRetType);
0 1 _function_sig_xsub(self_sv, name_sv, m3_GetRetCount, m3_GetRetType);
4 1 _function_sig_xsub(self_sv, name_sv, m3_GetRetCount, m3_GetRetType);
532 0 2 if (res) croak("Failed to find function %s: %s", _WASI_FUNCNAME, res);
538 0 2 if (!wasi) croak("No WASI context found on module ā€œ%sā€!", m3_GetModuleName(o_module));
545 3 2 for (uint32_t a=0; aargc; a++) {
550 2 0 if (res && res != m3Err_trapExit) croak("WASI: %s", res);
0 2 if (res && res != m3Err_trapExit) croak("WASI: %s", res);
566 0 6 if (res) croak("Failed to find function %s: %s", name, res);
571 0 6 if (given_args_count != args_count) {
572 0 0 croak("%s needs %d argument%s; %d given", name, args_count, (args_count > 1) ? "s" : "", given_args_count);
580 2 4 if (returns_count > 1) {
581 2 0 if (GIMME_V == G_SCALAR) {
0 2 if (GIMME_V == G_SCALAR) {
590 4 6 for (unsigned a=0; a
598 1 5 if (res) croak("%s(): %s", name, res);
600 5 0 if (GIMME_V == G_VOID) {
1 4 if (GIMME_V == G_VOID) {
607 9 4 for (unsigned r=0; r
614 0 4 if (res) croak("%s (m3_GetResults): %s", name, res);
620 0 4 EXTEND(SP, returns_count);
622 9 4 for (unsigned r=0; r
632 6 0 if (!SvROK(module_sv) || !sv_derived_from(module_sv, PERL_MODULE_CLASS)) {
0 6 if (!SvROK(module_sv) || !sv_derived_from(module_sv, PERL_MODULE_CLASS)) {
641 0 6 if (res) croak("%s", res);
653 4 0 UV offset = (offset_sv && SvOK(offset_sv)) ? exs_SvUV(offset_sv) : 0;
0 4 UV offset = (offset_sv && SvOK(offset_sv)) ? exs_SvUV(offset_sv) : 0;
0 0 UV offset = (offset_sv && SvOK(offset_sv)) ? exs_SvUV(offset_sv) : 0;
0 0 UV offset = (offset_sv && SvOK(offset_sv)) ? exs_SvUV(offset_sv) : 0;
657 0 4 _WW3_CROAK_IF_NO_MODULE_LOADED(rt_sp);
662 0 4 if (offset > memsize) {
666 4 0 UV wantlen = (wantlen_sv && SvOK(wantlen_sv)) ? exs_SvUV(wantlen_sv) : (memsize - offset);
0 4 UV wantlen = (wantlen_sv && SvOK(wantlen_sv)) ? exs_SvUV(wantlen_sv) : (memsize - offset);
0 0 UV wantlen = (wantlen_sv && SvOK(wantlen_sv)) ? exs_SvUV(wantlen_sv) : (memsize - offset);
0 0 UV wantlen = (wantlen_sv && SvOK(wantlen_sv)) ? exs_SvUV(wantlen_sv) : (memsize - offset);
668 0 4 if (wantlen > (memsize - offset)) {
682 0 0 const uint8_t* newbytes = (uint8_t*) SvPVbyte(new_content, newlen);
686 0 0 _WW3_CROAK_IF_NO_MODULE_LOADED(rt_sp);
691 0 0 if ((newlen + offset) > memsize) {
707 0 0 _WW3_CROAK_IF_NO_MODULE_LOADED(rt_sp);
722 0 7 _warn_if_global_destruct(self_sv, rt_sp);
0 0 _warn_if_global_destruct(self_sv, rt_sp);
725 7 0 if (userdata) {
726 6 7 for (unsigned c=0; c < userdata->coderefs_count; c++) {
736 7 0 if (rt_sp->env_sv) SvREFCNT_dec(rt_sp->env_sv);
750 0 0 M3Result res = ix ? m3_CompileModule(mod) : m3_RunStart(mod);
751 0 0 if (res) croak("%s", res);
782 0 0 if (i_global) {
797 12 0 if (i_global) {
800 0 12 if (res) croak("%s", res);
840 6 0 if (!SvROK(coderef) || (SVt_PVCV != SvTYPE(SvRV(coderef)))) {
0 6 if (!SvROK(coderef) || (SVt_PVCV != SvTYPE(SvRV(coderef)))) {
847 0 6 if (!rt) croak("No runtime set up!");
850 2 4 if (rt_userdata_p->coderefs_count) {
851 0 2 Renew(rt_userdata_p->coderefs, 1 + rt_userdata_p->coderefs_count, SV*);
868 0 6 if (res) croak("%s", res);
878 0 8 SvGETMAGIC(value_sv);
0 0 SvGETMAGIC(value_sv);
880 0 8 if (SvROK(value_sv)) {
886 0 8 if (!i_global) croak("Global ā€œ%" SVf "ā€ not found!", name_sv);
897 2 0 tagged_val.value.i32 = SvIV(value_sv);
901 2 0 tagged_val.value.i64 = SvIV(value_sv);
905 0 2 tagged_val.value.f32 = SvNV(value_sv);
909 2 0 tagged_val.value.f64 = SvNV(value_sv);
917 0 8 if (res) croak("%s", res);
938 0 6 _warn_if_global_destruct(self_sv, mod_sp);
0 0 _warn_if_global_destruct(self_sv, mod_sp);
942 6 0 if (runtime_sv) {