| 1 |
|
| MODULE = Data::HashMap::Shared PACKAGE = Data::HashMap::Shared::I16S |
| 2 |
|
| PROTOTYPES: DISABLE |
| 3 |
|
| |
| 4 |
|
| SV* |
| 5 |
|
| new(SV* class_sv, SV* path_sv, SV* max_entries_sv, SV* lru_max_sv = NULL, SV* ttl_default_sv = NULL, SV* lru_skip_sv = NULL, SV* arena_cap_sv = NULL, SV* file_mode_sv = NULL) |
| 6 |
|
| CODE: |
| 7 |
38 |
| const char *class = shm_invocant_class(aTHX_ class_sv, "Data::HashMap::Shared::I16S"); |
| 8 |
38 |
| uint32_t max_entries = shm_u32_arg(aTHX_ max_entries_sv, "max_entries", "Data::HashMap::Shared::I16S", 0); |
| 9 |
37 |
| uint32_t lru_max = shm_u32_arg(aTHX_ lru_max_sv, "lru_max", "Data::HashMap::Shared::I16S", 0); |
| 10 |
36 |
| uint32_t ttl_default = shm_u32_arg(aTHX_ ttl_default_sv, "ttl_default", "Data::HashMap::Shared::I16S", 0); |
| 11 |
35 |
| uint32_t lru_skip = shm_u32_arg(aTHX_ lru_skip_sv, "lru_skip", "Data::HashMap::Shared::I16S", 0); |
| 12 |
34 |
▶ | uint64_t arena_cap = arena_cap_sv ? shm_count_arg(aTHX_ arena_cap_sv, "arena_cap", "Data::HashMap::Shared::I16S") : 0; |
Branch: 1 branch
| Branch | True | False | Total |
| uint64_t arena_cap = arena_cap_sv ? shm_count_arg(aTHX_ arena_cap_sv, "arena_cap", "Data::HashMap::Shared::I16S") : 0; |
6 |
28 |
34 |
|
| 13 |
34 |
▶ | UV file_mode = file_mode_sv ? shm_count_arg(aTHX_ file_mode_sv, "file_mode", "Data::HashMap::Shared::I16S") : 0600; |
Branch: 1 branch
| Branch | True | False | Total |
| UV file_mode = file_mode_sv ? shm_count_arg(aTHX_ file_mode_sv, "file_mode", "Data::HashMap::Shared::I16S") : 0600; |
0 |
34 |
34 |
|
| 14 |
34 |
▶ | char errbuf[SHM_ERR_BUFLEN]; const char* path = SHM_WRITE_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::I16S", "new"); ShmHandle* map = shm_i16s_create(path, (uint32_t)max_entries, (uint32_t)lru_max, (uint32_t)ttl_default, (uint32_t)lru_skip, (uint64_t)arena_cap, shm_file_mode(aTHX_ file_mode, "Data::HashMap::Shared::I16S"), errbuf); |
Branch: 3 branches
| Branch | True | False | Total |
| char errbuf[SHM_ERR_BUFLEN]; const char* path = SHM_WRITE_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::I16S", "new"); ShmHandle* map = shm_i16s_create(path, (uint32_t)max_entries, (uint32_t)lru_max, (uint32_t)ttl_default, (uint32_t)lru_skip, (uint64_t)arena_cap, shm_file_mode(aTHX_ file_mode, "Data::HashMap::Shared::I16S"), errbuf); |
0 |
34 |
34 |
| char errbuf[SHM_ERR_BUFLEN]; const char* path = SHM_WRITE_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::I16S", "new"); ShmHandle* map = shm_i16s_create(path, (uint32_t)max_entries, (uint32_t)lru_max, (uint32_t)ttl_default, (uint32_t)lru_skip, (uint64_t)arena_cap, shm_file_mode(aTHX_ file_mode, "Data::HashMap::Shared::I16S"), errbuf); |
0 |
0 |
0 |
| char errbuf[SHM_ERR_BUFLEN]; const char* path = SHM_WRITE_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::I16S", "new"); ShmHandle* map = shm_i16s_create(path, (uint32_t)max_entries, (uint32_t)lru_max, (uint32_t)ttl_default, (uint32_t)lru_skip, (uint64_t)arena_cap, shm_file_mode(aTHX_ file_mode, "Data::HashMap::Shared::I16S"), errbuf); |
23 |
11 |
34 |
|
| 15 |
34 |
▶ | if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
34 |
34 |
| if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
|
| 16 |
34 |
▶ | SHM_RETURN_MAP(map, "Data::HashMap::Shared::I16S", class); |
Branch: 2 branches
| Branch | True | False | Total |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::I16S", class); |
0 |
34 |
34 |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::I16S", class); |
0 |
34 |
34 |
|
| 17 |
|
| OUTPUT: |
| 18 |
|
| RETVAL |
| 19 |
|
| |
| 20 |
|
| SV* |
| 21 |
|
| new_sharded(SV* class_sv, SV* path_prefix_sv, SV* num_shards_sv, SV* max_entries_sv, SV* lru_max_sv = NULL, SV* ttl_default_sv = NULL, SV* lru_skip_sv = NULL, SV* arena_cap_sv = NULL, SV* file_mode_sv = NULL) |
| 22 |
|
| CODE: |
| 23 |
10 |
| const char *class = shm_invocant_class(aTHX_ class_sv, "Data::HashMap::Shared::I16S"); |
| 24 |
10 |
▶ | const char* path_prefix = SHM_WRITE_PATH_ARG(path_prefix_sv, "path prefix", "Data::HashMap::Shared::I16S", "new_sharded"); |
Branch: 3 branches
| Branch | True | False | Total |
| const char* path_prefix = SHM_WRITE_PATH_ARG(path_prefix_sv, "path prefix", "Data::HashMap::Shared::I16S", "new_sharded"); |
0 |
10 |
10 |
| const char* path_prefix = SHM_WRITE_PATH_ARG(path_prefix_sv, "path prefix", "Data::HashMap::Shared::I16S", "new_sharded"); |
0 |
0 |
0 |
| const char* path_prefix = SHM_WRITE_PATH_ARG(path_prefix_sv, "path prefix", "Data::HashMap::Shared::I16S", "new_sharded"); |
10 |
0 |
10 |
|
| 25 |
10 |
| uint32_t max_entries = shm_u32_arg(aTHX_ max_entries_sv, "max_entries", "Data::HashMap::Shared::I16S", 0); |
| 26 |
9 |
| uint32_t lru_max = shm_u32_arg(aTHX_ lru_max_sv, "lru_max", "Data::HashMap::Shared::I16S", 0); |
| 27 |
8 |
| uint32_t ttl_default = shm_u32_arg(aTHX_ ttl_default_sv, "ttl_default", "Data::HashMap::Shared::I16S", 0); |
| 28 |
7 |
| uint32_t lru_skip = shm_u32_arg(aTHX_ lru_skip_sv, "lru_skip", "Data::HashMap::Shared::I16S", 0); |
| 29 |
6 |
▶ | uint64_t arena_cap = arena_cap_sv ? shm_count_arg(aTHX_ arena_cap_sv, "arena_cap", "Data::HashMap::Shared::I16S") : 0; |
Branch: 1 branch
| Branch | True | False | Total |
| uint64_t arena_cap = arena_cap_sv ? shm_count_arg(aTHX_ arena_cap_sv, "arena_cap", "Data::HashMap::Shared::I16S") : 0; |
0 |
6 |
6 |
|
| 30 |
6 |
▶ | UV file_mode = file_mode_sv ? shm_count_arg(aTHX_ file_mode_sv, "file_mode", "Data::HashMap::Shared::I16S") : 0600; |
Branch: 1 branch
| Branch | True | False | Total |
| UV file_mode = file_mode_sv ? shm_count_arg(aTHX_ file_mode_sv, "file_mode", "Data::HashMap::Shared::I16S") : 0600; |
0 |
6 |
6 |
|
| 31 |
6 |
| uint32_t num_shards = shm_u32_arg(aTHX_ num_shards_sv, "num_shards", "Data::HashMap::Shared::I16S", 0); |
| 32 |
5 |
| char errbuf[SHM_ERR_BUFLEN]; ShmHandle* map = shm_i16s_create_sharded(path_prefix, (uint32_t)num_shards, (uint32_t)max_entries, (uint32_t)lru_max, (uint32_t)ttl_default, (uint32_t)lru_skip, (uint64_t)arena_cap, shm_file_mode(aTHX_ file_mode, "Data::HashMap::Shared::I16S"), errbuf); |
| 33 |
5 |
▶ | if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
5 |
5 |
| if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
|
| 34 |
5 |
▶ | SHM_RETURN_MAP(map, "Data::HashMap::Shared::I16S", class); |
Branch: 2 branches
| Branch | True | False | Total |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::I16S", class); |
5 |
0 |
5 |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::I16S", class); |
0 |
5 |
5 |
|
| 35 |
|
| OUTPUT: |
| 36 |
|
| RETVAL |
| 37 |
|
| |
| 38 |
|
| |
| 39 |
|
| SV* |
| 40 |
|
| new_memfd(SV* class_sv, SV* name_sv, SV* max_entries_sv, SV* lru_max_sv = NULL, SV* ttl_default_sv = NULL, SV* lru_skip_sv = NULL, SV* arena_cap_sv = NULL) |
| 41 |
|
| CODE: |
| 42 |
4 |
| const char *class = shm_invocant_class(aTHX_ class_sv, "Data::HashMap::Shared::I16S"); |
| 43 |
|
| char errbuf[SHM_ERR_BUFLEN]; |
| 44 |
4 |
▶ | const char* name = SHM_PATH_ARG(name_sv, "name", "Data::HashMap::Shared::I16S"); |
Branch: 3 branches
| Branch | True | False | Total |
| const char* name = SHM_PATH_ARG(name_sv, "name", "Data::HashMap::Shared::I16S"); |
0 |
4 |
4 |
| const char* name = SHM_PATH_ARG(name_sv, "name", "Data::HashMap::Shared::I16S"); |
0 |
0 |
0 |
| const char* name = SHM_PATH_ARG(name_sv, "name", "Data::HashMap::Shared::I16S"); |
4 |
0 |
4 |
|
| 45 |
4 |
| uint32_t max_entries = shm_u32_arg(aTHX_ max_entries_sv, "max_entries", "Data::HashMap::Shared::I16S", 0); |
| 46 |
3 |
| uint32_t lru_max = shm_u32_arg(aTHX_ lru_max_sv, "lru_max", "Data::HashMap::Shared::I16S", 0); |
| 47 |
2 |
| uint32_t ttl_default = shm_u32_arg(aTHX_ ttl_default_sv, "ttl_default", "Data::HashMap::Shared::I16S", 0); |
| 48 |
1 |
| uint32_t lru_skip = shm_u32_arg(aTHX_ lru_skip_sv, "lru_skip", "Data::HashMap::Shared::I16S", 0); |
| 49 |
0 |
▶ | uint64_t arena_cap = arena_cap_sv ? shm_count_arg(aTHX_ arena_cap_sv, "arena_cap", "Data::HashMap::Shared::I16S") : 0; |
Branch: 1 branch
| Branch | True | False | Total |
| uint64_t arena_cap = arena_cap_sv ? shm_count_arg(aTHX_ arena_cap_sv, "arena_cap", "Data::HashMap::Shared::I16S") : 0; |
0 |
0 |
0 |
|
| 50 |
0 |
| ShmHandle* map = shm_i16s_create_memfd(name, (uint32_t)max_entries, (uint32_t)lru_max, (uint32_t)ttl_default, (uint32_t)lru_skip, (uint64_t)arena_cap, errbuf); |
| 51 |
0 |
▶ | if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
| if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
|
| 52 |
0 |
▶ | SHM_RETURN_MAP(map, "Data::HashMap::Shared::I16S", class); |
Branch: 2 branches
| Branch | True | False | Total |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::I16S", class); |
0 |
0 |
0 |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::I16S", class); |
0 |
0 |
0 |
|
| 53 |
|
| OUTPUT: |
| 54 |
|
| RETVAL |
| 55 |
|
| |
| 56 |
|
| SV* |
| 57 |
|
| new_from_fd(SV* class_sv, int fd) |
| 58 |
|
| CODE: |
| 59 |
0 |
| const char *class = shm_invocant_class(aTHX_ class_sv, "Data::HashMap::Shared::I16S"); |
| 60 |
|
| char errbuf[SHM_ERR_BUFLEN]; |
| 61 |
0 |
▶ | SHM_TAINT_CHECK("Data::HashMap::Shared::I16S->new_from_fd"); |
Branch: 1 branch
| Branch | True | False | Total |
| SHM_TAINT_CHECK("Data::HashMap::Shared::I16S->new_from_fd"); |
0 |
0 |
0 |
|
| 62 |
0 |
| ShmHandle* map = shm_i16s_open_fd(fd, errbuf); |
| 63 |
0 |
▶ | if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
| if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
|
| 64 |
0 |
▶ | SHM_RETURN_MAP(map, "Data::HashMap::Shared::I16S", class); |
Branch: 2 branches
| Branch | True | False | Total |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::I16S", class); |
0 |
0 |
0 |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::I16S", class); |
0 |
0 |
0 |
|
| 65 |
|
| OUTPUT: |
| 66 |
|
| RETVAL |
| 67 |
|
| |
| 68 |
|
| SV* |
| 69 |
|
| new_readonly(SV* class_sv, SV* path_sv) |
| 70 |
|
| CODE: |
| 71 |
1 |
| const char *class = shm_invocant_class(aTHX_ class_sv, "Data::HashMap::Shared::I16S"); |
| 72 |
|
| char errbuf[SHM_ERR_BUFLEN]; |
| 73 |
1 |
▶ | const char* path = SHM_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::I16S"); |
Branch: 3 branches
| Branch | True | False | Total |
| const char* path = SHM_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::I16S"); |
0 |
1 |
1 |
| const char* path = SHM_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::I16S"); |
0 |
0 |
0 |
| const char* path = SHM_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::I16S"); |
0 |
1 |
1 |
|
| 74 |
1 |
▶ | if (!path) croak("Data::HashMap::Shared::I16S->new_readonly: path is required"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!path) croak("Data::HashMap::Shared::I16S->new_readonly: path is required"); |
1 |
0 |
1 |
|
| 75 |
0 |
| ShmHandle* map = shm_i16s_open_readonly(path, errbuf); |
| 76 |
0 |
▶ | if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
| if (!map) croak("Data::HashMap::Shared::I16S: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
|
| 77 |
0 |
| RETVAL = sv_setref_pv(newSV(0), class, (void*)map); |
| 78 |
|
| OUTPUT: |
| 79 |
|
| RETVAL |
| 80 |
|
| |
| 81 |
|
| void |
| 82 |
|
| freeze(SV* self_sv) |
| 83 |
|
| CODE: |
| 84 |
3 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
|
| 85 |
3 |
▶ | if (h->readonly || shm_is_fully_sealed(h)) croak("Data::HashMap::Shared::I16S->freeze: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_fully_sealed(h)) croak("Data::HashMap::Shared::I16S->freeze: map is frozen (read-only)"); |
2 |
1 |
3 |
| if (h->readonly || shm_is_fully_sealed(h)) croak("Data::HashMap::Shared::I16S->freeze: map is frozen (read-only)"); |
1 |
1 |
2 |
|
| 86 |
1 |
▶ | if (shm_freeze(h) != 0) croak("Data::HashMap::Shared::I16S->freeze: msync: %s", strerror(errno)); |
Branch: 1 branch
| Branch | True | False | Total |
| if (shm_freeze(h) != 0) croak("Data::HashMap::Shared::I16S->freeze: msync: %s", strerror(errno)); |
0 |
1 |
1 |
|
| 87 |
1 |
| shm_mark_readonly(h); |
| 88 |
|
| |
| 89 |
|
| UV |
| 90 |
|
| frozen(SV* self_sv) |
| 91 |
|
| CODE: |
| 92 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 93 |
0 |
▶ | RETVAL = (UV)shm_is_sealed(h); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (UV)shm_is_sealed(h); |
0 |
0 |
0 |
|
| 94 |
|
| OUTPUT: |
| 95 |
|
| RETVAL |
| 96 |
|
| |
| 97 |
|
| UV |
| 98 |
|
| readonly(SV* self_sv) |
| 99 |
|
| CODE: |
| 100 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
|
| 101 |
2 |
▶ | RETVAL = (UV)(h->readonly ? 1 : 0); |
Branch: 2 branches
| Branch | True | False | Total |
| RETVAL = (UV)(h->readonly ? 1 : 0); |
1 |
1 |
2 |
| RETVAL = (UV)(h->readonly ? 1 : 0); |
2 |
0 |
2 |
|
| 102 |
|
| OUTPUT: |
| 103 |
|
| RETVAL |
| 104 |
|
| |
| 105 |
|
| IV |
| 106 |
|
| memfd(SV* self_sv) |
| 107 |
|
| CODE: |
| 108 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 109 |
0 |
▶ | RETVAL = h->backing_fd; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = h->backing_fd; |
0 |
0 |
0 |
|
| 110 |
|
| OUTPUT: |
| 111 |
|
| RETVAL |
| 112 |
|
| |
| 113 |
|
| |
| 114 |
|
| void |
| 115 |
|
| sync(SV* self_sv) |
| 116 |
|
| CODE: |
| 117 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 118 |
0 |
▶ | if (shm_msync(h) != 0) croak("Data::HashMap::Shared::I16S->sync: %s", strerror(errno)); |
Branch: 1 branch
| Branch | True | False | Total |
| if (shm_msync(h) != 0) croak("Data::HashMap::Shared::I16S->sync: %s", strerror(errno)); |
0 |
0 |
0 |
|
| 119 |
|
| |
| 120 |
|
| void |
| 121 |
|
| DESTROY(SV* self_sv) |
| 122 |
|
| CODE: |
| 123 |
39 |
▶ | if (!sv_isobject(self_sv) || !sv_derived_from(self_sv, "Data::HashMap::Shared::I16S")) return; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!sv_isobject(self_sv) || !sv_derived_from(self_sv, "Data::HashMap::Shared::I16S")) return; |
39 |
0 |
39 |
| if (!sv_isobject(self_sv) || !sv_derived_from(self_sv, "Data::HashMap::Shared::I16S")) return; |
0 |
39 |
39 |
|
| 124 |
39 |
| ShmHandle* h = INT2PTR(ShmHandle*, SvIV(SvRV(self_sv))); |
| 125 |
39 |
▶ | if (!h) return; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!h) return; |
0 |
39 |
39 |
|
| 126 |
39 |
| sv_setiv(SvRV(self_sv), 0); |
| 127 |
39 |
| shm_close_map(h); |
| 128 |
|
| |
| 129 |
|
| bool |
| 130 |
|
| put(SV* self_sv, int16_t key, SV* value) |
| 131 |
|
| CODE: |
| 132 |
207 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
9 |
198 |
207 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
198 |
198 |
|
| 133 |
198 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
197 |
1 |
198 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
196 |
197 |
|
| 134 |
196 |
▶ | EXTRACT_STR_VAL(value); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_VAL(value); |
0 |
196 |
196 |
|
| 135 |
196 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
196 |
196 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
196 |
196 |
|
| 136 |
196 |
▶ | RETVAL = shm_i16s_put(h, key, _vstr, (uint32_t)_vlen, _vutf8); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_i16s_put(h, key, _vstr, (uint32_t)_vlen, _vutf8); |
182 |
14 |
196 |
|
| 137 |
|
| OUTPUT: |
| 138 |
|
| RETVAL |
| 139 |
|
| |
| 140 |
|
| UV |
| 141 |
|
| set_multi(SV* self_sv, ...) |
| 142 |
|
| CODE: |
| 143 |
4 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
4 |
4 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
4 |
4 |
|
| 144 |
4 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
3 |
1 |
4 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
2 |
3 |
|
| 145 |
2 |
▶ | if ((items - 1) % 2 != 0) croak("%s: set_multi requires an even number of arguments (key, value pairs)", shm_class); |
Branch: 1 branch
| Branch | True | False | Total |
| if ((items - 1) % 2 != 0) croak("%s: set_multi requires an even number of arguments (key, value pairs)", shm_class); |
1 |
1 |
2 |
|
| 146 |
1 |
| uint32_t count = 0; |
| 147 |
1 |
▶ | if (h->shard_handles) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (h->shard_handles) { |
0 |
1 |
1 |
|
| 148 |
0 |
▶ | for (int i = 1; i < items; i += 2) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 1; i < items; i += 2) { |
0 |
0 |
0 |
|
| 149 |
0 |
| int16_t _key = (int16_t)SvIV(ST(i)); |
| 150 |
0 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 151 |
0 |
| STRLEN _vl; const char *_vs = SvPV(ST(i+1), _vl); |
| 152 |
0 |
| bool _vu = SvUTF8(ST(i+1)) ? 1 : 0; |
| 153 |
0 |
▶ | if (_vl > SHM_MAX_STR_LEN) croak("%s: value too long (max 1GB)", shm_class); |
Branch: 1 branch
| Branch | True | False | Total |
| if (_vl > SHM_MAX_STR_LEN) croak("%s: value too long (max 1GB)", shm_class); |
0 |
0 |
0 |
|
| 154 |
0 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 155 |
0 |
| count += shm_i16s_put(h, _key, _vs, (uint32_t)_vl, _vu); |
| 156 |
|
| } |
| 157 |
|
| } else { |
| 158 |
|
| /* Materialize arguments before the lock: a re-entrant FETCH would |
| 159 |
|
| * self-deadlock. Magical strings are copied, plain ones held by pointer. */ |
| 160 |
1 |
| int _n = (items - 1) / 2; |
| 161 |
|
| int16_t *_ks; const char **_vs; STRLEN *_vl; bool *_vu; |
| 162 |
1 |
▶ | Newx(_ks, _n ? _n : 1, int16_t); SAVEFREEPV(_ks); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(_ks, _n ? _n : 1, int16_t); SAVEFREEPV(_ks); |
1 |
0 |
1 |
|
| 163 |
1 |
▶ | Newx(_vs, _n ? _n : 1, const char *); SAVEFREEPV(_vs); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(_vs, _n ? _n : 1, const char *); SAVEFREEPV(_vs); |
1 |
0 |
1 |
|
| 164 |
1 |
▶ | Newx(_vl, _n ? _n : 1, STRLEN); SAVEFREEPV(_vl); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(_vl, _n ? _n : 1, STRLEN); SAVEFREEPV(_vl); |
1 |
0 |
1 |
|
| 165 |
1 |
▶ | Newx(_vu, _n ? _n : 1, bool); SAVEFREEPV(_vu); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(_vu, _n ? _n : 1, bool); SAVEFREEPV(_vu); |
1 |
0 |
1 |
|
| 166 |
2 |
▶ | for (int i = 1, j = 0; i < items; i += 2, j++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 1, j = 0; i < items; i += 2, j++) { |
1 |
1 |
2 |
|
| 167 |
1 |
| _ks[j] = (int16_t)SvIV(ST(i)); |
| 168 |
1 |
| STRLEN _l; const char *_p = SvPV(ST(i+1), _l); |
| 169 |
1 |
▶ | if (_l > SHM_MAX_STR_LEN) croak("%s: value too long (max 1GB)", shm_class); |
Branch: 1 branch
| Branch | True | False | Total |
| if (_l > SHM_MAX_STR_LEN) croak("%s: value too long (max 1GB)", shm_class); |
0 |
1 |
1 |
|
| 170 |
1 |
▶ | SHM_COPY_IF_MAGICAL(ST(i+1), _p, _l); |
Branch: 1 branch
| Branch | True | False | Total |
| SHM_COPY_IF_MAGICAL(ST(i+1), _p, _l); |
1 |
0 |
1 |
|
| 171 |
1 |
| _vs[j] = _p; _vl[j] = _l; _vu[j] = SvUTF8(ST(i+1)) ? 1 : 0; |
| 172 |
|
| } |
| 173 |
1 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
1 |
1 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
1 |
1 |
|
| 174 |
1 |
| WRSEQ_BEGIN(h); |
| 175 |
2 |
▶ | for (int j = 0; j < _n; j++, shm_sig_check_every(h, (uint32_t)j, SHM_SIG_CHECK_ENTRIES)) |
Branch: 1 branch
| Branch | True | False | Total |
| for (int j = 0; j < _n; j++, shm_sig_check_every(h, (uint32_t)j, SHM_SIG_CHECK_ENTRIES)) |
1 |
1 |
2 |
|
| 176 |
1 |
| count += shm_i16s_put_inner(h, _ks[j], _vs[j], (uint32_t)_vl[j], _vu[j], SHM_TTL_USE_DEFAULT); |
| 177 |
1 |
| WRSEQ_END(h); |
| 178 |
|
| } |
| 179 |
1 |
▶ | RETVAL = count; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = count; |
1 |
0 |
1 |
|
| 180 |
|
| OUTPUT: |
| 181 |
|
| RETVAL |
| 182 |
|
| |
| 183 |
|
| UV |
| 184 |
|
| remove_multi(SV* self_sv, ...) |
| 185 |
|
| CODE: |
| 186 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
|
| 187 |
2 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
1 |
2 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
0 |
1 |
|
| 188 |
0 |
| uint32_t count = 0; |
| 189 |
0 |
▶ | if (h->shard_handles) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (h->shard_handles) { |
0 |
0 |
0 |
|
| 190 |
0 |
▶ | for (int i = 1; i < items; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 1; i < items; i++) { |
0 |
0 |
0 |
|
| 191 |
0 |
| int16_t _k = (int16_t)SvIV(ST(i)); |
| 192 |
0 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 193 |
0 |
| count += shm_i16s_remove(h, _k); |
| 194 |
|
| } |
| 195 |
|
| } else { |
| 196 |
0 |
| int _n = items - 1; |
| 197 |
|
| int16_t *_ks; |
| 198 |
0 |
▶ | Newx(_ks, _n ? _n : 1, int16_t); SAVEFREEPV(_ks); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(_ks, _n ? _n : 1, int16_t); SAVEFREEPV(_ks); |
0 |
0 |
0 |
|
| 199 |
0 |
▶ | for (int i = 1, j = 0; i < items; i++, j++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 1, j = 0; i < items; i++, j++) |
0 |
0 |
0 |
|
| 200 |
0 |
| _ks[j] = (int16_t)SvIV(ST(i)); /* FETCH before the lock */ |
| 201 |
0 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 202 |
0 |
| WRSEQ_BEGIN(h); |
| 203 |
0 |
▶ | for (int j = 0; j < _n; j++, shm_sig_check_every(h, (uint32_t)j, SHM_SIG_CHECK_ENTRIES)) |
Branch: 1 branch
| Branch | True | False | Total |
| for (int j = 0; j < _n; j++, shm_sig_check_every(h, (uint32_t)j, SHM_SIG_CHECK_ENTRIES)) |
0 |
0 |
0 |
|
| 204 |
0 |
| count += shm_i16s_remove_inner(h, _ks[j]); |
| 205 |
0 |
▶ | if (count) shm_i16s_maybe_shrink(h); |
Branch: 1 branch
| Branch | True | False | Total |
| if (count) shm_i16s_maybe_shrink(h); |
0 |
0 |
0 |
|
| 206 |
0 |
| WRSEQ_END(h); |
| 207 |
|
| } |
| 208 |
0 |
▶ | RETVAL = count; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = count; |
0 |
0 |
0 |
|
| 209 |
|
| OUTPUT: |
| 210 |
|
| RETVAL |
| 211 |
|
| |
| 212 |
|
| void |
| 213 |
|
| get_multi(SV* self_sv, ...) |
| 214 |
|
| PPCODE: |
| 215 |
20 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
20 |
20 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
20 |
20 |
|
| 216 |
20 |
| int nkeys = items - 1; |
| 217 |
20 |
▶ | if (nkeys == 0) XSRETURN_EMPTY; |
Branch: 1 branch
| Branch | True | False | Total |
| if (nkeys == 0) XSRETURN_EMPTY; |
0 |
20 |
20 |
|
| 218 |
20 |
▶ | EXTEND(SP, nkeys); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTEND(SP, nkeys); |
20 |
0 |
20 |
| EXTEND(SP, nkeys); |
0 |
20 |
20 |
|
| 219 |
20 |
▶ | if (h->shard_handles) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (h->shard_handles) { |
10 |
10 |
20 |
|
| 220 |
26 |
▶ | for (int i = 0; i < nkeys; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 0; i < nkeys; i++) { |
16 |
10 |
26 |
|
| 221 |
16 |
| int16_t key = (int16_t)SvIV(ST(i + 1)); |
| 222 |
|
| const char *out_s; uint32_t out_l; bool out_u; |
| 223 |
16 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
16 |
16 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
16 |
16 |
|
| 224 |
16 |
▶ | if (shm_i16s_get(h, key, &out_s, &out_l, &out_u)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (shm_i16s_get(h, key, &out_s, &out_l, &out_u)) { |
15 |
1 |
16 |
|
| 225 |
15 |
| SV *sv = newSVpvn(out_s, out_l); |
| 226 |
15 |
▶ | if (out_u) SvUTF8_on(sv); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_u) SvUTF8_on(sv); |
0 |
15 |
15 |
|
| 227 |
15 |
| mPUSHs(sv); |
| 228 |
1 |
| } else PUSHs(&PL_sv_undef); |
| 229 |
|
| } |
| 230 |
|
| } else { |
| 231 |
10 |
| ShmHeader *hdr = h->hdr; |
| 232 |
10 |
| ShmNodeI16S *nodes = (ShmNodeI16S *)h->nodes; |
| 233 |
10 |
| uint8_t *states = h->states; |
| 234 |
10 |
| char *arena = h->arena; |
| 235 |
10 |
| uint32_t *hashes = NULL; |
| 236 |
10 |
| Newx(hashes, nkeys, uint32_t); |
| 237 |
10 |
| SAVEFREEPV(hashes); |
| 238 |
10 |
| int64_t *keys = NULL; /* read once: a tied key's second FETCH may differ */ |
| 239 |
10 |
| Newx(keys, nkeys, int64_t); |
| 240 |
10 |
| SAVEFREEPV(keys); |
| 241 |
26 |
▶ | for (int i = 0; i < nkeys; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 0; i < nkeys; i++) |
16 |
10 |
26 |
|
| 242 |
16 |
| keys[i] = (int16_t)SvIV(ST(i + 1)); /* FETCH the keys before the lock */ |
| 243 |
10 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
10 |
10 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
10 |
10 |
|
| 244 |
10 |
| RDLOCK_GUARD(h); |
| 245 |
10 |
▶ | uint32_t now = h->expires_at ? shm_now() : 0; |
Branch: 1 branch
| Branch | True | False | Total |
| uint32_t now = h->expires_at ? shm_now() : 0; |
2 |
8 |
10 |
|
| 246 |
10 |
| uint32_t mask = hdr->table_cap - 1; |
| 247 |
26 |
▶ | for (int i = 0; i < nkeys; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 0; i < nkeys; i++) { |
16 |
10 |
26 |
|
| 248 |
16 |
| hashes[i] = shm_hash_int64(keys[i]); |
| 249 |
16 |
| __builtin_prefetch(&states[hashes[i] & mask], 0, 0); |
| 250 |
16 |
| __builtin_prefetch(&nodes[hashes[i] & mask], 0, 0); |
| 251 |
|
| } |
| 252 |
10 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
10 |
10 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
10 |
10 |
|
| 253 |
26 |
▶ | for (int i = 0; i < nkeys; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 0; i < nkeys; i++) { |
16 |
10 |
26 |
|
| 254 |
16 |
| int16_t key = (int16_t)keys[i]; |
| 255 |
16 |
| uint32_t hash = hashes[i]; |
| 256 |
16 |
| uint32_t pos = hash & mask; |
| 257 |
16 |
| uint8_t tag = SHM_MAKE_TAG(hash); |
| 258 |
16 |
| int found = 0; |
| 259 |
16 |
| uint32_t vidx = 0; |
| 260 |
16 |
▶ | for (uint32_t j = 0; j <= mask; j++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (uint32_t j = 0; j <= mask; j++) { |
16 |
0 |
16 |
|
| 261 |
16 |
| uint32_t idx = (pos + j) & mask; |
| 262 |
16 |
| uint8_t st = states[idx]; |
| 263 |
16 |
▶ | if (st == SHM_EMPTY) break; |
Branch: 1 branch
| Branch | True | False | Total |
| if (st == SHM_EMPTY) break; |
0 |
16 |
16 |
|
| 264 |
16 |
▶ | if (st != tag) continue; |
Branch: 1 branch
| Branch | True | False | Total |
| if (st != tag) continue; |
0 |
16 |
16 |
|
| 265 |
16 |
▶ | if (nodes[idx].key == key) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (nodes[idx].key == key) { |
16 |
0 |
16 |
|
| 266 |
16 |
▶ | if (h->expires_at && h->expires_at[idx] && now >= h->expires_at[idx]) break; |
Branch: 3 branches
| Branch | True | False | Total |
| if (h->expires_at && h->expires_at[idx] && now >= h->expires_at[idx]) break; |
3 |
13 |
16 |
| if (h->expires_at && h->expires_at[idx] && now >= h->expires_at[idx]) break; |
1 |
2 |
3 |
| if (h->expires_at && h->expires_at[idx] && now >= h->expires_at[idx]) break; |
1 |
0 |
1 |
|
| 267 |
15 |
| vidx = idx; found = 1; break; |
| 268 |
|
| } |
| 269 |
|
| } |
| 270 |
16 |
▶ | if (found) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (found) { |
15 |
1 |
16 |
|
| 271 |
15 |
| shm_lru_mark(h, vidx); |
| 272 |
|
| char _vib[SHM_INLINE_MAX]; uint32_t vl; |
| 273 |
15 |
| const char *vp = shm_str_ptr(nodes[vidx].val_off, nodes[vidx].val_len, arena, h->hdr->arena_cap, _vib, &vl); |
| 274 |
15 |
| SV *sv = newSVpvn(vp, vl); |
| 275 |
15 |
▶ | if (SHM_UNPACK_UTF8(nodes[vidx].val_len)) SvUTF8_on(sv); |
Branch: 1 branch
| Branch | True | False | Total |
| if (SHM_UNPACK_UTF8(nodes[vidx].val_len)) SvUTF8_on(sv); |
0 |
15 |
15 |
|
| 276 |
15 |
| mPUSHs(sv); |
| 277 |
1 |
| } else PUSHs(&PL_sv_undef); |
| 278 |
16 |
▶ | if (i + 1 < nkeys) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (i + 1 < nkeys) { |
6 |
10 |
16 |
|
| 279 |
6 |
| uint32_t npos = hashes[i + 1] & mask; |
| 280 |
6 |
| __builtin_prefetch(&states[npos], 0, 0); |
| 281 |
6 |
| __builtin_prefetch(&nodes[npos], 0, 0); |
| 282 |
|
| } |
| 283 |
|
| } |
| 284 |
|
| } |
| 285 |
|
| |
| 286 |
|
| void |
| 287 |
|
| get_with_ttl(SV* self_sv, int16_t key) |
| 288 |
|
| PPCODE: |
| 289 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 290 |
|
| const char *out_s; uint32_t out_l; bool out_u; |
| 291 |
|
| int64_t out_ttl; |
| 292 |
0 |
▶ | if (!shm_i16s_get_with_ttl(h, key, &out_s, &out_l, &out_u, &out_ttl)) XSRETURN_EMPTY; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!shm_i16s_get_with_ttl(h, key, &out_s, &out_l, &out_u, &out_ttl)) XSRETURN_EMPTY; |
0 |
0 |
0 |
|
| 293 |
0 |
▶ | EXTEND(SP, 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 2); |
0 |
0 |
0 |
|
| 294 |
0 |
| SV *vsv = newSVpvn(out_s, out_l); |
| 295 |
0 |
▶ | if (out_u) SvUTF8_on(vsv); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_u) SvUTF8_on(vsv); |
0 |
0 |
0 |
|
| 296 |
0 |
| mPUSHs(vsv); |
| 297 |
0 |
▶ | if (out_ttl < 0) PUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_ttl < 0) PUSHs(&PL_sv_undef); |
0 |
0 |
0 |
|
| 298 |
0 |
| else mPUSHi(out_ttl); |
| 299 |
|
| |
| 300 |
|
| SV* |
| 301 |
|
| stats(SV* self_sv) |
| 302 |
|
| CODE: |
| 303 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 304 |
0 |
| HV *hv = newHV(); |
| 305 |
0 |
| hv_store(hv, "size", 4, newSVuv(shm_i16s_size(h)), 0); |
| 306 |
0 |
| hv_store(hv, "capacity", 8, newSVuv(shm_i16s_capacity(h)), 0); |
| 307 |
0 |
| hv_store(hv, "max_entries", 11, newSVuv(shm_i16s_max_entries(h)), 0); |
| 308 |
0 |
| hv_store(hv, "tombstones", 10, newSVuv(shm_i16s_tombstones(h)), 0); |
| 309 |
0 |
| hv_store(hv, "mmap_size", 9, newSVuv(shm_i16s_mmap_size(h)), 0); |
| 310 |
0 |
| hv_store(hv, "arena_used", 10, newSVuv(shm_i16s_arena_used(h)), 0); |
| 311 |
0 |
| hv_store(hv, "arena_cap", 9, newSVuv(shm_i16s_arena_cap(h)), 0); |
| 312 |
0 |
| hv_store(hv, "evictions", 9, newSVuv(shm_i16s_stat_evictions(h)), 0); |
| 313 |
0 |
| hv_store(hv, "expired", 7, newSVuv(shm_i16s_stat_expired(h)), 0); |
| 314 |
0 |
| hv_store(hv, "recoveries", 10, newSVuv(shm_i16s_stat_recoveries(h)), 0); |
| 315 |
0 |
| hv_store(hv, "max_size", 8, newSVuv(shm_i16s_max_size(h)), 0); |
| 316 |
0 |
| hv_store(hv, "ttl", 3, newSVuv(shm_i16s_ttl(h)), 0); |
| 317 |
0 |
| hv_store(hv, "frozen", 6, newSVuv((UV)shm_is_sealed(h)), 0); |
| 318 |
0 |
▶ | hv_store(hv, "readonly", 8, newSVuv((UV)(h->readonly ? 1 : 0)), 0); |
Branch: 1 branch
| Branch | True | False | Total |
| hv_store(hv, "readonly", 8, newSVuv((UV)(h->readonly ? 1 : 0)), 0); |
0 |
0 |
0 |
|
| 319 |
0 |
| RETVAL = newRV_noinc((SV*)hv); |
| 320 |
|
| OUTPUT: |
| 321 |
|
| RETVAL |
| 322 |
|
| |
| 323 |
|
| bool |
| 324 |
|
| persist(SV* self_sv, int16_t key) |
| 325 |
|
| CODE: |
| 326 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
|
| 327 |
2 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
1 |
2 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
0 |
1 |
|
| 328 |
0 |
▶ | RETVAL = shm_i16s_persist(h, key); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_i16s_persist(h, key); |
0 |
0 |
0 |
|
| 329 |
|
| OUTPUT: |
| 330 |
|
| RETVAL |
| 331 |
|
| |
| 332 |
|
| bool |
| 333 |
|
| set_ttl(SV* self_sv, int16_t key, SV* ttl_sec_sv) |
| 334 |
|
| CODE: |
| 335 |
33 |
| uint32_t ttl_sec = shm_u32_arg(aTHX_ ttl_sec_sv, "ttl", "Data::HashMap::Shared::I16S", 0); |
| 336 |
32 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
32 |
32 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
32 |
32 |
|
| 337 |
32 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
31 |
1 |
32 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
30 |
31 |
|
| 338 |
30 |
▶ | RETVAL = shm_i16s_set_ttl(h, key, (uint32_t)ttl_sec); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_i16s_set_ttl(h, key, (uint32_t)ttl_sec); |
30 |
0 |
30 |
|
| 339 |
|
| OUTPUT: |
| 340 |
|
| RETVAL |
| 341 |
|
| |
| 342 |
|
| bool |
| 343 |
|
| put_ttl(SV* self_sv, int16_t key, SV* value, SV* ttl_sec_sv) |
| 344 |
|
| CODE: |
| 345 |
48 |
| uint32_t ttl_sec = shm_u32_arg(aTHX_ ttl_sec_sv, "ttl", "Data::HashMap::Shared::I16S", 0); |
| 346 |
47 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
47 |
47 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
47 |
47 |
|
| 347 |
47 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
46 |
1 |
47 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
45 |
46 |
|
| 348 |
45 |
▶ | EXTRACT_STR_VAL(value); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_VAL(value); |
0 |
45 |
45 |
|
| 349 |
45 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
45 |
45 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
45 |
45 |
|
| 350 |
45 |
▶ | REQUIRE_TTL(h); |
Branch: 2 branches
| Branch | True | False | Total |
| REQUIRE_TTL(h); |
3 |
42 |
45 |
| REQUIRE_TTL(h); |
1 |
44 |
45 |
|
| 351 |
44 |
▶ | RETVAL = shm_i16s_put_ttl(h, key, _vstr, (uint32_t)_vlen, _vutf8, (uint32_t)ttl_sec); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_i16s_put_ttl(h, key, _vstr, (uint32_t)_vlen, _vutf8, (uint32_t)ttl_sec); |
44 |
0 |
44 |
|
| 352 |
|
| OUTPUT: |
| 353 |
|
| RETVAL |
| 354 |
|
| |
| 355 |
|
| UV |
| 356 |
|
| max_size(SV* self_sv) |
| 357 |
|
| CODE: |
| 358 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 359 |
0 |
| RETVAL = (UV)shm_i16s_max_size(h); |
| 360 |
|
| OUTPUT: |
| 361 |
|
| RETVAL |
| 362 |
|
| |
| 363 |
|
| UV |
| 364 |
|
| ttl(SV* self_sv) |
| 365 |
|
| CODE: |
| 366 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 367 |
0 |
▶ | RETVAL = (UV)shm_i16s_ttl(h); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (UV)shm_i16s_ttl(h); |
0 |
0 |
0 |
|
| 368 |
|
| OUTPUT: |
| 369 |
|
| RETVAL |
| 370 |
|
| |
| 371 |
|
| SV* |
| 372 |
|
| get(SV* self_sv, int16_t key) |
| 373 |
|
| CODE: |
| 374 |
60 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
9 |
51 |
60 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
51 |
51 |
|
| 375 |
|
| const char* val; uint32_t val_len; bool val_utf8; |
| 376 |
51 |
▶ | if (!shm_i16s_get(h, key, &val, &val_len, &val_utf8)) XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!shm_i16s_get(h, key, &val, &val_len, &val_utf8)) XSRETURN_UNDEF; |
4 |
47 |
51 |
|
| 377 |
47 |
| RETVAL = newSVpvn(val, val_len); |
| 378 |
47 |
▶ | if (val_utf8) SvUTF8_on(RETVAL); |
Branch: 1 branch
| Branch | True | False | Total |
| if (val_utf8) SvUTF8_on(RETVAL); |
1 |
46 |
47 |
|
| 379 |
|
| OUTPUT: |
| 380 |
|
| RETVAL |
| 381 |
|
| |
| 382 |
|
| bool |
| 383 |
|
| remove(SV* self_sv, int16_t key) |
| 384 |
|
| CODE: |
| 385 |
4 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
4 |
4 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
4 |
4 |
|
| 386 |
4 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
3 |
1 |
4 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
2 |
3 |
|
| 387 |
2 |
▶ | RETVAL = shm_i16s_remove(h, key); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_i16s_remove(h, key); |
2 |
0 |
2 |
|
| 388 |
|
| OUTPUT: |
| 389 |
|
| RETVAL |
| 390 |
|
| |
| 391 |
|
| bool |
| 392 |
|
| exists(SV* self_sv, int16_t key) |
| 393 |
|
| CODE: |
| 394 |
7 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
7 |
7 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
7 |
7 |
|
| 395 |
7 |
▶ | RETVAL = shm_i16s_exists(h, key); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_i16s_exists(h, key); |
1 |
6 |
7 |
|
| 396 |
|
| OUTPUT: |
| 397 |
|
| RETVAL |
| 398 |
|
| |
| 399 |
|
| UV |
| 400 |
|
| size(SV* self_sv) |
| 401 |
|
| CODE: |
| 402 |
27 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
10 |
17 |
27 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
17 |
17 |
|
| 403 |
17 |
| RETVAL = (UV)shm_i16s_size(h); |
| 404 |
|
| OUTPUT: |
| 405 |
|
| RETVAL |
| 406 |
|
| |
| 407 |
|
| UV |
| 408 |
|
| max_entries(SV* self_sv) |
| 409 |
|
| CODE: |
| 410 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 411 |
0 |
| RETVAL = (UV)shm_i16s_max_entries(h); |
| 412 |
|
| OUTPUT: |
| 413 |
|
| RETVAL |
| 414 |
|
| |
| 415 |
|
| void |
| 416 |
|
| keys(SV* self_sv) |
| 417 |
|
| PPCODE: |
| 418 |
3 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
|
| 419 |
137 |
▶ | SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
Branch: 15 branches
| Branch | True | False | Total |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
1 |
2 |
3 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
4 |
2 |
6 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
5 |
1 |
6 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
0 |
6 |
6 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
0 |
6 |
6 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
0 |
0 |
0 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
0 |
0 |
0 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
0 |
0 |
0 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
90 |
38 |
128 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
90 |
0 |
90 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
90 |
0 |
90 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
88 |
2 |
90 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
129 |
5 |
134 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
128 |
1 |
129 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 0, SHM_COPY_INT(nodes[i].key)); |
6 |
3 |
9 |
|
| 420 |
|
| |
| 421 |
|
| void |
| 422 |
|
| values(SV* self_sv) |
| 423 |
|
| PPCODE: |
| 424 |
3 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
|
| 425 |
137 |
▶ | SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
Branch: 17 branches
| Branch | True | False | Total |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
1 |
2 |
3 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
4 |
2 |
6 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
5 |
1 |
6 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
0 |
6 |
6 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
0 |
6 |
6 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
0 |
0 |
0 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
0 |
0 |
0 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
0 |
0 |
0 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
90 |
38 |
128 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
90 |
0 |
90 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
90 |
0 |
90 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
88 |
2 |
90 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
0 |
88 |
88 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
30 |
58 |
88 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
129 |
5 |
134 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
128 |
1 |
129 |
| SHM_LIST_COPIES(ShmNodeI16S, 1, 1, SHM_COPY_STR(val_off, val_len)); |
6 |
3 |
9 |
|
| 426 |
|
| |
| 427 |
|
| void |
| 428 |
|
| items(SV* self_sv) |
| 429 |
|
| PPCODE: |
| 430 |
3 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
|
| 431 |
137 |
▶ | SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
Branch: 17 branches
| Branch | True | False | Total |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
1 |
2 |
3 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
4 |
2 |
6 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
5 |
1 |
6 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
0 |
6 |
6 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
0 |
6 |
6 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
0 |
0 |
0 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
0 |
0 |
0 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
0 |
0 |
0 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
90 |
38 |
128 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
90 |
0 |
90 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
90 |
0 |
90 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
88 |
2 |
90 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
0 |
88 |
88 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
30 |
58 |
88 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
129 |
5 |
134 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
128 |
1 |
129 |
| SHM_LIST_COPIES(ShmNodeI16S, 2, 2, |
6 |
3 |
9 |
|
| 432 |
|
| SHM_COPY_INT(nodes[i].key); |
| 433 |
|
| SHM_COPY_STR(val_off, val_len)); |
| 434 |
|
| |
| 435 |
|
| |
| 436 |
|
| void |
| 437 |
|
| each(SV* self_sv) |
| 438 |
|
| PPCODE: |
| 439 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 440 |
|
| int16_t out_key; |
| 441 |
|
| const char *out_val; uint32_t out_vlen; bool out_vutf8; |
| 442 |
0 |
▶ | if (shm_i16s_each(h, &out_key, &out_val, &out_vlen, &out_vutf8)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (shm_i16s_each(h, &out_key, &out_val, &out_vlen, &out_vutf8)) { |
0 |
0 |
0 |
|
| 443 |
0 |
▶ | EXTEND(SP, 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 2); |
0 |
0 |
0 |
|
| 444 |
0 |
▶ | mXPUSHi(out_key); |
Branch: 1 branch
| Branch | True | False | Total |
| mXPUSHi(out_key); |
0 |
0 |
0 |
|
| 445 |
0 |
| SV* sv = newSVpvn(out_val, out_vlen); |
| 446 |
0 |
▶ | if (out_vutf8) SvUTF8_on(sv); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_vutf8) SvUTF8_on(sv); |
0 |
0 |
0 |
|
| 447 |
0 |
▶ | mXPUSHs(sv); |
Branch: 1 branch
| Branch | True | False | Total |
| mXPUSHs(sv); |
0 |
0 |
0 |
|
| 448 |
0 |
| XSRETURN(2); |
| 449 |
|
| } |
| 450 |
0 |
| shm_i16s_flush_deferred(h); |
| 451 |
0 |
| XSRETURN_EMPTY; |
| 452 |
|
| |
| 453 |
|
| void |
| 454 |
|
| iter_reset(SV* self_sv) |
| 455 |
|
| CODE: |
| 456 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 457 |
0 |
| shm_i16s_iter_reset(h); |
| 458 |
0 |
| shm_i16s_flush_deferred(h); |
| 459 |
|
| |
| 460 |
|
| void |
| 461 |
|
| clear(SV* self_sv) |
| 462 |
|
| CODE: |
| 463 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
|
| 464 |
2 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
1 |
2 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
0 |
1 |
|
| 465 |
0 |
| shm_i16s_clear(h); |
| 466 |
|
| |
| 467 |
|
| SV* |
| 468 |
|
| to_hash(SV* self_sv) |
| 469 |
|
| CODE: |
| 470 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
|
| 471 |
2 |
| SV* raw = sv_2mortal(newSV(1)); |
| 472 |
2 |
| AV* strs = (AV*)sv_2mortal((SV*)newAV()); |
| 473 |
2 |
| SSize_t n = 0, nraw = 0; |
| 474 |
2 |
▶ | uint32_t ns = h->shard_handles ? h->num_shards : 1; |
Branch: 1 branch
| Branch | True | False | Total |
| uint32_t ns = h->shard_handles ? h->num_shards : 1; |
1 |
1 |
2 |
|
| 475 |
2 |
| ENTER; |
| 476 |
7 |
▶ | for (uint32_t si = 0; si < ns; si++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (uint32_t si = 0; si < ns; si++) { |
5 |
2 |
7 |
|
| 477 |
5 |
▶ | ShmHandle *sh = h->shard_handles ? h->shard_handles[si] : h; |
Branch: 1 branch
| Branch | True | False | Total |
| ShmHandle *sh = h->shard_handles ? h->shard_handles[si] : h; |
4 |
1 |
5 |
|
| 478 |
5 |
| ShmHeader *hdr = sh->hdr; |
| 479 |
5 |
| ShmNodeI16S *nodes = (ShmNodeI16S *)sh->nodes; |
| 480 |
5 |
| RDLOCK_GUARD(sh); |
| 481 |
5 |
▶ | uint32_t now = sh->expires_at ? shm_now() : 0, left = hdr->size; |
Branch: 1 branch
| Branch | True | False | Total |
| uint32_t now = sh->expires_at ? shm_now() : 0, left = hdr->size; |
5 |
0 |
5 |
|
| 482 |
5 |
▶ | IV *r = (IV *)SvGROW(raw, (nraw + (STRLEN)left) * sizeof(IV) + 1); |
Branch: 2 branches
| Branch | True | False | Total |
| IV *r = (IV *)SvGROW(raw, (nraw + (STRLEN)left) * sizeof(IV) + 1); |
5 |
0 |
5 |
| IV *r = (IV *)SvGROW(raw, (nraw + (STRLEN)left) * sizeof(IV) + 1); |
5 |
0 |
5 |
|
| 483 |
5 |
| av_extend(strs, av_top_index(strs) + (SSize_t)left); |
| 484 |
133 |
▶ | for (uint32_t i = 0; i < hdr->table_cap && left; i++) { |
Branch: 2 branches
| Branch | True | False | Total |
| for (uint32_t i = 0; i < hdr->table_cap && left; i++) { |
128 |
5 |
133 |
| for (uint32_t i = 0; i < hdr->table_cap && left; i++) { |
128 |
0 |
128 |
|
| 485 |
128 |
▶ | if (SHM_IS_LIVE(sh->states[i]) && !SHM_IS_EXPIRED(sh, i, now)) { |
Branch: 4 branches
| Branch | True | False | Total |
| if (SHM_IS_LIVE(sh->states[i]) && !SHM_IS_EXPIRED(sh, i, now)) { |
90 |
38 |
128 |
| if (SHM_IS_LIVE(sh->states[i]) && !SHM_IS_EXPIRED(sh, i, now)) { |
90 |
0 |
90 |
| if (SHM_IS_LIVE(sh->states[i]) && !SHM_IS_EXPIRED(sh, i, now)) { |
90 |
0 |
90 |
| if (SHM_IS_LIVE(sh->states[i]) && !SHM_IS_EXPIRED(sh, i, now)) { |
88 |
2 |
90 |
|
| 486 |
|
| char _ib[SHM_INLINE_MAX]; uint32_t vlen; |
| 487 |
88 |
| const char *vp = shm_str_ptr(nodes[i].val_off, nodes[i].val_len, sh->arena, sh->hdr->arena_cap, _ib, &vlen); |
| 488 |
88 |
| SV* val = newSVpvn(vp, vlen); |
| 489 |
88 |
▶ | if (SHM_UNPACK_UTF8(nodes[i].val_len)) SvUTF8_on(val); |
Branch: 1 branch
| Branch | True | False | Total |
| if (SHM_UNPACK_UTF8(nodes[i].val_len)) SvUTF8_on(val); |
30 |
58 |
88 |
|
| 490 |
88 |
| r[nraw++] = (IV)nodes[i].key; |
| 491 |
88 |
| av_push(strs, val); |
| 492 |
88 |
| n++; left--; |
| 493 |
|
| } |
| 494 |
|
| } |
| 495 |
|
| } |
| 496 |
2 |
| LEAVE; |
| 497 |
|
| |
| 498 |
2 |
| RETVAL = shm_copies_to_hashref(aTHX_ raw, NULL, strs, n); |
| 499 |
|
| OUTPUT: |
| 500 |
|
| RETVAL |
| 501 |
|
| |
| 502 |
|
| SV* |
| 503 |
|
| get_or_set(SV* self_sv, int16_t key, SV* default_sv) |
| 504 |
|
| CODE: |
| 505 |
7 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
7 |
7 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
7 |
7 |
|
| 506 |
7 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
6 |
1 |
7 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
5 |
6 |
|
| 507 |
|
| const char *out_str; uint32_t out_len; bool out_utf8; |
| 508 |
5 |
▶ | EXTRACT_STR_VAL(default_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_VAL(default_sv); |
0 |
5 |
5 |
|
| 509 |
5 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
5 |
5 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
5 |
5 |
|
| 510 |
5 |
| int rc = shm_i16s_get_or_set(h, key, _vstr, (uint32_t)_vlen, _vutf8, &out_str, &out_len, &out_utf8); |
| 511 |
5 |
▶ | if (!rc) XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!rc) XSRETURN_UNDEF; |
1 |
4 |
5 |
|
| 512 |
4 |
| RETVAL = newSVpvn(out_str, out_len); |
| 513 |
4 |
▶ | if (out_utf8) SvUTF8_on(RETVAL); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_utf8) SvUTF8_on(RETVAL); |
0 |
4 |
4 |
|
| 514 |
|
| OUTPUT: |
| 515 |
|
| RETVAL |
| 516 |
|
| |
| 517 |
|
| SV* |
| 518 |
|
| ttl_remaining(SV* self_sv, int16_t key) |
| 519 |
|
| CODE: |
| 520 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 521 |
0 |
| int64_t remaining = shm_i16s_ttl_remaining(h, key); |
| 522 |
0 |
▶ | if (remaining < 0) XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| if (remaining < 0) XSRETURN_UNDEF; |
0 |
0 |
0 |
|
| 523 |
0 |
| RETVAL = newSViv(remaining); |
| 524 |
|
| OUTPUT: |
| 525 |
|
| RETVAL |
| 526 |
|
| |
| 527 |
|
| UV |
| 528 |
|
| capacity(SV* self_sv) |
| 529 |
|
| CODE: |
| 530 |
5 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
5 |
5 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
5 |
5 |
|
| 531 |
5 |
| RETVAL = (UV)shm_i16s_capacity(h); |
| 532 |
|
| OUTPUT: |
| 533 |
|
| RETVAL |
| 534 |
|
| |
| 535 |
|
| UV |
| 536 |
|
| tombstones(SV* self_sv) |
| 537 |
|
| CODE: |
| 538 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 539 |
0 |
| RETVAL = (UV)shm_i16s_tombstones(h); |
| 540 |
|
| OUTPUT: |
| 541 |
|
| RETVAL |
| 542 |
|
| |
| 543 |
|
| SV* |
| 544 |
|
| cursor(SV* self_sv) |
| 545 |
|
| CODE: |
| 546 |
1 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
1 |
1 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
1 |
1 |
|
| 547 |
1 |
| ShmCursor* c = shm_cursor_create(h); |
| 548 |
1 |
▶ | if (!c) croak("%s: failed to allocate a cursor", shm_class); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) croak("%s: failed to allocate a cursor", shm_class); |
0 |
1 |
1 |
|
| 549 |
1 |
| c->owner = SvREFCNT_inc(SvRV(self_sv)); |
| 550 |
1 |
| RETVAL = sv_setref_pv(newSV(0), "Data::HashMap::Shared::I16S::Cursor", (void*)c); |
| 551 |
|
| OUTPUT: |
| 552 |
|
| RETVAL |
| 553 |
|
| |
| 554 |
|
| SV* |
| 555 |
|
| take(SV* self_sv, int16_t key) |
| 556 |
|
| CODE: |
| 557 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
|
| 558 |
2 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
1 |
2 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
0 |
1 |
|
| 559 |
|
| const char *out_str; uint32_t out_len; bool out_utf8; |
| 560 |
0 |
▶ | if (!shm_i16s_take(h, key, &out_str, &out_len, &out_utf8)) XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!shm_i16s_take(h, key, &out_str, &out_len, &out_utf8)) XSRETURN_UNDEF; |
0 |
0 |
0 |
|
| 561 |
0 |
| RETVAL = newSVpvn(out_str, out_len); |
| 562 |
0 |
▶ | if (out_utf8) SvUTF8_on(RETVAL); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_utf8) SvUTF8_on(RETVAL); |
0 |
0 |
0 |
|
| 563 |
|
| OUTPUT: |
| 564 |
|
| RETVAL |
| 565 |
|
| |
| 566 |
|
| void |
| 567 |
|
| pop(SV* self_sv) |
| 568 |
|
| PPCODE: |
| 569 |
9 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
9 |
9 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
9 |
9 |
|
| 570 |
9 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
8 |
1 |
9 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
7 |
8 |
|
| 571 |
|
| int16_t out_key; |
| 572 |
|
| const char *out_val; uint32_t out_vlen; bool out_vutf8; |
| 573 |
7 |
▶ | if (!shm_i16s_pop(h, &out_key, &out_val, &out_vlen, &out_vutf8)) XSRETURN_EMPTY; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!shm_i16s_pop(h, &out_key, &out_val, &out_vlen, &out_vutf8)) XSRETURN_EMPTY; |
3 |
4 |
7 |
|
| 574 |
4 |
▶ | EXTEND(SP, 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 2); |
0 |
4 |
4 |
|
| 575 |
4 |
| mPUSHi(out_key); |
| 576 |
4 |
| SV *vsv = newSVpvn(out_val, out_vlen); |
| 577 |
4 |
▶ | if (out_vutf8) SvUTF8_on(vsv); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_vutf8) SvUTF8_on(vsv); |
0 |
4 |
4 |
|
| 578 |
4 |
| mPUSHs(vsv); |
| 579 |
|
| |
| 580 |
|
| void |
| 581 |
|
| shift(SV* self_sv) |
| 582 |
|
| PPCODE: |
| 583 |
8 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
8 |
8 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
8 |
8 |
|
| 584 |
8 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
7 |
1 |
8 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
6 |
7 |
|
| 585 |
|
| int16_t out_key; |
| 586 |
|
| const char *out_val; uint32_t out_vlen; bool out_vutf8; |
| 587 |
6 |
▶ | if (!shm_i16s_shift(h, &out_key, &out_val, &out_vlen, &out_vutf8)) XSRETURN_EMPTY; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!shm_i16s_shift(h, &out_key, &out_val, &out_vlen, &out_vutf8)) XSRETURN_EMPTY; |
3 |
3 |
6 |
|
| 588 |
3 |
▶ | EXTEND(SP, 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 2); |
0 |
3 |
3 |
|
| 589 |
3 |
| mPUSHi(out_key); |
| 590 |
3 |
| SV *vsv = newSVpvn(out_val, out_vlen); |
| 591 |
3 |
▶ | if (out_vutf8) SvUTF8_on(vsv); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_vutf8) SvUTF8_on(vsv); |
0 |
3 |
3 |
|
| 592 |
3 |
| mPUSHs(vsv); |
| 593 |
|
| |
| 594 |
|
| void |
| 595 |
|
| drain(SV* self_sv, SV* limit_sv) |
| 596 |
|
| PPCODE: |
| 597 |
2 |
| UV limit = shm_count_arg(aTHX_ limit_sv, "drain limit", "Data::HashMap::Shared::I16S"); |
| 598 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
|
| 599 |
2 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
1 |
2 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
0 |
1 |
|
| 600 |
|
| /* Only as many as the map can yield: limit sizes the allocation. */ |
| 601 |
|
| { |
| 602 |
0 |
| UV avail = (UV)shm_i16s_size(h); |
| 603 |
0 |
▶ | if (limit > avail) limit = avail; |
Branch: 1 branch
| Branch | True | False | Total |
| if (limit > avail) limit = avail; |
0 |
0 |
0 |
|
| 604 |
0 |
▶ | if (limit > UINT32_MAX) limit = UINT32_MAX; |
Branch: 1 branch
| Branch | True | False | Total |
| if (limit > UINT32_MAX) limit = UINT32_MAX; |
0 |
0 |
0 |
|
| 605 |
|
| } |
| 606 |
0 |
▶ | if (limit == 0) XSRETURN_EMPTY; |
Branch: 1 branch
| Branch | True | False | Total |
| if (limit == 0) XSRETURN_EMPTY; |
0 |
0 |
0 |
|
| 607 |
|
| shm_i16s_drain_entry *entries; |
| 608 |
0 |
▶ | Newxz(entries, limit, shm_i16s_drain_entry); |
Branch: 1 branch
| Branch | True | False | Total |
| Newxz(entries, limit, shm_i16s_drain_entry); |
0 |
0 |
0 |
|
| 609 |
|
| |
| 610 |
0 |
| SAVEFREEPV(entries); |
| 611 |
0 |
| char *buf = NULL; uint32_t buf_cap = 0; |
| 612 |
0 |
| uint32_t n = shm_i16s_drain(h, (uint32_t)limit, entries, &buf, &buf_cap); |
| 613 |
0 |
▶ | if (buf) SAVEDESTRUCTOR_X(shm_free_cleanup, buf); |
Branch: 1 branch
| Branch | True | False | Total |
| if (buf) SAVEDESTRUCTOR_X(shm_free_cleanup, buf); |
0 |
0 |
0 |
|
| 614 |
|
| |
| 615 |
0 |
▶ | EXTEND(SP, (SSize_t)n * 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, (SSize_t)n * 2); |
0 |
0 |
0 |
|
| 616 |
0 |
▶ | for (uint32_t i = 0; i < n; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (uint32_t i = 0; i < n; i++) { |
0 |
0 |
0 |
|
| 617 |
0 |
| mPUSHi(entries[i].key); |
| 618 |
0 |
| SV *vsv = newSVpvn(buf + entries[i].val_off, entries[i].val_len); |
| 619 |
0 |
▶ | if (entries[i].val_utf8) SvUTF8_on(vsv); |
Branch: 1 branch
| Branch | True | False | Total |
| if (entries[i].val_utf8) SvUTF8_on(vsv); |
0 |
0 |
0 |
|
| 620 |
0 |
| mPUSHs(vsv); |
| 621 |
|
| } |
| 622 |
|
| |
| 623 |
|
| |
| 624 |
|
| UV |
| 625 |
|
| flush_expired(SV* self_sv) |
| 626 |
|
| CODE: |
| 627 |
3 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
|
| 628 |
3 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
2 |
1 |
3 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
1 |
2 |
|
| 629 |
1 |
▶ | RETVAL = (UV)shm_i16s_flush_expired(h); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (UV)shm_i16s_flush_expired(h); |
0 |
1 |
1 |
|
| 630 |
|
| OUTPUT: |
| 631 |
|
| RETVAL |
| 632 |
|
| |
| 633 |
|
| void |
| 634 |
|
| flush_expired_partial(SV* self_sv, SV* limit_sv) |
| 635 |
|
| PPCODE: |
| 636 |
16 |
| uint32_t limit = shm_u32_arg(aTHX_ limit_sv, "limit", "Data::HashMap::Shared::I16S", 0); |
| 637 |
15 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
15 |
15 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
15 |
15 |
|
| 638 |
15 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
14 |
1 |
15 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
13 |
14 |
|
| 639 |
13 |
| int done = 0; |
| 640 |
13 |
| uint32_t flushed = shm_i16s_flush_expired_partial(h, (uint32_t)limit, &done); |
| 641 |
13 |
▶ | EXTEND(SP, 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 2); |
0 |
13 |
13 |
|
| 642 |
13 |
| mPUSHu(flushed); |
| 643 |
13 |
| mPUSHi(done); |
| 644 |
|
| |
| 645 |
|
| UV |
| 646 |
|
| mmap_size(SV* self_sv) |
| 647 |
|
| CODE: |
| 648 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 649 |
0 |
| RETVAL = (UV)shm_i16s_mmap_size(h); |
| 650 |
|
| OUTPUT: |
| 651 |
|
| RETVAL |
| 652 |
|
| |
| 653 |
|
| bool |
| 654 |
|
| touch(SV* self_sv, int16_t key) |
| 655 |
|
| CODE: |
| 656 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
|
| 657 |
2 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
1 |
2 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
0 |
1 |
|
| 658 |
0 |
▶ | RETVAL = shm_i16s_touch(h, key); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_i16s_touch(h, key); |
0 |
0 |
0 |
|
| 659 |
|
| OUTPUT: |
| 660 |
|
| RETVAL |
| 661 |
|
| |
| 662 |
|
| bool |
| 663 |
|
| reserve(SV* self_sv, SV* target_sv) |
| 664 |
|
| CODE: |
| 665 |
5 |
| uint32_t target = shm_u32_arg(aTHX_ target_sv, "target", "Data::HashMap::Shared::I16S", 0); |
| 666 |
4 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
4 |
4 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
4 |
4 |
|
| 667 |
4 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
3 |
1 |
4 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
2 |
3 |
|
| 668 |
2 |
▶ | RETVAL = shm_i16s_reserve(h, (uint32_t)target); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_i16s_reserve(h, (uint32_t)target); |
2 |
0 |
2 |
|
| 669 |
|
| OUTPUT: |
| 670 |
|
| RETVAL |
| 671 |
|
| |
| 672 |
|
| UV |
| 673 |
|
| stat_evictions(SV* self_sv) |
| 674 |
|
| CODE: |
| 675 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 676 |
0 |
| RETVAL = (UV)shm_i16s_stat_evictions(h); |
| 677 |
|
| OUTPUT: |
| 678 |
|
| RETVAL |
| 679 |
|
| |
| 680 |
|
| UV |
| 681 |
|
| stat_expired(SV* self_sv) |
| 682 |
|
| CODE: |
| 683 |
6 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
6 |
6 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
6 |
6 |
|
| 684 |
6 |
| RETVAL = (UV)shm_i16s_stat_expired(h); |
| 685 |
|
| OUTPUT: |
| 686 |
|
| RETVAL |
| 687 |
|
| |
| 688 |
|
| UV |
| 689 |
|
| stat_recoveries(SV* self_sv) |
| 690 |
|
| CODE: |
| 691 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 692 |
0 |
| RETVAL = (UV)shm_i16s_stat_recoveries(h); |
| 693 |
|
| OUTPUT: |
| 694 |
|
| RETVAL |
| 695 |
|
| |
| 696 |
|
| UV |
| 697 |
|
| compact(SV* self_sv) |
| 698 |
|
| CODE: |
| 699 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
|
| 700 |
2 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
1 |
2 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
0 |
1 |
|
| 701 |
0 |
| RETVAL = (UV)shm_i16s_compact(h); |
| 702 |
|
| OUTPUT: |
| 703 |
|
| RETVAL |
| 704 |
|
| |
| 705 |
|
| UV |
| 706 |
|
| arena_used(SV* self_sv) |
| 707 |
|
| CODE: |
| 708 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 709 |
0 |
| RETVAL = (UV)shm_i16s_arena_used(h); |
| 710 |
|
| OUTPUT: |
| 711 |
|
| RETVAL |
| 712 |
|
| |
| 713 |
|
| UV |
| 714 |
|
| arena_cap(SV* self_sv) |
| 715 |
|
| CODE: |
| 716 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 717 |
0 |
| RETVAL = (UV)shm_i16s_arena_cap(h); |
| 718 |
|
| OUTPUT: |
| 719 |
|
| RETVAL |
| 720 |
|
| |
| 721 |
|
| bool |
| 722 |
|
| add(SV* self_sv, int16_t key, SV* val_sv) |
| 723 |
|
| CODE: |
| 724 |
5 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
5 |
5 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
5 |
5 |
|
| 725 |
5 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
4 |
1 |
5 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
3 |
4 |
|
| 726 |
3 |
▶ | EXTRACT_STR_VAL(val_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_VAL(val_sv); |
0 |
3 |
3 |
|
| 727 |
3 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
|
| 728 |
3 |
▶ | RETVAL = shm_i16s_add(h, key, _vstr, (uint32_t)_vlen, _vutf8); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_i16s_add(h, key, _vstr, (uint32_t)_vlen, _vutf8); |
2 |
1 |
3 |
|
| 729 |
|
| OUTPUT: |
| 730 |
|
| RETVAL |
| 731 |
|
| |
| 732 |
|
| bool |
| 733 |
|
| add_ttl(SV* self_sv, int16_t key, SV* val_sv, SV* ttl_sec_sv) |
| 734 |
|
| CODE: |
| 735 |
6 |
| uint32_t ttl_sec = shm_u32_arg(aTHX_ ttl_sec_sv, "ttl", "Data::HashMap::Shared::I16S", 0); |
| 736 |
5 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
5 |
5 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
5 |
5 |
|
| 737 |
5 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
4 |
1 |
5 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
3 |
4 |
|
| 738 |
3 |
▶ | EXTRACT_STR_VAL(val_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_VAL(val_sv); |
0 |
3 |
3 |
|
| 739 |
3 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
|
| 740 |
3 |
▶ | REQUIRE_TTL(h); |
Branch: 2 branches
| Branch | True | False | Total |
| REQUIRE_TTL(h); |
0 |
3 |
3 |
| REQUIRE_TTL(h); |
1 |
2 |
3 |
|
| 741 |
2 |
▶ | RETVAL = shm_i16s_add_ttl(h, key, _vstr, (uint32_t)_vlen, _vutf8, (uint32_t)ttl_sec); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_i16s_add_ttl(h, key, _vstr, (uint32_t)_vlen, _vutf8, (uint32_t)ttl_sec); |
1 |
1 |
2 |
|
| 742 |
|
| OUTPUT: |
| 743 |
|
| RETVAL |
| 744 |
|
| |
| 745 |
|
| bool |
| 746 |
|
| update(SV* self_sv, int16_t key, SV* val_sv) |
| 747 |
|
| CODE: |
| 748 |
4 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
4 |
4 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
4 |
4 |
|
| 749 |
4 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
3 |
1 |
4 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
2 |
3 |
|
| 750 |
2 |
▶ | EXTRACT_STR_VAL(val_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_VAL(val_sv); |
0 |
2 |
2 |
|
| 751 |
2 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
|
| 752 |
2 |
▶ | RETVAL = shm_i16s_update(h, key, _vstr, (uint32_t)_vlen, _vutf8); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_i16s_update(h, key, _vstr, (uint32_t)_vlen, _vutf8); |
2 |
0 |
2 |
|
| 753 |
|
| OUTPUT: |
| 754 |
|
| RETVAL |
| 755 |
|
| |
| 756 |
|
| bool |
| 757 |
|
| update_ttl(SV* self_sv, int16_t key, SV* val_sv, SV* ttl_sec_sv) |
| 758 |
|
| CODE: |
| 759 |
4 |
| uint32_t ttl_sec = shm_u32_arg(aTHX_ ttl_sec_sv, "ttl", "Data::HashMap::Shared::I16S", 0); |
| 760 |
3 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
3 |
3 |
|
| 761 |
3 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
2 |
1 |
3 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
1 |
2 |
|
| 762 |
1 |
▶ | EXTRACT_STR_VAL(val_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_VAL(val_sv); |
0 |
1 |
1 |
|
| 763 |
1 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
1 |
1 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
1 |
1 |
|
| 764 |
1 |
▶ | REQUIRE_TTL(h); |
Branch: 2 branches
| Branch | True | False | Total |
| REQUIRE_TTL(h); |
0 |
1 |
1 |
| REQUIRE_TTL(h); |
1 |
0 |
1 |
|
| 765 |
0 |
▶ | RETVAL = shm_i16s_update_ttl(h, key, _vstr, (uint32_t)_vlen, _vutf8, (uint32_t)ttl_sec); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_i16s_update_ttl(h, key, _vstr, (uint32_t)_vlen, _vutf8, (uint32_t)ttl_sec); |
0 |
0 |
0 |
|
| 766 |
|
| OUTPUT: |
| 767 |
|
| RETVAL |
| 768 |
|
| |
| 769 |
|
| SV* |
| 770 |
|
| swap(SV* self_sv, int16_t key, SV* val_sv) |
| 771 |
|
| CODE: |
| 772 |
4 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
4 |
4 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
4 |
4 |
|
| 773 |
4 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
3 |
1 |
4 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
2 |
3 |
|
| 774 |
2 |
▶ | EXTRACT_STR_VAL(val_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_VAL(val_sv); |
0 |
2 |
2 |
|
| 775 |
|
| const char *out_s; uint32_t out_l; bool out_u; |
| 776 |
2 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
|
| 777 |
2 |
| int rc = shm_i16s_swap(h, key, _vstr, (uint32_t)_vlen, _vutf8, &out_s, &out_l, &out_u); |
| 778 |
2 |
▶ | if (rc != 1) XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| if (rc != 1) XSRETURN_UNDEF; |
1 |
1 |
2 |
|
| 779 |
1 |
| RETVAL = newSVpvn(out_s, out_l); |
| 780 |
1 |
▶ | if (out_u) SvUTF8_on(RETVAL); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_u) SvUTF8_on(RETVAL); |
0 |
1 |
1 |
|
| 781 |
|
| OUTPUT: |
| 782 |
|
| RETVAL |
| 783 |
|
| |
| 784 |
|
| bool |
| 785 |
|
| cas(SV* self_sv, int16_t key, SV* expected_sv, SV* desired_sv) |
| 786 |
|
| CODE: |
| 787 |
9 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
9 |
9 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
9 |
9 |
|
| 788 |
9 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
8 |
1 |
9 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
7 |
8 |
|
| 789 |
14 |
▶ | EXTRACT_STR_EXPECTED_DESIRED(expected_sv, desired_sv); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_STR_EXPECTED_DESIRED(expected_sv, desired_sv); |
0 |
7 |
7 |
| EXTRACT_STR_EXPECTED_DESIRED(expected_sv, desired_sv); |
1 |
6 |
7 |
| EXTRACT_STR_EXPECTED_DESIRED(expected_sv, desired_sv); |
0 |
7 |
7 |
|
| 790 |
7 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
7 |
7 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
7 |
7 |
|
| 791 |
7 |
▶ | RETVAL = shm_i16s_cas(h, key, _estr, (uint32_t)_elen, _dstr, (uint32_t)_dlen, _dutf8); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_i16s_cas(h, key, _estr, (uint32_t)_elen, _dstr, (uint32_t)_dlen, _dutf8); |
5 |
2 |
7 |
|
| 792 |
|
| OUTPUT: |
| 793 |
|
| RETVAL |
| 794 |
|
| |
| 795 |
|
| SV* |
| 796 |
|
| cas_take(SV* self_sv, int16_t key, SV* expected_sv) |
| 797 |
|
| CODE: |
| 798 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
2 |
2 |
|
| 799 |
2 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
1 |
2 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::I16S: map is frozen (read-only)"); |
1 |
0 |
1 |
|
| 800 |
0 |
▶ | EXTRACT_STR_EXPECTED(expected_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_EXPECTED(expected_sv); |
0 |
0 |
0 |
|
| 801 |
|
| const char *out_s; uint32_t out_l; bool out_u; |
| 802 |
0 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 803 |
0 |
▶ | if (!shm_i16s_cas_take(h, key, _estr, (uint32_t)_elen, &out_s, &out_l, &out_u)) XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!shm_i16s_cas_take(h, key, _estr, (uint32_t)_elen, &out_s, &out_l, &out_u)) XSRETURN_UNDEF; |
0 |
0 |
0 |
|
| 804 |
0 |
| RETVAL = newSVpvn(out_s, out_l); |
| 805 |
0 |
▶ | if (out_u) SvUTF8_on(RETVAL); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_u) SvUTF8_on(RETVAL); |
0 |
0 |
0 |
|
| 806 |
|
| OUTPUT: |
| 807 |
|
| RETVAL |
| 808 |
|
| |
| 809 |
|
| SV* |
| 810 |
|
| path(SV* self_sv) |
| 811 |
|
| CODE: |
| 812 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_sv); |
0 |
0 |
0 |
|
| 813 |
0 |
▶ | RETVAL = h->path ? newSVpv(h->path, 0) : &PL_sv_undef; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = h->path ? newSVpv(h->path, 0) : &PL_sv_undef; |
0 |
0 |
0 |
|
| 814 |
|
| OUTPUT: |
| 815 |
|
| RETVAL |
| 816 |
|
| |
| 817 |
|
| bool |
| 818 |
|
| unlink(SV* self_or_class, ...) |
| 819 |
|
| CODE: |
| 820 |
0 |
▶ | if (sv_isobject(self_or_class) && sv_derived_from(self_or_class, "Data::HashMap::Shared::I16S")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (sv_isobject(self_or_class) && sv_derived_from(self_or_class, "Data::HashMap::Shared::I16S")) { |
0 |
0 |
0 |
| if (sv_isobject(self_or_class) && sv_derived_from(self_or_class, "Data::HashMap::Shared::I16S")) { |
0 |
0 |
0 |
|
| 821 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::I16S", self_or_class); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_or_class); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::I16S", self_or_class); |
0 |
0 |
0 |
|
| 822 |
0 |
▶ | if (h->path) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (h->path) { |
0 |
0 |
0 |
|
| 823 |
0 |
▶ | SHM_TAINT_CHECK("Data::HashMap::Shared::I16S->unlink"); |
Branch: 1 branch
| Branch | True | False | Total |
| SHM_TAINT_CHECK("Data::HashMap::Shared::I16S->unlink"); |
0 |
0 |
0 |
|
| 824 |
0 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_or_class); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_or_class); |
0 |
0 |
0 |
| REEXTRACT_MAP("Data::HashMap::Shared::I16S", self_or_class); |
0 |
0 |
0 |
|
| 825 |
|
| } |
| 826 |
0 |
| RETVAL = shm_unlink_sharded(h); |
| 827 |
|
| } else { |
| 828 |
0 |
▶ | if (items < 2) croak("Usage: Data::HashMap::Shared::I16S->unlink($path)"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 2) croak("Usage: Data::HashMap::Shared::I16S->unlink($path)"); |
0 |
0 |
0 |
|
| 829 |
0 |
▶ | SvGETMAGIC(ST(1)); |
Branch: 2 branches
| Branch | True | False | Total |
| SvGETMAGIC(ST(1)); |
0 |
0 |
0 |
| SvGETMAGIC(ST(1)); |
0 |
0 |
0 |
|
| 830 |
0 |
| RETVAL = shm_unlink_path(shm_write_path_arg(aTHX_ ST(1), "path", "Data::HashMap::Shared::I16S", "Data::HashMap::Shared::I16S->unlink")); |
| 831 |
|
| } |
| 832 |
|
| OUTPUT: |
| 833 |
|
| RETVAL |
| 834 |
|
| |
| 835 |
|
| MODULE = Data::HashMap::Shared PACKAGE = Data::HashMap::Shared::I16S::Cursor |
| 836 |
|
| PROTOTYPES: DISABLE |
| 837 |
|
| |
| 838 |
|
| void |
| 839 |
|
| DESTROY(SV* self_sv) |
| 840 |
|
| CODE: |
| 841 |
1 |
▶ | if (!sv_isobject(self_sv) || !sv_derived_from(self_sv, "Data::HashMap::Shared::I16S::Cursor")) return; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!sv_isobject(self_sv) || !sv_derived_from(self_sv, "Data::HashMap::Shared::I16S::Cursor")) return; |
1 |
0 |
1 |
| if (!sv_isobject(self_sv) || !sv_derived_from(self_sv, "Data::HashMap::Shared::I16S::Cursor")) return; |
0 |
1 |
1 |
|
| 842 |
1 |
| ShmCursor* c = INT2PTR(ShmCursor*, SvIV(SvRV(self_sv))); |
| 843 |
1 |
▶ | if (!c) return; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return; |
0 |
1 |
1 |
|
| 844 |
1 |
▶ | CURSOR_DETACH_IF_MAP_GONE(c, owner, h); |
Branch: 3 branches
| Branch | True | False | Total |
| CURSOR_DETACH_IF_MAP_GONE(c, owner, h); |
1 |
0 |
1 |
| CURSOR_DETACH_IF_MAP_GONE(c, owner, h); |
1 |
0 |
1 |
| CURSOR_DETACH_IF_MAP_GONE(c, owner, h); |
1 |
0 |
1 |
|
| 845 |
1 |
| shm_cursor_destroy(c); |
| 846 |
1 |
▶ | if (h) shm_i16s_flush_deferred(h); |
Branch: 1 branch
| Branch | True | False | Total |
| if (h) shm_i16s_flush_deferred(h); |
0 |
1 |
1 |
|
| 847 |
1 |
▶ | if (owner) SvREFCNT_dec(owner); |
Branch: 1 branch
| Branch | True | False | Total |
| if (owner) SvREFCNT_dec(owner); |
1 |
0 |
1 |
|
| 848 |
1 |
| sv_setiv(SvRV(self_sv), 0); |
| 849 |
|
| |
| 850 |
|
| void |
| 851 |
|
| next(SV* self_sv) |
| 852 |
|
| PPCODE: |
| 853 |
5 |
▶ | EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
Branch: 4 branches
| Branch | True | False | Total |
| EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
2 |
3 |
5 |
| EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
0 |
3 |
3 |
| EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
3 |
0 |
3 |
| EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
0 |
3 |
3 |
|
| 854 |
|
| int16_t out_key; |
| 855 |
|
| const char *out_val; uint32_t out_vlen; bool out_vutf8; |
| 856 |
3 |
▶ | if (shm_i16s_cursor_next(c, &out_key, &out_val, &out_vlen, &out_vutf8)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (shm_i16s_cursor_next(c, &out_key, &out_val, &out_vlen, &out_vutf8)) { |
2 |
1 |
3 |
|
| 857 |
2 |
▶ | EXTEND(SP, 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 2); |
0 |
2 |
2 |
|
| 858 |
2 |
▶ | mXPUSHi(out_key); |
Branch: 1 branch
| Branch | True | False | Total |
| mXPUSHi(out_key); |
0 |
2 |
2 |
|
| 859 |
2 |
| SV* sv = newSVpvn(out_val, out_vlen); |
| 860 |
2 |
▶ | if (out_vutf8) SvUTF8_on(sv); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_vutf8) SvUTF8_on(sv); |
1 |
1 |
2 |
|
| 861 |
2 |
▶ | mXPUSHs(sv); |
Branch: 1 branch
| Branch | True | False | Total |
| mXPUSHs(sv); |
0 |
2 |
2 |
|
| 862 |
2 |
| XSRETURN(2); |
| 863 |
|
| } |
| 864 |
1 |
| XSRETURN_EMPTY; |
| 865 |
|
| |
| 866 |
|
| void |
| 867 |
|
| reset(SV* self_sv) |
| 868 |
|
| CODE: |
| 869 |
0 |
▶ | EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
Branch: 4 branches
| Branch | True | False | Total |
| EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
0 |
0 |
0 |
| EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
0 |
0 |
0 |
| EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
0 |
0 |
0 |
| EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
0 |
0 |
0 |
|
| 870 |
0 |
| shm_i16s_cursor_reset(c); |
| 871 |
|
| |
| 872 |
|
| bool |
| 873 |
|
| seek(SV* self_sv, int16_t key) |
| 874 |
|
| CODE: |
| 875 |
0 |
▶ | EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
Branch: 4 branches
| Branch | True | False | Total |
| EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
0 |
0 |
0 |
| EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
0 |
0 |
0 |
| EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
0 |
0 |
0 |
| EXTRACT_CURSOR("Data::HashMap::Shared::I16S::Cursor", self_sv); |
0 |
0 |
0 |
|
| 876 |
0 |
▶ | RETVAL = shm_i16s_cursor_seek(c, key); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_i16s_cursor_seek(c, key); |
0 |
0 |
0 |
|
| 877 |
|
| OUTPUT: |
| 878 |
|
| RETVAL |
| 879 |
|
| |