Branch Coverage

MinPerfHashTwoLevel.xs
Criterion Covered Total %
branch 251 428 58.6


line true false branch
23 3158694 0 if (ofs) {
33 27 3158667 if (is_utf8 > 1) {
37 414 3158253 if (is_utf8) {
41 3158253 0 if (ptr) {
51 189 1353726 if (index >= mph->num_buckets) {
56 1353726 0 if (key_sv) {
59 0 1353726 if (val_sv) {
81 252 1804716 if (SvUTF8(key_sv)) {
86 1804968 0 key_pv= SvPV(key_sv,key_len);
92 0 1804968 if (!bucket->xor_val)
96 1203312 601656 if ( mph->variant > 0 && bucket->index < 0 ) {
444852 758460 if ( mph->variant > 0 && bucket->index < 0 ) {
99 378408 981708 HASH2INDEX(index,h2,bucket->xor_val,mph->num_buckets,mph->variant);
103 1804968 0 if (bucket->key_len == key_len && memEQ(key_pv,got_key_pv,key_len)) {
1804968 0 if (bucket->key_len == key_len && memEQ(key_pv,got_key_pv,key_len)) {
104 1804968 0 if (val_sv) {
120 330 0 if (error)
122 0 330 if (fd < 0) {
123 0 0 if (error)
127 0 330 if (fstat(fd,&st)==-1) {
128 0 0 if (error)
132 0 330 if (st.st_size < sizeof(struct mph_header)) {
133 0 0 if (error)
138 0 330 if (ptr == MAP_FAILED) {
139 0 0 if (error)
147 7 323 if (head->magic_num != MAGIC_DECIMAL) {
148 0 7 if (head->magic_num == MAGIC_BIG_ENDIAN_DECIMAL) {
149 0 0 if (error)
152 7 0 if (error)
156 4 319 if (head->variant > 3) {
157 4 0 if (error)
161 126 193 alignment = head->variant < 3 ? sizeof(U64)*2 : sizeof(U64);
163 0 319 if (st.st_size % alignment) {
164 0 0 if (error)
168 316 3 if (
169 313 3 head->table_ofs < head->state_ofs ||
170 310 3 head->key_flags_ofs < head->table_ofs ||
171 307 3 head->val_flags_ofs < head->key_flags_ofs ||
172 3 304 head->str_buf_ofs < head->val_flags_ofs ||
175 15 0 if (error)
179 241 63 if (flags & MPH_F_VALIDATE) {
185 178 63 if (head->variant >= 3) {
188 177 1 if (have_file_checksum != want_file_checksum) {
189 177 0 if (error)
197 0 63 if (head->table_checksum != table_checksum) {
198 0 0 if (error)
204 0 63 st.st_size - head->str_buf_ofs - (head->variant > 2 ? sizeof(U64) : 0) );
205 0 63 if (head->str_buf_checksum != str_buf_checksum) {
206 0 0 if (error)
224 1 903193 if (SvROK(sv)) {
228 0 903193 if (SvOK(sv)) {
0 0 if (SvOK(sv)) {
0 0 if (SvOK(sv)) {
230 752828 150365 char *pv= SvPV(sv,pv_len);
231 1 903192 if (pv_len > 0xFFFF)
233 174 903018 if (SvUTF8(sv)) {
234 87 87 if (downgrade)
236 156 18 if (SvUTF8(normalized_sv)) {
253 176 208 if (r) {
264 504 86 while (n_copy) {
265 162 342 if (n_copy & 1) n_bits++;
269 62 24 if ( variant > 1 || n_bits > 1 ) {
16 46 if ( variant > 1 || n_bits > 1 ) {
270 32 8 return variant ? INT32_MAX : UINT32_MAX;
293 451597 86 while (he= hv_iternext(source_hv)) {
306 0 451597 if (!val_sv) croak("panic: no sv for value?");
307 0 451597 if (!SvOK(val_sv) && (compute_flags & MPH_F_FILTER_UNDEF)) continue;
0 0 if (!SvOK(val_sv) && (compute_flags & MPH_F_FILTER_UNDEF)) continue;
0 0 if (!SvOK(val_sv) && (compute_flags & MPH_F_FILTER_UNDEF)) continue;
0 0 if (!SvOK(val_sv) && (compute_flags & MPH_F_FILTER_UNDEF)) continue;
330 451595 0 key_pv= (U8 *)SvPV(key_normalized_sv,key_len);
336 86 0 if (buf_length_sv)
347 451595 86 for (i=0; i
358 451595 0 if (!got_psv || !SvROK(*got_psv)) croak("panic: bad item in keys_av");
0 451595 if (!got_psv || !SvROK(*got_psv)) croak("panic: bad item in keys_av");
361 0 451595 if (!h0_he) croak("panic: no h0_he?");
363 225564 226031 h0= SvUV(h0_sv);
369 0 451595 if (!got_psv)
371 285829 165766 if (!SvPOK(*got_psv))
376 0 451595 if (!got_psv)
379 285829 165766 if (!SvROK(*got_psv)) {
397 451539 86 for( i = 0 ; i < keybuckets_count ; i++ ) {
403 165710 285829 if (!got) continue;
406 0 285829 if (len<1) continue;
409 285548 281 if (SvPOK(*got)) {
426 0 285668 if (!buckets_rvp) croak("panic: out of memory in buckets_av lvalue fetch");
427 103625 182043 if (!SvROK(*buckets_rvp)) {
429 0 103625 if (!idx1_hv) croak("panic: out of memory creating new hash in buckets_av idx %u",idx1);
437 285668 0 hv_setuv_with_keysv(idx1_hv,MPH_KEYSV_XOR_VAL,xor_val);
438 285668 0 hv_setuv_with_keysv(idx1_hv,MPH_KEYSV_H1_KEYS,keys_in_bucket_count);
441 451373 285668 for (i= 0, idx2= idx_start; i < keys_in_bucket_count; i++,idx2++) {
449 0 451373 if (!keys_rvp) croak("panic: no key_info in bucket %d", i);
453 0 451373 if (!buckets_rvp) croak("panic: out of memory in lvalue fetch to buckets_av");
455 347759 103614 if (!SvROK(*buckets_rvp)) {
460 103614 0 hv_copy_with_keysv(idx2_hv,keys_hv,MPH_KEYSV_XOR_VAL);
461 103614 0 hv_copy_with_keysv(idx2_hv,keys_hv,MPH_KEYSV_H1_KEYS);
469 451373 0 hv_setuv_with_keysv(keys_hv,MPH_KEYSV_IDX,*idx2);
478 212 0 U32 *idx1_start= (U32 *)SvPV(idx1_packed_sv,idx1_packed_sv_len);
482 174450 196 for (idx1_ptr= idx1_start; idx1_ptr < idx1_end; idx1_ptr++) {
494 0 174450 if (!got)
499 0 174450 if (!got)
503 174450 0 h2_start= (U32 *)SvPV(h2_sv,h2_strlen);
511 16 15728028 if (xor_val == max_xor_val) {
516 15997482 174434 while (h2_ptr < h2_end) {
519 206008 15791474 HASH2INDEX(idx2,*h2_ptr,xor_val,bucket_count,variant);
520 15553307 444175 if (is_used[idx2])
522 233416 443888 for (check_idx= idx2_start; check_idx < idx2_ptr; check_idx++) {
523 287 233129 if (*check_idx == idx2)
540 46 0 U32 *idx1_start= (U32 *)SvPV(idx1_packed_sv,idx1_packed_sv_len);
546 111234 46 for (idx1_ptr= idx1_start; idx1_ptr < idx1_end; idx1_ptr++) {
552 412009 0 while (singleton_pos < bucket_count && is_used[singleton_pos]) {
300775 111234 while (singleton_pos < bucket_count && is_used[singleton_pos]) {
555 0 111234 if (singleton_pos == bucket_count)
560 0 111234 if (!got)
583 0 86 Newxz(idx2_start, av_top_index(by_length_av)+1, U32);
587 277 70 for (len_idx= av_top_index(by_length_av); len_idx > 0 && !bad_idx; len_idx--) {
261 16 for (len_idx= av_top_index(by_length_av); len_idx > 0 && !bad_idx; len_idx--) {
592 258 3 if (!idx1_packed_sv || !SvPOK(*idx1_packed_sv))
0 258 if (!idx1_packed_sv || !SvPOK(*idx1_packed_sv))
595 69 189 if (len_idx == 1 && variant) {
46 23 if (len_idx == 1 && variant) {
669 9 0 U8 *str_pv= (U8 *)SvPV(str_sv,str_len);
670 9 0 state_pv= (U8 *)SvPV(state_sv,state_len);
671 0 9 if (state_len != STADTX_STATE_BYTES) {
691 0 91 if (!SvOK(base_seed_sv))
0 0 if (!SvOK(base_seed_sv))
0 0 if (!SvOK(base_seed_sv))
693 0 91 if (SvROK(base_seed_sv))
696 91 0 seed_pv= (U8 *)SvPV(seed_sv,seed_len);
698 0 91 if (seed_len != STADTX_SEED_BYTES) {
699 0 0 if (SvREADONLY(base_seed_sv)) {
700 0 0 if (seed_len < STADTX_SEED_BYTES) {
704 0 0 else if (seed_len > STADTX_SEED_BYTES) {
710 0 0 if (seed_len < STADTX_SEED_BYTES) {
712 0 0 while (seed_len < STADTX_SEED_BYTES) {
718 0 0 seed_pv= (U8 *)SvPV(seed_sv,seed_len);
726 91 0 state_pv= (U8 *)SvPV(RETVAL,state_len);
769 88 0 if (he) {
770 0 88 variant= SvUV(HeVAL(he));
776 88 0 if (he) {
777 0 88 compute_flags= SvUV(HeVAL(he));
783 88 0 if (he) {
785 88 0 state_pv= (U8 *)SvPV(state_sv,state_len);
786 0 88 if (state_len != STADTX_STATE_BYTES) {
794 88 0 if (he) {
801 88 0 if (he) {
808 88 0 if (he) {
810 0 88 if (SvROK(rv)) {
831 1 85 if (compute_flags & MPH_F_DETERMINISTIC)
874 0 64 U32 buf_length= SvUV(buf_length_sv);
878 64 0 char *state_pv= SvPV(state_sv, state_len);
880 63 1 U32 alignment= variant < 3 ? 2*sizeof(U64) : sizeof(U64);
885 0 64 U32 str_rlen= _roundup( buf_length
63 1 U32 str_rlen= _roundup( buf_length
887 0 0 + ( SvOK(comment_sv) ? sv_len(comment_sv) + 1 : 1 )
0 0 + ( SvOK(comment_sv) ? sv_len(comment_sv) + 1 : 1 )
940 64 0 pv= SvPV(comment_sv,pv_len);
944 451247 64 for (i= 0; i < bucket_count; i++) {
953 285603 165644 if (xor_val_he) {
954 0 285603 table[i].xor_val= SvUV(HeVAL(xor_val_he));
958 451247 0 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 451247 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 0 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 0 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 451247 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
451247 0 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 451247 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
451247 0 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
451247 0 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
451247 0 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 451247 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 0 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
451247 0 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
451247 0 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 451247 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
451247 0 SETOFS(i,key_normalized_he,table,key_ofs,key_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
959 451247 0 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 451247 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 0 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 0 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 451247 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
451247 0 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 451247 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
451247 0 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
50 451197 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
50 0 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 50 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 451197 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
50 0 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
50 0 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
0 50 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
50 0 SETOFS(i,val_normalized_he,table,val_ofs,val_len,str_buf_start,str_buf_pos,str_buf_end,str_ofs_hv);
960 451247 0 if (key_is_utf8_he) {
961 0 451247 UV u= SvUV(HeVAL(key_is_utf8_he));
966 451247 0 if (val_is_utf8_he) {
967 0 451247 UV u= SvUV(HeVAL(val_is_utf8_he));
973 1 63 if (variant > 2) {
979 63 1 if (r) {
983 1 63 if (variant > 2) {
1007 330 0 char *file_pv= SvPV(file_sv,file_len);
1009 203 127 if (mmap_status < 0) {
1026 127 0 struct mph_obj *obj= (struct mph_obj *)SvPV_nolen(mount_sv);
1028 0 127 SvOK_off(mount_sv);
1039 1353915 0 struct mph_obj *obj= (struct mph_obj *)SvPV_nolen(mount_sv);
1040 1353915 0 SV* key_sv= items > 2 ? ST(2) : NULL;
1041 0 1353915 SV* val_sv= items > 3 ? ST(3) : NULL;
1042 0 1353915 if (items > 4)
1057 1804968 0 SV* val_sv= items > 2 ? ST(2) : NULL;
1058 1804968 0 struct mph_obj *obj= (struct mph_obj *)SvPV_nolen(mount_sv);
1059 0 1804968 if (items > 3)
1092 0 1008 if (!got)
1095 1008 0 if (!mount_sv || !SvPOK(mount_sv))
0 1008 if (!mount_sv || !SvPOK(mount_sv))
1097 1008 0 obj= (struct mph_obj *)SvPV_nolen(mount_sv);