| 1 |
|
| MODULE = Data::HashMap::Shared PACKAGE = Data::HashMap::Shared::SI |
| 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 |
80 |
| const char *class = shm_invocant_class(aTHX_ class_sv, "Data::HashMap::Shared::SI"); |
| 8 |
80 |
| uint32_t max_entries = shm_u32_arg(aTHX_ max_entries_sv, "max_entries", "Data::HashMap::Shared::SI", 0); |
| 9 |
79 |
| uint32_t lru_max = shm_u32_arg(aTHX_ lru_max_sv, "lru_max", "Data::HashMap::Shared::SI", 0); |
| 10 |
78 |
| uint32_t ttl_default = shm_u32_arg(aTHX_ ttl_default_sv, "ttl_default", "Data::HashMap::Shared::SI", 0); |
| 11 |
77 |
| uint32_t lru_skip = shm_u32_arg(aTHX_ lru_skip_sv, "lru_skip", "Data::HashMap::Shared::SI", 0); |
| 12 |
76 |
▶ | uint64_t arena_cap = arena_cap_sv ? shm_count_arg(aTHX_ arena_cap_sv, "arena_cap", "Data::HashMap::Shared::SI") : 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::SI") : 0; |
4 |
72 |
76 |
|
| 13 |
76 |
▶ | UV file_mode = file_mode_sv ? shm_count_arg(aTHX_ file_mode_sv, "file_mode", "Data::HashMap::Shared::SI") : 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::SI") : 0600; |
0 |
76 |
76 |
|
| 14 |
76 |
▶ | char errbuf[SHM_ERR_BUFLEN]; const char* path = SHM_WRITE_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::SI", "new"); ShmHandle* map = shm_si_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::SI"), 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::SI", "new"); ShmHandle* map = shm_si_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::SI"), errbuf); |
0 |
76 |
76 |
| char errbuf[SHM_ERR_BUFLEN]; const char* path = SHM_WRITE_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::SI", "new"); ShmHandle* map = shm_si_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::SI"), errbuf); |
0 |
0 |
0 |
| char errbuf[SHM_ERR_BUFLEN]; const char* path = SHM_WRITE_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::SI", "new"); ShmHandle* map = shm_si_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::SI"), errbuf); |
63 |
13 |
76 |
|
| 15 |
76 |
▶ | if (!map) croak("Data::HashMap::Shared::SI: %s", errbuf[0] ? errbuf : "unknown error"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!map) croak("Data::HashMap::Shared::SI: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
76 |
76 |
| if (!map) croak("Data::HashMap::Shared::SI: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
|
| 16 |
76 |
▶ | SHM_RETURN_MAP(map, "Data::HashMap::Shared::SI", class); |
Branch: 2 branches
| Branch | True | False | Total |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::SI", class); |
0 |
76 |
76 |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::SI", class); |
0 |
76 |
76 |
|
| 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 |
14 |
| const char *class = shm_invocant_class(aTHX_ class_sv, "Data::HashMap::Shared::SI"); |
| 24 |
14 |
▶ | const char* path_prefix = SHM_WRITE_PATH_ARG(path_prefix_sv, "path prefix", "Data::HashMap::Shared::SI", "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::SI", "new_sharded"); |
0 |
14 |
14 |
| const char* path_prefix = SHM_WRITE_PATH_ARG(path_prefix_sv, "path prefix", "Data::HashMap::Shared::SI", "new_sharded"); |
0 |
0 |
0 |
| const char* path_prefix = SHM_WRITE_PATH_ARG(path_prefix_sv, "path prefix", "Data::HashMap::Shared::SI", "new_sharded"); |
14 |
0 |
14 |
|
| 25 |
14 |
| uint32_t max_entries = shm_u32_arg(aTHX_ max_entries_sv, "max_entries", "Data::HashMap::Shared::SI", 0); |
| 26 |
13 |
| uint32_t lru_max = shm_u32_arg(aTHX_ lru_max_sv, "lru_max", "Data::HashMap::Shared::SI", 0); |
| 27 |
12 |
| uint32_t ttl_default = shm_u32_arg(aTHX_ ttl_default_sv, "ttl_default", "Data::HashMap::Shared::SI", 0); |
| 28 |
11 |
| uint32_t lru_skip = shm_u32_arg(aTHX_ lru_skip_sv, "lru_skip", "Data::HashMap::Shared::SI", 0); |
| 29 |
10 |
▶ | uint64_t arena_cap = arena_cap_sv ? shm_count_arg(aTHX_ arena_cap_sv, "arena_cap", "Data::HashMap::Shared::SI") : 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::SI") : 0; |
0 |
10 |
10 |
|
| 30 |
10 |
▶ | UV file_mode = file_mode_sv ? shm_count_arg(aTHX_ file_mode_sv, "file_mode", "Data::HashMap::Shared::SI") : 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::SI") : 0600; |
0 |
10 |
10 |
|
| 31 |
10 |
| uint32_t num_shards = shm_u32_arg(aTHX_ num_shards_sv, "num_shards", "Data::HashMap::Shared::SI", 0); |
| 32 |
9 |
| char errbuf[SHM_ERR_BUFLEN]; ShmHandle* map = shm_si_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::SI"), errbuf); |
| 33 |
9 |
▶ | if (!map) croak("Data::HashMap::Shared::SI: %s", errbuf[0] ? errbuf : "unknown error"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!map) croak("Data::HashMap::Shared::SI: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
9 |
9 |
| if (!map) croak("Data::HashMap::Shared::SI: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
|
| 34 |
9 |
▶ | SHM_RETURN_MAP(map, "Data::HashMap::Shared::SI", class); |
Branch: 2 branches
| Branch | True | False | Total |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::SI", class); |
9 |
0 |
9 |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::SI", class); |
0 |
9 |
9 |
|
| 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::SI"); |
| 43 |
|
| char errbuf[SHM_ERR_BUFLEN]; |
| 44 |
4 |
▶ | const char* name = SHM_PATH_ARG(name_sv, "name", "Data::HashMap::Shared::SI"); |
Branch: 3 branches
| Branch | True | False | Total |
| const char* name = SHM_PATH_ARG(name_sv, "name", "Data::HashMap::Shared::SI"); |
0 |
4 |
4 |
| const char* name = SHM_PATH_ARG(name_sv, "name", "Data::HashMap::Shared::SI"); |
0 |
0 |
0 |
| const char* name = SHM_PATH_ARG(name_sv, "name", "Data::HashMap::Shared::SI"); |
4 |
0 |
4 |
|
| 45 |
4 |
| uint32_t max_entries = shm_u32_arg(aTHX_ max_entries_sv, "max_entries", "Data::HashMap::Shared::SI", 0); |
| 46 |
3 |
| uint32_t lru_max = shm_u32_arg(aTHX_ lru_max_sv, "lru_max", "Data::HashMap::Shared::SI", 0); |
| 47 |
2 |
| uint32_t ttl_default = shm_u32_arg(aTHX_ ttl_default_sv, "ttl_default", "Data::HashMap::Shared::SI", 0); |
| 48 |
1 |
| uint32_t lru_skip = shm_u32_arg(aTHX_ lru_skip_sv, "lru_skip", "Data::HashMap::Shared::SI", 0); |
| 49 |
0 |
▶ | uint64_t arena_cap = arena_cap_sv ? shm_count_arg(aTHX_ arena_cap_sv, "arena_cap", "Data::HashMap::Shared::SI") : 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::SI") : 0; |
0 |
0 |
0 |
|
| 50 |
0 |
| ShmHandle* map = shm_si_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::SI: %s", errbuf[0] ? errbuf : "unknown error"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!map) croak("Data::HashMap::Shared::SI: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
| if (!map) croak("Data::HashMap::Shared::SI: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
|
| 52 |
0 |
▶ | SHM_RETURN_MAP(map, "Data::HashMap::Shared::SI", class); |
Branch: 2 branches
| Branch | True | False | Total |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::SI", class); |
0 |
0 |
0 |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::SI", 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::SI"); |
| 60 |
|
| char errbuf[SHM_ERR_BUFLEN]; |
| 61 |
0 |
▶ | SHM_TAINT_CHECK("Data::HashMap::Shared::SI->new_from_fd"); |
Branch: 1 branch
| Branch | True | False | Total |
| SHM_TAINT_CHECK("Data::HashMap::Shared::SI->new_from_fd"); |
0 |
0 |
0 |
|
| 62 |
0 |
| ShmHandle* map = shm_si_open_fd(fd, errbuf); |
| 63 |
0 |
▶ | if (!map) croak("Data::HashMap::Shared::SI: %s", errbuf[0] ? errbuf : "unknown error"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!map) croak("Data::HashMap::Shared::SI: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
| if (!map) croak("Data::HashMap::Shared::SI: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
|
| 64 |
0 |
▶ | SHM_RETURN_MAP(map, "Data::HashMap::Shared::SI", class); |
Branch: 2 branches
| Branch | True | False | Total |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::SI", class); |
0 |
0 |
0 |
| SHM_RETURN_MAP(map, "Data::HashMap::Shared::SI", 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::SI"); |
| 72 |
|
| char errbuf[SHM_ERR_BUFLEN]; |
| 73 |
1 |
▶ | const char* path = SHM_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::SI"); |
Branch: 3 branches
| Branch | True | False | Total |
| const char* path = SHM_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::SI"); |
0 |
1 |
1 |
| const char* path = SHM_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::SI"); |
0 |
0 |
0 |
| const char* path = SHM_PATH_ARG(path_sv, "path", "Data::HashMap::Shared::SI"); |
0 |
1 |
1 |
|
| 74 |
1 |
▶ | if (!path) croak("Data::HashMap::Shared::SI->new_readonly: path is required"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!path) croak("Data::HashMap::Shared::SI->new_readonly: path is required"); |
1 |
0 |
1 |
|
| 75 |
0 |
| ShmHandle* map = shm_si_open_readonly(path, errbuf); |
| 76 |
0 |
▶ | if (!map) croak("Data::HashMap::Shared::SI: %s", errbuf[0] ? errbuf : "unknown error"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!map) croak("Data::HashMap::Shared::SI: %s", errbuf[0] ? errbuf : "unknown error"); |
0 |
0 |
0 |
| if (!map) croak("Data::HashMap::Shared::SI: %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::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
|
| 85 |
3 |
▶ | if (h->readonly || shm_is_fully_sealed(h)) croak("Data::HashMap::Shared::SI->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::SI->freeze: map is frozen (read-only)"); |
2 |
1 |
3 |
| if (h->readonly || shm_is_fully_sealed(h)) croak("Data::HashMap::Shared::SI->freeze: map is frozen (read-only)"); |
1 |
1 |
2 |
|
| 86 |
1 |
▶ | if (shm_freeze(h) != 0) croak("Data::HashMap::Shared::SI->freeze: msync: %s", strerror(errno)); |
Branch: 1 branch
| Branch | True | False | Total |
| if (shm_freeze(h) != 0) croak("Data::HashMap::Shared::SI->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::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", 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::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", 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::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", 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 |
1 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
|
| 118 |
1 |
▶ | if (shm_msync(h) != 0) croak("Data::HashMap::Shared::SI->sync: %s", strerror(errno)); |
Branch: 1 branch
| Branch | True | False | Total |
| if (shm_msync(h) != 0) croak("Data::HashMap::Shared::SI->sync: %s", strerror(errno)); |
0 |
1 |
1 |
|
| 119 |
|
| |
| 120 |
|
| void |
| 121 |
|
| DESTROY(SV* self_sv) |
| 122 |
|
| CODE: |
| 123 |
85 |
▶ | if (!sv_isobject(self_sv) || !sv_derived_from(self_sv, "Data::HashMap::Shared::SI")) return; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!sv_isobject(self_sv) || !sv_derived_from(self_sv, "Data::HashMap::Shared::SI")) return; |
85 |
0 |
85 |
| if (!sv_isobject(self_sv) || !sv_derived_from(self_sv, "Data::HashMap::Shared::SI")) return; |
0 |
85 |
85 |
|
| 124 |
85 |
| ShmHandle* h = INT2PTR(ShmHandle*, SvIV(SvRV(self_sv))); |
| 125 |
85 |
▶ | if (!h) return; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!h) return; |
0 |
85 |
85 |
|
| 126 |
85 |
| sv_setiv(SvRV(self_sv), 0); |
| 127 |
85 |
| shm_close_map(h); |
| 128 |
|
| |
| 129 |
|
| bool |
| 130 |
|
| put(SV* self_sv, SV* key_sv, int64_t value) |
| 131 |
|
| CODE: |
| 132 |
32757 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
9 |
32748 |
32757 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
32748 |
32748 |
|
| 133 |
32748 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
32747 |
1 |
32748 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
32746 |
32747 |
|
| 134 |
32746 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
32746 |
32746 |
|
| 135 |
32746 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
32746 |
32746 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
32746 |
32746 |
|
| 136 |
32746 |
▶ | RETVAL = shm_si_put(h, _kstr, (uint32_t)_klen, _kutf8, value); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_si_put(h, _kstr, (uint32_t)_klen, _kutf8, value); |
32740 |
6 |
32746 |
|
| 137 |
|
| OUTPUT: |
| 138 |
|
| RETVAL |
| 139 |
|
| |
| 140 |
|
| UV |
| 141 |
|
| set_multi(SV* self_sv, ...) |
| 142 |
|
| CODE: |
| 143 |
6 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
6 |
6 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
6 |
6 |
|
| 144 |
6 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
5 |
1 |
6 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
4 |
5 |
|
| 145 |
4 |
▶ | 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 |
3 |
4 |
|
| 146 |
3 |
| uint32_t count = 0; |
| 147 |
|
| /* Value first: its get-magic can free the key's PV. It lands in a local |
| 148 |
|
| * so `h` is read after the magic, whatever the argument evaluation order. */ |
| 149 |
3 |
▶ | if (h->shard_handles) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (h->shard_handles) { |
1 |
2 |
3 |
|
| 150 |
10001 |
▶ | for (int i = 1; i < items; i += 2) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 1; i < items; i += 2) { |
10000 |
1 |
10001 |
|
| 151 |
10000 |
| int64_t _val = (int64_t)SvIV(ST(i + 1)); |
| 152 |
10000 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
10000 |
10000 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
10000 |
10000 |
|
| 153 |
10000 |
| STRLEN _klen; const char *_kstr = SvPV(ST(i), _klen); |
| 154 |
10000 |
| bool _kutf8 = SvUTF8(ST(i)) ? 1 : 0; |
| 155 |
10000 |
▶ | if (_klen > SHM_MAX_STR_LEN) croak("%s: key too long (max 1GB)", shm_class); |
Branch: 1 branch
| Branch | True | False | Total |
| if (_klen > SHM_MAX_STR_LEN) croak("%s: key too long (max 1GB)", shm_class); |
0 |
10000 |
10000 |
|
| 156 |
10000 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
10000 |
10000 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
10000 |
10000 |
|
| 157 |
10000 |
| count += shm_si_put(h, _kstr, (uint32_t)_klen, _kutf8, _val); |
| 158 |
|
| } |
| 159 |
|
| } else { |
| 160 |
|
| /* Materialize arguments before the lock: a re-entrant FETCH would |
| 161 |
|
| * self-deadlock. Magical strings are copied, plain ones held by pointer. */ |
| 162 |
2 |
| int _n = (items - 1) / 2; |
| 163 |
|
| const char **_ks; STRLEN *_kl; bool *_ku; int64_t *_vs; |
| 164 |
2 |
▶ | Newx(_ks, _n ? _n : 1, const char *); SAVEFREEPV(_ks); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(_ks, _n ? _n : 1, const char *); SAVEFREEPV(_ks); |
2 |
0 |
2 |
|
| 165 |
2 |
▶ | Newx(_kl, _n ? _n : 1, STRLEN); SAVEFREEPV(_kl); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(_kl, _n ? _n : 1, STRLEN); SAVEFREEPV(_kl); |
2 |
0 |
2 |
|
| 166 |
2 |
▶ | Newx(_ku, _n ? _n : 1, bool); SAVEFREEPV(_ku); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(_ku, _n ? _n : 1, bool); SAVEFREEPV(_ku); |
2 |
0 |
2 |
|
| 167 |
2 |
▶ | Newx(_vs, _n ? _n : 1, int64_t); SAVEFREEPV(_vs); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(_vs, _n ? _n : 1, int64_t); SAVEFREEPV(_vs); |
2 |
0 |
2 |
|
| 168 |
10003 |
▶ | 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++) { |
10001 |
2 |
10003 |
|
| 169 |
10001 |
| _vs[j] = (int64_t)SvIV(ST(i + 1)); |
| 170 |
10001 |
| STRLEN _l; const char *_p = SvPV(ST(i), _l); |
| 171 |
10001 |
▶ | if (_l > SHM_MAX_STR_LEN) croak("%s: key too long (max 1GB)", shm_class); |
Branch: 1 branch
| Branch | True | False | Total |
| if (_l > SHM_MAX_STR_LEN) croak("%s: key too long (max 1GB)", shm_class); |
0 |
10001 |
10001 |
|
| 172 |
10001 |
▶ | SHM_COPY_IF_MAGICAL(ST(i), _p, _l); |
Branch: 1 branch
| Branch | True | False | Total |
| SHM_COPY_IF_MAGICAL(ST(i), _p, _l); |
1 |
10000 |
10001 |
|
| 173 |
10001 |
| _ks[j] = _p; _kl[j] = _l; _ku[j] = SvUTF8(ST(i)) ? 1 : 0; |
| 174 |
|
| } |
| 175 |
2 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
|
| 176 |
2 |
| WRSEQ_BEGIN(h); |
| 177 |
10003 |
▶ | 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)) |
10001 |
2 |
10003 |
|
| 178 |
10001 |
| count += shm_si_put_inner(h, _ks[j], (uint32_t)_kl[j], _ku[j], _vs[j], SHM_TTL_USE_DEFAULT); |
| 179 |
2 |
| WRSEQ_END(h); |
| 180 |
|
| } |
| 181 |
3 |
▶ | RETVAL = count; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = count; |
3 |
0 |
3 |
|
| 182 |
|
| OUTPUT: |
| 183 |
|
| RETVAL |
| 184 |
|
| |
| 185 |
|
| UV |
| 186 |
|
| remove_multi(SV* self_sv, ...) |
| 187 |
|
| CODE: |
| 188 |
3 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
|
| 189 |
3 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
2 |
1 |
3 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
1 |
2 |
|
| 190 |
1 |
| uint32_t count = 0; |
| 191 |
1 |
▶ | if (h->shard_handles) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (h->shard_handles) { |
0 |
1 |
1 |
|
| 192 |
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 |
|
| 193 |
0 |
| STRLEN _kl; const char *_ks = SvPV(ST(i), _kl); |
| 194 |
0 |
| bool _ku = SvUTF8(ST(i)) ? 1 : 0; |
| 195 |
0 |
▶ | if (_kl > SHM_MAX_STR_LEN) croak("%s: key too long (max 1GB)", shm_class); |
Branch: 1 branch
| Branch | True | False | Total |
| if (_kl > SHM_MAX_STR_LEN) croak("%s: key too long (max 1GB)", shm_class); |
0 |
0 |
0 |
|
| 196 |
0 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
|
| 197 |
0 |
| count += shm_si_remove(h, _ks, (uint32_t)_kl, _ku); |
| 198 |
|
| } |
| 199 |
|
| } else { |
| 200 |
1 |
| int _n = items - 1; |
| 201 |
|
| const char **_ks; STRLEN *_kl; bool *_ku; |
| 202 |
1 |
▶ | Newx(_ks, _n ? _n : 1, const char *); SAVEFREEPV(_ks); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(_ks, _n ? _n : 1, const char *); SAVEFREEPV(_ks); |
1 |
0 |
1 |
|
| 203 |
1 |
▶ | Newx(_kl, _n ? _n : 1, STRLEN); SAVEFREEPV(_kl); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(_kl, _n ? _n : 1, STRLEN); SAVEFREEPV(_kl); |
1 |
0 |
1 |
|
| 204 |
1 |
▶ | Newx(_ku, _n ? _n : 1, bool); SAVEFREEPV(_ku); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(_ku, _n ? _n : 1, bool); SAVEFREEPV(_ku); |
1 |
0 |
1 |
|
| 205 |
2 |
▶ | 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++) { |
1 |
1 |
2 |
|
| 206 |
1 |
| STRLEN _l; const char *_p = SvPV(ST(i), _l); |
| 207 |
1 |
▶ | if (_l > SHM_MAX_STR_LEN) croak("%s: key too long (max 1GB)", shm_class); |
Branch: 1 branch
| Branch | True | False | Total |
| if (_l > SHM_MAX_STR_LEN) croak("%s: key too long (max 1GB)", shm_class); |
0 |
1 |
1 |
|
| 208 |
1 |
▶ | SHM_COPY_IF_MAGICAL(ST(i), _p, _l); |
Branch: 1 branch
| Branch | True | False | Total |
| SHM_COPY_IF_MAGICAL(ST(i), _p, _l); |
1 |
0 |
1 |
|
| 209 |
1 |
| _ks[j] = _p; _kl[j] = _l; _ku[j] = SvUTF8(ST(i)) ? 1 : 0; |
| 210 |
|
| } |
| 211 |
1 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
|
| 212 |
1 |
| WRSEQ_BEGIN(h); |
| 213 |
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 |
|
| 214 |
1 |
| count += shm_si_remove_inner(h, _ks[j], (uint32_t)_kl[j], _ku[j]); |
| 215 |
1 |
▶ | if (count) shm_si_maybe_shrink(h); |
Branch: 1 branch
| Branch | True | False | Total |
| if (count) shm_si_maybe_shrink(h); |
1 |
0 |
1 |
|
| 216 |
1 |
| WRSEQ_END(h); |
| 217 |
|
| } |
| 218 |
1 |
▶ | RETVAL = count; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = count; |
1 |
0 |
1 |
|
| 219 |
|
| OUTPUT: |
| 220 |
|
| RETVAL |
| 221 |
|
| |
| 222 |
|
| void |
| 223 |
|
| get_multi(SV* self_sv, ...) |
| 224 |
|
| PPCODE: |
| 225 |
9 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
9 |
9 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
9 |
9 |
|
| 226 |
9 |
| int nkeys = items - 1; |
| 227 |
9 |
▶ | if (nkeys == 0) XSRETURN_EMPTY; |
Branch: 1 branch
| Branch | True | False | Total |
| if (nkeys == 0) XSRETURN_EMPTY; |
0 |
9 |
9 |
|
| 228 |
9 |
▶ | EXTEND(SP, nkeys); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTEND(SP, nkeys); |
9 |
0 |
9 |
| EXTEND(SP, nkeys); |
0 |
9 |
9 |
|
| 229 |
9 |
▶ | if (h->shard_handles) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (h->shard_handles) { |
4 |
5 |
9 |
|
| 230 |
10 |
▶ | for (int i = 0; i < nkeys; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 0; i < nkeys; i++) { |
6 |
4 |
10 |
|
| 231 |
6 |
| STRLEN _kl; const char *_ks = SvPV(ST(i + 1), _kl); |
| 232 |
6 |
| bool _ku = SvUTF8(ST(i + 1)) ? 1 : 0; |
| 233 |
6 |
▶ | if (_kl > SHM_MAX_STR_LEN) croak("%s: key too long (max 1GB)", shm_class); |
Branch: 1 branch
| Branch | True | False | Total |
| if (_kl > SHM_MAX_STR_LEN) croak("%s: key too long (max 1GB)", shm_class); |
0 |
6 |
6 |
|
| 234 |
|
| int64_t val; |
| 235 |
6 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
6 |
6 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
6 |
6 |
|
| 236 |
6 |
▶ | if (shm_si_get(h, _ks, (uint32_t)_kl, _ku, &val)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (shm_si_get(h, _ks, (uint32_t)_kl, _ku, &val)) |
5 |
1 |
6 |
|
| 237 |
5 |
| mPUSHi(val); |
| 238 |
|
| else |
| 239 |
1 |
| PUSHs(&PL_sv_undef); |
| 240 |
|
| } |
| 241 |
|
| } else { |
| 242 |
5 |
| ShmHeader *hdr = h->hdr; |
| 243 |
5 |
| ShmNodeSI *nodes = (ShmNodeSI *)h->nodes; |
| 244 |
5 |
| uint8_t *states = h->states; |
| 245 |
5 |
| char *arena = h->arena; |
| 246 |
5 |
| uint64_t arena_cap = h->hdr->arena_cap; |
| 247 |
|
| /* Materialize the keys before the read lock: a FETCH that writes this |
| 248 |
|
| * map would self-deadlock. Magical keys are copied. */ |
| 249 |
|
| const char **keys; STRLEN *klens; bool *kutf8; |
| 250 |
5 |
| Newx(keys, nkeys, const char *); SAVEFREEPV(keys); |
| 251 |
5 |
| Newx(klens, nkeys, STRLEN); SAVEFREEPV(klens); |
| 252 |
5 |
| Newx(kutf8, nkeys, bool); SAVEFREEPV(kutf8); |
| 253 |
12 |
▶ | for (int i = 0; i < nkeys; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 0; i < nkeys; i++) { |
7 |
5 |
12 |
|
| 254 |
7 |
| STRLEN _l; const char *_p = SvPV(ST(i + 1), _l); |
| 255 |
7 |
▶ | if (_l > SHM_MAX_STR_LEN) croak("%s: key too long (max 1GB)", shm_class); |
Branch: 1 branch
| Branch | True | False | Total |
| if (_l > SHM_MAX_STR_LEN) croak("%s: key too long (max 1GB)", shm_class); |
0 |
7 |
7 |
|
| 256 |
7 |
▶ | 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); |
3 |
4 |
7 |
|
| 257 |
7 |
| keys[i] = _p; klens[i] = _l; kutf8[i] = SvUTF8(ST(i + 1)) ? 1 : 0; |
| 258 |
|
| } |
| 259 |
5 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
5 |
5 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
5 |
5 |
|
| 260 |
5 |
| RDLOCK_GUARD(h); |
| 261 |
5 |
▶ | 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 |
3 |
5 |
|
| 262 |
5 |
| uint32_t mask = hdr->table_cap - 1; |
| 263 |
12 |
▶ | for (int i = 0; i < nkeys; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 0; i < nkeys; i++) { |
7 |
5 |
12 |
|
| 264 |
7 |
| const char *_ks = keys[i]; STRLEN _kl = klens[i]; bool _ku = kutf8[i]; |
| 265 |
7 |
| uint32_t hash = shm_hash_string(_ks, (uint32_t)_kl); |
| 266 |
7 |
| uint32_t pos = hash & mask; |
| 267 |
7 |
| uint8_t tag = SHM_MAKE_TAG(hash); |
| 268 |
7 |
| int found = 0; |
| 269 |
7 |
| uint32_t fidx = 0; |
| 270 |
7 |
| int64_t val = 0; |
| 271 |
8 |
▶ | for (uint32_t j = 0; j <= mask; j++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (uint32_t j = 0; j <= mask; j++) { |
8 |
0 |
8 |
|
| 272 |
8 |
| uint32_t idx = (pos + j) & mask; |
| 273 |
8 |
| uint8_t st = states[idx]; |
| 274 |
8 |
▶ | if (st == SHM_EMPTY) break; |
Branch: 1 branch
| Branch | True | False | Total |
| if (st == SHM_EMPTY) break; |
0 |
8 |
8 |
|
| 275 |
8 |
▶ | if (st != tag) continue; |
Branch: 1 branch
| Branch | True | False | Total |
| if (st != tag) continue; |
1 |
7 |
8 |
|
| 276 |
7 |
▶ | if (shm_si__key_eq_str(&nodes[idx], arena, arena_cap, _ks, (uint32_t)_kl, _ku)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (shm_si__key_eq_str(&nodes[idx], arena, arena_cap, _ks, (uint32_t)_kl, _ku)) { |
7 |
0 |
7 |
|
| 277 |
7 |
▶ | 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 |
4 |
7 |
| 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 |
|
| 278 |
6 |
| val = __atomic_load_n(&nodes[idx].value, __ATOMIC_RELAXED); |
| 279 |
6 |
| fidx = idx; |
| 280 |
6 |
| found = 1; break; |
| 281 |
|
| } |
| 282 |
|
| } |
| 283 |
7 |
▶ | if (found) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (found) { |
6 |
1 |
7 |
|
| 284 |
6 |
| shm_lru_mark(h, fidx); |
| 285 |
6 |
| mPUSHi(val); |
| 286 |
1 |
| } else PUSHs(&PL_sv_undef); |
| 287 |
7 |
▶ | if (i + 1 < nkeys) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (i + 1 < nkeys) { |
2 |
5 |
7 |
|
| 288 |
2 |
| uint32_t nh = shm_hash_string(keys[i + 1], (uint32_t)klens[i + 1]); |
| 289 |
2 |
| __builtin_prefetch(&states[nh & mask], 0, 0); |
| 290 |
|
| } |
| 291 |
|
| } |
| 292 |
|
| } |
| 293 |
|
| |
| 294 |
|
| void |
| 295 |
|
| get_with_ttl(SV* self_sv, SV* key_sv) |
| 296 |
|
| PPCODE: |
| 297 |
1 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
|
| 298 |
1 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
1 |
1 |
|
| 299 |
|
| int64_t out_value; |
| 300 |
|
| int64_t out_ttl; |
| 301 |
1 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
|
| 302 |
1 |
▶ | if (!shm_si_get_with_ttl(h, _kstr, (uint32_t)_klen, _kutf8, &out_value, &out_ttl)) XSRETURN_EMPTY; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!shm_si_get_with_ttl(h, _kstr, (uint32_t)_klen, _kutf8, &out_value, &out_ttl)) XSRETURN_EMPTY; |
0 |
1 |
1 |
|
| 303 |
1 |
▶ | EXTEND(SP, 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 2); |
0 |
1 |
1 |
|
| 304 |
1 |
| mPUSHi(out_value); |
| 305 |
1 |
▶ | if (out_ttl < 0) PUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_ttl < 0) PUSHs(&PL_sv_undef); |
0 |
1 |
1 |
|
| 306 |
1 |
| else mPUSHi(out_ttl); |
| 307 |
|
| |
| 308 |
|
| SV* |
| 309 |
|
| stats(SV* self_sv) |
| 310 |
|
| CODE: |
| 311 |
12 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
12 |
12 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
12 |
12 |
|
| 312 |
12 |
| HV *hv = newHV(); |
| 313 |
12 |
| hv_store(hv, "size", 4, newSVuv(shm_si_size(h)), 0); |
| 314 |
12 |
| hv_store(hv, "capacity", 8, newSVuv(shm_si_capacity(h)), 0); |
| 315 |
12 |
| hv_store(hv, "max_entries", 11, newSVuv(shm_si_max_entries(h)), 0); |
| 316 |
12 |
| hv_store(hv, "tombstones", 10, newSVuv(shm_si_tombstones(h)), 0); |
| 317 |
12 |
| hv_store(hv, "mmap_size", 9, newSVuv(shm_si_mmap_size(h)), 0); |
| 318 |
12 |
| hv_store(hv, "arena_used", 10, newSVuv(shm_si_arena_used(h)), 0); |
| 319 |
12 |
| hv_store(hv, "arena_cap", 9, newSVuv(shm_si_arena_cap(h)), 0); |
| 320 |
12 |
| hv_store(hv, "evictions", 9, newSVuv(shm_si_stat_evictions(h)), 0); |
| 321 |
12 |
| hv_store(hv, "expired", 7, newSVuv(shm_si_stat_expired(h)), 0); |
| 322 |
12 |
| hv_store(hv, "recoveries", 10, newSVuv(shm_si_stat_recoveries(h)), 0); |
| 323 |
12 |
| hv_store(hv, "max_size", 8, newSVuv(shm_si_max_size(h)), 0); |
| 324 |
12 |
| hv_store(hv, "ttl", 3, newSVuv(shm_si_ttl(h)), 0); |
| 325 |
12 |
| hv_store(hv, "frozen", 6, newSVuv((UV)shm_is_sealed(h)), 0); |
| 326 |
12 |
▶ | 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 |
12 |
12 |
|
| 327 |
12 |
| RETVAL = newRV_noinc((SV*)hv); |
| 328 |
|
| OUTPUT: |
| 329 |
|
| RETVAL |
| 330 |
|
| |
| 331 |
|
| bool |
| 332 |
|
| cas(SV* self_sv, SV* key_sv, int64_t expected, int64_t desired) |
| 333 |
|
| CODE: |
| 334 |
5 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
5 |
5 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
5 |
5 |
|
| 335 |
5 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
4 |
1 |
5 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
3 |
4 |
|
| 336 |
3 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
3 |
3 |
|
| 337 |
3 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
|
| 338 |
3 |
▶ | RETVAL = shm_si_cas(h, _kstr, (uint32_t)_klen, _kutf8, expected, desired); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_si_cas(h, _kstr, (uint32_t)_klen, _kutf8, expected, desired); |
2 |
1 |
3 |
|
| 339 |
|
| OUTPUT: |
| 340 |
|
| RETVAL |
| 341 |
|
| |
| 342 |
|
| SV* |
| 343 |
|
| cas_take(SV* self_sv, SV* key_sv, int64_t expected) |
| 344 |
|
| CODE: |
| 345 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
|
| 346 |
2 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
1 |
2 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
0 |
1 |
|
| 347 |
0 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
0 |
0 |
|
| 348 |
|
| int64_t out_value; |
| 349 |
0 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
|
| 350 |
0 |
▶ | if (!shm_si_cas_take(h, _kstr, (uint32_t)_klen, _kutf8, expected, &out_value)) XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!shm_si_cas_take(h, _kstr, (uint32_t)_klen, _kutf8, expected, &out_value)) XSRETURN_UNDEF; |
0 |
0 |
0 |
|
| 351 |
0 |
| RETVAL = newSViv(out_value); |
| 352 |
|
| OUTPUT: |
| 353 |
|
| RETVAL |
| 354 |
|
| |
| 355 |
|
| bool |
| 356 |
|
| persist(SV* self_sv, SV* key_sv) |
| 357 |
|
| CODE: |
| 358 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
|
| 359 |
2 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
1 |
2 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
0 |
1 |
|
| 360 |
0 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
0 |
0 |
|
| 361 |
0 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
|
| 362 |
0 |
▶ | RETVAL = shm_si_persist(h, _kstr, (uint32_t)_klen, _kutf8); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_si_persist(h, _kstr, (uint32_t)_klen, _kutf8); |
0 |
0 |
0 |
|
| 363 |
|
| OUTPUT: |
| 364 |
|
| RETVAL |
| 365 |
|
| |
| 366 |
|
| bool |
| 367 |
|
| set_ttl(SV* self_sv, SV* key_sv, SV* ttl_sec_sv) |
| 368 |
|
| CODE: |
| 369 |
34 |
| uint32_t ttl_sec = shm_u32_arg(aTHX_ ttl_sec_sv, "ttl", "Data::HashMap::Shared::SI", 0); |
| 370 |
33 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
33 |
33 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
33 |
33 |
|
| 371 |
33 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
32 |
1 |
33 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
31 |
32 |
|
| 372 |
31 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
31 |
31 |
|
| 373 |
31 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
31 |
31 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
31 |
31 |
|
| 374 |
31 |
▶ | RETVAL = shm_si_set_ttl(h, _kstr, (uint32_t)_klen, _kutf8, (uint32_t)ttl_sec); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_si_set_ttl(h, _kstr, (uint32_t)_klen, _kutf8, (uint32_t)ttl_sec); |
31 |
0 |
31 |
|
| 375 |
|
| OUTPUT: |
| 376 |
|
| RETVAL |
| 377 |
|
| |
| 378 |
|
| bool |
| 379 |
|
| put_ttl(SV* self_sv, SV* key_sv, int64_t value, SV* ttl_sec_sv) |
| 380 |
|
| CODE: |
| 381 |
2381 |
| uint32_t ttl_sec = shm_u32_arg(aTHX_ ttl_sec_sv, "ttl", "Data::HashMap::Shared::SI", 0); |
| 382 |
2380 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2380 |
2380 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2380 |
2380 |
|
| 383 |
2380 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
2379 |
1 |
2380 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
2378 |
2379 |
|
| 384 |
2378 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
2378 |
2378 |
|
| 385 |
2378 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2378 |
2378 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2378 |
2378 |
|
| 386 |
2378 |
▶ | REQUIRE_TTL(h); |
Branch: 2 branches
| Branch | True | False | Total |
| REQUIRE_TTL(h); |
3 |
2375 |
2378 |
| REQUIRE_TTL(h); |
1 |
2377 |
2378 |
|
| 387 |
2377 |
▶ | RETVAL = shm_si_put_ttl(h, _kstr, (uint32_t)_klen, _kutf8, value, (uint32_t)ttl_sec); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_si_put_ttl(h, _kstr, (uint32_t)_klen, _kutf8, value, (uint32_t)ttl_sec); |
2377 |
0 |
2377 |
|
| 388 |
|
| OUTPUT: |
| 389 |
|
| RETVAL |
| 390 |
|
| |
| 391 |
|
| UV |
| 392 |
|
| max_size(SV* self_sv) |
| 393 |
|
| CODE: |
| 394 |
1 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
|
| 395 |
1 |
| RETVAL = (UV)shm_si_max_size(h); |
| 396 |
|
| OUTPUT: |
| 397 |
|
| RETVAL |
| 398 |
|
| |
| 399 |
|
| UV |
| 400 |
|
| ttl(SV* self_sv) |
| 401 |
|
| CODE: |
| 402 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
|
| 403 |
0 |
▶ | RETVAL = (UV)shm_si_ttl(h); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (UV)shm_si_ttl(h); |
0 |
0 |
0 |
|
| 404 |
|
| OUTPUT: |
| 405 |
|
| RETVAL |
| 406 |
|
| |
| 407 |
|
| SV* |
| 408 |
|
| get(SV* self_sv, SV* key_sv) |
| 409 |
|
| CODE: |
| 410 |
55 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
9 |
46 |
55 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
46 |
46 |
|
| 411 |
46 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
46 |
46 |
|
| 412 |
|
| int64_t value; |
| 413 |
46 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
46 |
46 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
46 |
46 |
|
| 414 |
46 |
▶ | if (!shm_si_get(h, _kstr, (uint32_t)_klen, _kutf8, &value)) XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!shm_si_get(h, _kstr, (uint32_t)_klen, _kutf8, &value)) XSRETURN_UNDEF; |
4 |
42 |
46 |
|
| 415 |
42 |
| RETVAL = newSViv(value); |
| 416 |
|
| OUTPUT: |
| 417 |
|
| RETVAL |
| 418 |
|
| |
| 419 |
|
| bool |
| 420 |
|
| remove(SV* self_sv, SV* key_sv) |
| 421 |
|
| CODE: |
| 422 |
105 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
105 |
105 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
105 |
105 |
|
| 423 |
105 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
104 |
1 |
105 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
103 |
104 |
|
| 424 |
103 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
103 |
103 |
|
| 425 |
103 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
103 |
103 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
103 |
103 |
|
| 426 |
103 |
▶ | RETVAL = shm_si_remove(h, _kstr, (uint32_t)_klen, _kutf8); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_si_remove(h, _kstr, (uint32_t)_klen, _kutf8); |
103 |
0 |
103 |
|
| 427 |
|
| OUTPUT: |
| 428 |
|
| RETVAL |
| 429 |
|
| |
| 430 |
|
| bool |
| 431 |
|
| exists(SV* self_sv, SV* key_sv) |
| 432 |
|
| CODE: |
| 433 |
20 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
20 |
20 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
20 |
20 |
|
| 434 |
20 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
20 |
20 |
|
| 435 |
20 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
20 |
20 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
20 |
20 |
|
| 436 |
20 |
▶ | RETVAL = shm_si_exists(h, _kstr, (uint32_t)_klen, _kutf8); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_si_exists(h, _kstr, (uint32_t)_klen, _kutf8); |
16 |
4 |
20 |
|
| 437 |
|
| OUTPUT: |
| 438 |
|
| RETVAL |
| 439 |
|
| |
| 440 |
|
| SV* |
| 441 |
|
| incr(SV* self_sv, SV* key_sv) |
| 442 |
|
| CODE: |
| 443 |
8 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
8 |
8 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
8 |
8 |
|
| 444 |
8 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
7 |
1 |
8 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
6 |
7 |
|
| 445 |
6 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
6 |
6 |
|
| 446 |
6 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
6 |
6 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
6 |
6 |
|
| 447 |
|
| int ok; |
| 448 |
6 |
| int64_t val = shm_si_incr_by(h, _kstr, (uint32_t)_klen, _kutf8, 1, &ok); |
| 449 |
6 |
▶ | if (!ok) croak("Data::HashMap::Shared::SI: increment failed: no room for a new key"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!ok) croak("Data::HashMap::Shared::SI: increment failed: no room for a new key"); |
2 |
4 |
6 |
|
| 450 |
4 |
| RETVAL = newSViv(val); |
| 451 |
|
| OUTPUT: |
| 452 |
|
| RETVAL |
| 453 |
|
| |
| 454 |
|
| SV* |
| 455 |
|
| decr(SV* self_sv, SV* key_sv) |
| 456 |
|
| CODE: |
| 457 |
4 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
4 |
4 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
4 |
4 |
|
| 458 |
4 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
3 |
1 |
4 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
2 |
3 |
|
| 459 |
2 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
2 |
2 |
|
| 460 |
2 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
|
| 461 |
|
| int ok; |
| 462 |
2 |
| int64_t val = shm_si_incr_by(h, _kstr, (uint32_t)_klen, _kutf8, -1, &ok); |
| 463 |
2 |
▶ | if (!ok) croak("Data::HashMap::Shared::SI: decrement failed: no room for a new key"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!ok) croak("Data::HashMap::Shared::SI: decrement failed: no room for a new key"); |
1 |
1 |
2 |
|
| 464 |
1 |
| RETVAL = newSViv(val); |
| 465 |
|
| OUTPUT: |
| 466 |
|
| RETVAL |
| 467 |
|
| |
| 468 |
|
| SV* |
| 469 |
|
| incr_by(SV* self_sv, SV* key_sv, int64_t delta) |
| 470 |
|
| CODE: |
| 471 |
54 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
54 |
54 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
54 |
54 |
|
| 472 |
54 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
53 |
1 |
54 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
52 |
53 |
|
| 473 |
52 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
52 |
52 |
|
| 474 |
52 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
52 |
52 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
52 |
52 |
|
| 475 |
|
| int ok; |
| 476 |
52 |
| int64_t val = shm_si_incr_by(h, _kstr, (uint32_t)_klen, _kutf8, delta, &ok); |
| 477 |
52 |
▶ | if (!ok) croak("Data::HashMap::Shared::SI: incr_by failed: no room for a new key"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!ok) croak("Data::HashMap::Shared::SI: incr_by failed: no room for a new key"); |
1 |
51 |
52 |
|
| 478 |
51 |
| RETVAL = newSViv(val); |
| 479 |
|
| OUTPUT: |
| 480 |
|
| RETVAL |
| 481 |
|
| |
| 482 |
|
| SV* |
| 483 |
|
| max(SV* self_sv, SV* key_sv, int64_t desired) |
| 484 |
|
| CODE: |
| 485 |
70 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
70 |
70 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
70 |
70 |
|
| 486 |
70 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
69 |
1 |
70 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
68 |
69 |
|
| 487 |
68 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
68 |
68 |
|
| 488 |
68 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
68 |
68 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
68 |
68 |
|
| 489 |
|
| int ok; |
| 490 |
68 |
| int64_t val = shm_si_set_minmax(h, _kstr, (uint32_t)_klen, _kutf8, desired, 1, &ok); |
| 491 |
68 |
▶ | if (!ok) croak("Data::HashMap::Shared::SI: max failed: no room for a new key"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!ok) croak("Data::HashMap::Shared::SI: max failed: no room for a new key"); |
2 |
66 |
68 |
|
| 492 |
66 |
| RETVAL = newSViv(val); |
| 493 |
|
| OUTPUT: |
| 494 |
|
| RETVAL |
| 495 |
|
| |
| 496 |
|
| SV* |
| 497 |
|
| min(SV* self_sv, SV* key_sv, int64_t desired) |
| 498 |
|
| CODE: |
| 499 |
12 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
12 |
12 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
12 |
12 |
|
| 500 |
12 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
11 |
1 |
12 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
10 |
11 |
|
| 501 |
10 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
10 |
10 |
|
| 502 |
10 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
10 |
10 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
10 |
10 |
|
| 503 |
|
| int ok; |
| 504 |
10 |
| int64_t val = shm_si_set_minmax(h, _kstr, (uint32_t)_klen, _kutf8, desired, 0, &ok); |
| 505 |
10 |
▶ | if (!ok) croak("Data::HashMap::Shared::SI: min failed: no room for a new key"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!ok) croak("Data::HashMap::Shared::SI: min failed: no room for a new key"); |
1 |
9 |
10 |
|
| 506 |
9 |
| RETVAL = newSViv(val); |
| 507 |
|
| OUTPUT: |
| 508 |
|
| RETVAL |
| 509 |
|
| |
| 510 |
|
| UV |
| 511 |
|
| size(SV* self_sv) |
| 512 |
|
| CODE: |
| 513 |
40 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
10 |
30 |
40 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
30 |
30 |
|
| 514 |
30 |
| RETVAL = (UV)shm_si_size(h); |
| 515 |
|
| OUTPUT: |
| 516 |
|
| RETVAL |
| 517 |
|
| |
| 518 |
|
| UV |
| 519 |
|
| max_entries(SV* self_sv) |
| 520 |
|
| CODE: |
| 521 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
|
| 522 |
2 |
| RETVAL = (UV)shm_si_max_entries(h); |
| 523 |
|
| OUTPUT: |
| 524 |
|
| RETVAL |
| 525 |
|
| |
| 526 |
|
| void |
| 527 |
|
| keys(SV* self_sv) |
| 528 |
|
| PPCODE: |
| 529 |
12 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
12 |
12 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
12 |
12 |
|
| 530 |
33045 |
▶ | SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
Branch: 17 branches
| Branch | True | False | Total |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
2 |
10 |
12 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
6 |
10 |
16 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
11 |
5 |
16 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
0 |
16 |
16 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
3 |
13 |
16 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
2 |
1 |
3 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
3 |
0 |
3 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
3 |
0 |
3 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
20188 |
12829 |
33017 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
186 |
20002 |
20188 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
186 |
0 |
186 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
88 |
98 |
186 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
20000 |
90 |
20090 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
2 |
88 |
90 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
33021 |
12 |
33033 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
33017 |
4 |
33021 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 1, SHM_COPY_STR(key_off, key_len)); |
16 |
12 |
28 |
|
| 531 |
|
| |
| 532 |
|
| void |
| 533 |
|
| values(SV* self_sv) |
| 534 |
|
| PPCODE: |
| 535 |
6 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
6 |
6 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
6 |
6 |
|
| 536 |
32937 |
▶ | SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
Branch: 15 branches
| Branch | True | False | Total |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
2 |
4 |
6 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
6 |
4 |
10 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
5 |
5 |
10 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
0 |
10 |
10 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
0 |
10 |
10 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
0 |
0 |
0 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
0 |
0 |
0 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
0 |
0 |
0 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
20092 |
12829 |
32921 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
90 |
20002 |
20092 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
90 |
0 |
90 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
88 |
2 |
90 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
32925 |
6 |
32931 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
32921 |
4 |
32925 |
| SHM_LIST_COPIES(ShmNodeSI, 1, 0, |
10 |
6 |
16 |
|
| 537 |
|
| SHM_COPY_INT(__atomic_load_n(&nodes[i].value, __ATOMIC_RELAXED))); |
| 538 |
|
| |
| 539 |
|
| void |
| 540 |
|
| items(SV* self_sv) |
| 541 |
|
| PPCODE: |
| 542 |
5 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
5 |
5 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
5 |
5 |
|
| 543 |
32919 |
▶ | SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
Branch: 17 branches
| Branch | True | False | Total |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
2 |
3 |
5 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
6 |
3 |
9 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
5 |
4 |
9 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
0 |
9 |
9 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
3 |
6 |
9 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
2 |
1 |
3 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
3 |
0 |
3 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
3 |
0 |
3 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
20090 |
12815 |
32905 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
90 |
20000 |
20090 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
90 |
0 |
90 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
88 |
2 |
90 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
20000 |
88 |
20088 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
2 |
86 |
88 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
32909 |
5 |
32914 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
32905 |
4 |
32909 |
| SHM_LIST_COPIES(ShmNodeSI, 2, 1, |
9 |
5 |
14 |
|
| 544 |
|
| SHM_COPY_STR(key_off, key_len); |
| 545 |
|
| SHM_COPY_INT(__atomic_load_n(&nodes[i].value, __ATOMIC_RELAXED))); |
| 546 |
|
| |
| 547 |
|
| |
| 548 |
|
| void |
| 549 |
|
| each(SV* self_sv) |
| 550 |
|
| PPCODE: |
| 551 |
178 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
178 |
178 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
178 |
178 |
|
| 552 |
|
| const char *out_key; uint32_t out_klen; bool out_kutf8; |
| 553 |
|
| int64_t out_value; |
| 554 |
178 |
▶ | if (shm_si_each(h, &out_key, &out_klen, &out_kutf8, &out_value)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (shm_si_each(h, &out_key, &out_klen, &out_kutf8, &out_value)) { |
174 |
4 |
178 |
|
| 555 |
174 |
▶ | EXTEND(SP, 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 2); |
0 |
174 |
174 |
|
| 556 |
174 |
| SV* ksv = newSVpvn(out_key, out_klen); |
| 557 |
174 |
▶ | if (out_kutf8) SvUTF8_on(ksv); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_kutf8) SvUTF8_on(ksv); |
0 |
174 |
174 |
|
| 558 |
174 |
▶ | mXPUSHs(ksv); |
Branch: 1 branch
| Branch | True | False | Total |
| mXPUSHs(ksv); |
0 |
174 |
174 |
|
| 559 |
174 |
▶ | mXPUSHi(out_value); |
Branch: 1 branch
| Branch | True | False | Total |
| mXPUSHi(out_value); |
0 |
174 |
174 |
|
| 560 |
174 |
| XSRETURN(2); |
| 561 |
|
| } |
| 562 |
4 |
| shm_si_flush_deferred(h); |
| 563 |
4 |
| XSRETURN_EMPTY; |
| 564 |
|
| |
| 565 |
|
| void |
| 566 |
|
| iter_reset(SV* self_sv) |
| 567 |
|
| CODE: |
| 568 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
|
| 569 |
0 |
| shm_si_iter_reset(h); |
| 570 |
0 |
| shm_si_flush_deferred(h); |
| 571 |
|
| |
| 572 |
|
| void |
| 573 |
|
| clear(SV* self_sv) |
| 574 |
|
| CODE: |
| 575 |
3 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
|
| 576 |
3 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
2 |
1 |
3 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
1 |
2 |
|
| 577 |
1 |
| shm_si_clear(h); |
| 578 |
|
| |
| 579 |
|
| SV* |
| 580 |
|
| to_hash(SV* self_sv) |
| 581 |
|
| CODE: |
| 582 |
5 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
5 |
5 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
5 |
5 |
|
| 583 |
5 |
| SV* raw = sv_2mortal(newSV(1)); |
| 584 |
5 |
| SV* keys = sv_2mortal(newSV(1)); |
| 585 |
5 |
| SSize_t n = 0, nraw = 0; |
| 586 |
5 |
| STRLEN kused = 0; |
| 587 |
5 |
▶ | 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; |
2 |
3 |
5 |
|
| 588 |
5 |
| ENTER; |
| 589 |
14 |
▶ | for (uint32_t si = 0; si < ns; si++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (uint32_t si = 0; si < ns; si++) { |
9 |
5 |
14 |
|
| 590 |
9 |
▶ | 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; |
6 |
3 |
9 |
|
| 591 |
9 |
| ShmHeader *hdr = sh->hdr; |
| 592 |
9 |
| ShmNodeSI *nodes = (ShmNodeSI *)sh->nodes; |
| 593 |
9 |
| RDLOCK_GUARD(sh); |
| 594 |
9 |
▶ | 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 |
4 |
9 |
|
| 595 |
9 |
▶ | 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); |
9 |
0 |
9 |
| IV *r = (IV *)SvGROW(raw, (nraw + (STRLEN)left) * sizeof(IV) + 1); |
9 |
0 |
9 |
|
| 596 |
9 |
▶ | SvGROW(keys, kused + (STRLEN)left * 16 + 16); |
Branch: 2 branches
| Branch | True | False | Total |
| SvGROW(keys, kused + (STRLEN)left * 16 + 16); |
9 |
0 |
9 |
| SvGROW(keys, kused + (STRLEN)left * 16 + 16); |
9 |
0 |
9 |
|
| 597 |
32920 |
▶ | 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++) { |
32915 |
5 |
32920 |
| for (uint32_t i = 0; i < hdr->table_cap && left; i++) { |
32911 |
4 |
32915 |
|
| 598 |
32911 |
▶ | 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)) { |
20092 |
12819 |
32911 |
| if (SHM_IS_LIVE(sh->states[i]) && !SHM_IS_EXPIRED(sh, i, now)) { |
90 |
20002 |
20092 |
| 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 |
|
| 599 |
|
| char _ib[SHM_INLINE_MAX]; uint32_t klen; |
| 600 |
20090 |
| const char *kp = shm_str_ptr(nodes[i].key_off, nodes[i].key_len, sh->arena, sh->hdr->arena_cap, _ib, &klen); |
| 601 |
20090 |
| kused = shm_pack_key(aTHX_ keys, kused, kp, klen, SHM_UNPACK_UTF8(nodes[i].key_len)); |
| 602 |
20090 |
| r[nraw++] = (IV)__atomic_load_n(&nodes[i].value, __ATOMIC_RELAXED); |
| 603 |
20090 |
| n++; left--; |
| 604 |
|
| } |
| 605 |
|
| } |
| 606 |
|
| } |
| 607 |
5 |
| LEAVE; |
| 608 |
|
| |
| 609 |
5 |
| RETVAL = shm_copies_to_hashref(aTHX_ raw, keys, NULL, n); |
| 610 |
|
| OUTPUT: |
| 611 |
|
| RETVAL |
| 612 |
|
| |
| 613 |
|
| SV* |
| 614 |
|
| get_or_set(SV* self_sv, SV* key_sv, int64_t default_value) |
| 615 |
|
| CODE: |
| 616 |
5 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
5 |
5 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
5 |
5 |
|
| 617 |
5 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
4 |
1 |
5 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
3 |
4 |
|
| 618 |
3 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
3 |
3 |
|
| 619 |
|
| int64_t out; |
| 620 |
3 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
|
| 621 |
3 |
| int rc = shm_si_get_or_set(h, _kstr, (uint32_t)_klen, _kutf8, default_value, &out); |
| 622 |
3 |
▶ | if (!rc) XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!rc) XSRETURN_UNDEF; |
1 |
2 |
3 |
|
| 623 |
2 |
| RETVAL = newSViv(out); |
| 624 |
|
| OUTPUT: |
| 625 |
|
| RETVAL |
| 626 |
|
| |
| 627 |
|
| SV* |
| 628 |
|
| take(SV* self_sv, SV* key_sv) |
| 629 |
|
| CODE: |
| 630 |
3 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
|
| 631 |
3 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
2 |
1 |
3 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
1 |
2 |
|
| 632 |
1 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
1 |
1 |
|
| 633 |
|
| int64_t out_value; |
| 634 |
1 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
|
| 635 |
1 |
▶ | if (!shm_si_take(h, _kstr, (uint32_t)_klen, _kutf8, &out_value)) XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!shm_si_take(h, _kstr, (uint32_t)_klen, _kutf8, &out_value)) XSRETURN_UNDEF; |
0 |
1 |
1 |
|
| 636 |
1 |
| RETVAL = newSViv(out_value); |
| 637 |
|
| OUTPUT: |
| 638 |
|
| RETVAL |
| 639 |
|
| |
| 640 |
|
| void |
| 641 |
|
| pop(SV* self_sv) |
| 642 |
|
| PPCODE: |
| 643 |
10 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
10 |
10 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
10 |
10 |
|
| 644 |
10 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
9 |
1 |
10 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
8 |
9 |
|
| 645 |
|
| const char *out_key; uint32_t out_klen; bool out_kutf8; |
| 646 |
|
| int64_t out_val; |
| 647 |
8 |
▶ | if (!shm_si_pop(h, &out_key, &out_klen, &out_kutf8, &out_val)) XSRETURN_EMPTY; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!shm_si_pop(h, &out_key, &out_klen, &out_kutf8, &out_val)) XSRETURN_EMPTY; |
3 |
5 |
8 |
|
| 648 |
5 |
▶ | EXTEND(SP, 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 2); |
0 |
5 |
5 |
|
| 649 |
5 |
| SV *ksv = newSVpvn(out_key, out_klen); |
| 650 |
5 |
▶ | if (out_kutf8) SvUTF8_on(ksv); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_kutf8) SvUTF8_on(ksv); |
0 |
5 |
5 |
|
| 651 |
5 |
| mPUSHs(ksv); |
| 652 |
5 |
| mPUSHi(out_val); |
| 653 |
|
| |
| 654 |
|
| void |
| 655 |
|
| shift(SV* self_sv) |
| 656 |
|
| PPCODE: |
| 657 |
9 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
9 |
9 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
9 |
9 |
|
| 658 |
9 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
8 |
1 |
9 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
7 |
8 |
|
| 659 |
|
| const char *out_key; uint32_t out_klen; bool out_kutf8; |
| 660 |
|
| int64_t out_val; |
| 661 |
7 |
▶ | if (!shm_si_shift(h, &out_key, &out_klen, &out_kutf8, &out_val)) XSRETURN_EMPTY; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!shm_si_shift(h, &out_key, &out_klen, &out_kutf8, &out_val)) XSRETURN_EMPTY; |
3 |
4 |
7 |
|
| 662 |
4 |
▶ | EXTEND(SP, 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 2); |
0 |
4 |
4 |
|
| 663 |
4 |
| SV *ksv = newSVpvn(out_key, out_klen); |
| 664 |
4 |
▶ | if (out_kutf8) SvUTF8_on(ksv); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_kutf8) SvUTF8_on(ksv); |
0 |
4 |
4 |
|
| 665 |
4 |
| mPUSHs(ksv); |
| 666 |
4 |
| mPUSHi(out_val); |
| 667 |
|
| |
| 668 |
|
| void |
| 669 |
|
| drain(SV* self_sv, SV* limit_sv) |
| 670 |
|
| PPCODE: |
| 671 |
4 |
| UV limit = shm_count_arg(aTHX_ limit_sv, "drain limit", "Data::HashMap::Shared::SI"); |
| 672 |
4 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
4 |
4 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
4 |
4 |
|
| 673 |
4 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
3 |
1 |
4 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
2 |
3 |
|
| 674 |
|
| /* Only as many as the map can yield: limit sizes the allocation. */ |
| 675 |
|
| { |
| 676 |
2 |
| UV avail = (UV)shm_si_size(h); |
| 677 |
2 |
▶ | if (limit > avail) limit = avail; |
Branch: 1 branch
| Branch | True | False | Total |
| if (limit > avail) limit = avail; |
1 |
1 |
2 |
|
| 678 |
2 |
▶ | if (limit > UINT32_MAX) limit = UINT32_MAX; |
Branch: 1 branch
| Branch | True | False | Total |
| if (limit > UINT32_MAX) limit = UINT32_MAX; |
0 |
2 |
2 |
|
| 679 |
|
| } |
| 680 |
2 |
▶ | if (limit == 0) XSRETURN_EMPTY; |
Branch: 1 branch
| Branch | True | False | Total |
| if (limit == 0) XSRETURN_EMPTY; |
0 |
2 |
2 |
|
| 681 |
|
| shm_si_drain_entry *entries; |
| 682 |
2 |
▶ | Newxz(entries, limit, shm_si_drain_entry); |
Branch: 1 branch
| Branch | True | False | Total |
| Newxz(entries, limit, shm_si_drain_entry); |
0 |
2 |
2 |
|
| 683 |
|
| |
| 684 |
2 |
| SAVEFREEPV(entries); |
| 685 |
2 |
| char *buf = NULL; uint32_t buf_cap = 0; |
| 686 |
2 |
| uint32_t n = shm_si_drain(h, (uint32_t)limit, entries, &buf, &buf_cap); |
| 687 |
2 |
▶ | if (buf) SAVEDESTRUCTOR_X(shm_free_cleanup, buf); |
Branch: 1 branch
| Branch | True | False | Total |
| if (buf) SAVEDESTRUCTOR_X(shm_free_cleanup, buf); |
2 |
0 |
2 |
|
| 688 |
|
| |
| 689 |
2 |
▶ | EXTEND(SP, (SSize_t)n * 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, (SSize_t)n * 2); |
0 |
2 |
2 |
|
| 690 |
5 |
▶ | for (uint32_t i = 0; i < n; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (uint32_t i = 0; i < n; i++) { |
3 |
2 |
5 |
|
| 691 |
3 |
| SV *ksv = newSVpvn(buf + entries[i].key_off, entries[i].key_len); |
| 692 |
3 |
▶ | if (entries[i].key_utf8) SvUTF8_on(ksv); |
Branch: 1 branch
| Branch | True | False | Total |
| if (entries[i].key_utf8) SvUTF8_on(ksv); |
0 |
3 |
3 |
|
| 693 |
3 |
| mPUSHs(ksv); |
| 694 |
3 |
| mPUSHi(entries[i].value); |
| 695 |
|
| } |
| 696 |
|
| |
| 697 |
|
| |
| 698 |
|
| UV |
| 699 |
|
| flush_expired(SV* self_sv) |
| 700 |
|
| CODE: |
| 701 |
4 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
4 |
4 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
4 |
4 |
|
| 702 |
4 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
3 |
1 |
4 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
2 |
3 |
|
| 703 |
2 |
▶ | RETVAL = (UV)shm_si_flush_expired(h); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (UV)shm_si_flush_expired(h); |
0 |
2 |
2 |
|
| 704 |
|
| OUTPUT: |
| 705 |
|
| RETVAL |
| 706 |
|
| |
| 707 |
|
| void |
| 708 |
|
| flush_expired_partial(SV* self_sv, SV* limit_sv) |
| 709 |
|
| PPCODE: |
| 710 |
17 |
| uint32_t limit = shm_u32_arg(aTHX_ limit_sv, "limit", "Data::HashMap::Shared::SI", 0); |
| 711 |
16 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
16 |
16 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
16 |
16 |
|
| 712 |
16 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
15 |
1 |
16 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
14 |
15 |
|
| 713 |
14 |
| int done = 0; |
| 714 |
14 |
| uint32_t flushed = shm_si_flush_expired_partial(h, (uint32_t)limit, &done); |
| 715 |
14 |
▶ | EXTEND(SP, 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 2); |
0 |
14 |
14 |
|
| 716 |
14 |
| mPUSHu(flushed); |
| 717 |
14 |
| mPUSHi(done); |
| 718 |
|
| |
| 719 |
|
| UV |
| 720 |
|
| mmap_size(SV* self_sv) |
| 721 |
|
| CODE: |
| 722 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
|
| 723 |
0 |
| RETVAL = (UV)shm_si_mmap_size(h); |
| 724 |
|
| OUTPUT: |
| 725 |
|
| RETVAL |
| 726 |
|
| |
| 727 |
|
| bool |
| 728 |
|
| touch(SV* self_sv, SV* key_sv) |
| 729 |
|
| CODE: |
| 730 |
3 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
|
| 731 |
3 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
2 |
1 |
3 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
1 |
2 |
|
| 732 |
1 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
1 |
1 |
|
| 733 |
1 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
|
| 734 |
1 |
▶ | RETVAL = shm_si_touch(h, _kstr, (uint32_t)_klen, _kutf8); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_si_touch(h, _kstr, (uint32_t)_klen, _kutf8); |
1 |
0 |
1 |
|
| 735 |
|
| OUTPUT: |
| 736 |
|
| RETVAL |
| 737 |
|
| |
| 738 |
|
| bool |
| 739 |
|
| reserve(SV* self_sv, SV* target_sv) |
| 740 |
|
| CODE: |
| 741 |
4 |
| uint32_t target = shm_u32_arg(aTHX_ target_sv, "target", "Data::HashMap::Shared::SI", 0); |
| 742 |
3 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
|
| 743 |
3 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
2 |
1 |
3 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
1 |
2 |
|
| 744 |
1 |
▶ | RETVAL = shm_si_reserve(h, (uint32_t)target); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_si_reserve(h, (uint32_t)target); |
1 |
0 |
1 |
|
| 745 |
|
| OUTPUT: |
| 746 |
|
| RETVAL |
| 747 |
|
| |
| 748 |
|
| UV |
| 749 |
|
| stat_evictions(SV* self_sv) |
| 750 |
|
| CODE: |
| 751 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
|
| 752 |
0 |
| RETVAL = (UV)shm_si_stat_evictions(h); |
| 753 |
|
| OUTPUT: |
| 754 |
|
| RETVAL |
| 755 |
|
| |
| 756 |
|
| UV |
| 757 |
|
| stat_expired(SV* self_sv) |
| 758 |
|
| CODE: |
| 759 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
|
| 760 |
0 |
| RETVAL = (UV)shm_si_stat_expired(h); |
| 761 |
|
| OUTPUT: |
| 762 |
|
| RETVAL |
| 763 |
|
| |
| 764 |
|
| UV |
| 765 |
|
| stat_recoveries(SV* self_sv) |
| 766 |
|
| CODE: |
| 767 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
|
| 768 |
0 |
| RETVAL = (UV)shm_si_stat_recoveries(h); |
| 769 |
|
| OUTPUT: |
| 770 |
|
| RETVAL |
| 771 |
|
| |
| 772 |
|
| UV |
| 773 |
|
| compact(SV* self_sv) |
| 774 |
|
| CODE: |
| 775 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
|
| 776 |
2 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
1 |
2 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
0 |
1 |
|
| 777 |
0 |
| RETVAL = (UV)shm_si_compact(h); |
| 778 |
|
| OUTPUT: |
| 779 |
|
| RETVAL |
| 780 |
|
| |
| 781 |
|
| UV |
| 782 |
|
| arena_used(SV* self_sv) |
| 783 |
|
| CODE: |
| 784 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
|
| 785 |
0 |
| RETVAL = (UV)shm_si_arena_used(h); |
| 786 |
|
| OUTPUT: |
| 787 |
|
| RETVAL |
| 788 |
|
| |
| 789 |
|
| UV |
| 790 |
|
| arena_cap(SV* self_sv) |
| 791 |
|
| CODE: |
| 792 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
|
| 793 |
0 |
| RETVAL = (UV)shm_si_arena_cap(h); |
| 794 |
|
| OUTPUT: |
| 795 |
|
| RETVAL |
| 796 |
|
| |
| 797 |
|
| bool |
| 798 |
|
| add(SV* self_sv, SV* key_sv, int64_t value) |
| 799 |
|
| CODE: |
| 800 |
6 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
6 |
6 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
6 |
6 |
|
| 801 |
6 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
5 |
1 |
6 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
4 |
5 |
|
| 802 |
4 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
4 |
4 |
|
| 803 |
4 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
4 |
4 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
4 |
4 |
|
| 804 |
4 |
▶ | RETVAL = shm_si_add(h, _kstr, (uint32_t)_klen, _kutf8, value); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_si_add(h, _kstr, (uint32_t)_klen, _kutf8, value); |
2 |
2 |
4 |
|
| 805 |
|
| OUTPUT: |
| 806 |
|
| RETVAL |
| 807 |
|
| |
| 808 |
|
| bool |
| 809 |
|
| add_ttl(SV* self_sv, SV* key_sv, int64_t value, SV* ttl_sec_sv) |
| 810 |
|
| CODE: |
| 811 |
6 |
| uint32_t ttl_sec = shm_u32_arg(aTHX_ ttl_sec_sv, "ttl", "Data::HashMap::Shared::SI", 0); |
| 812 |
5 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
5 |
5 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
5 |
5 |
|
| 813 |
5 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
4 |
1 |
5 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
3 |
4 |
|
| 814 |
3 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
3 |
3 |
|
| 815 |
3 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
|
| 816 |
3 |
▶ | REQUIRE_TTL(h); |
Branch: 2 branches
| Branch | True | False | Total |
| REQUIRE_TTL(h); |
0 |
3 |
3 |
| REQUIRE_TTL(h); |
1 |
2 |
3 |
|
| 817 |
2 |
▶ | RETVAL = shm_si_add_ttl(h, _kstr, (uint32_t)_klen, _kutf8, value, (uint32_t)ttl_sec); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_si_add_ttl(h, _kstr, (uint32_t)_klen, _kutf8, value, (uint32_t)ttl_sec); |
1 |
1 |
2 |
|
| 818 |
|
| OUTPUT: |
| 819 |
|
| RETVAL |
| 820 |
|
| |
| 821 |
|
| bool |
| 822 |
|
| update(SV* self_sv, SV* key_sv, int64_t value) |
| 823 |
|
| CODE: |
| 824 |
4 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
4 |
4 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
4 |
4 |
|
| 825 |
4 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
3 |
1 |
4 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
2 |
3 |
|
| 826 |
2 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
2 |
2 |
|
| 827 |
2 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
|
| 828 |
2 |
▶ | RETVAL = shm_si_update(h, _kstr, (uint32_t)_klen, _kutf8, value); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_si_update(h, _kstr, (uint32_t)_klen, _kutf8, value); |
2 |
0 |
2 |
|
| 829 |
|
| OUTPUT: |
| 830 |
|
| RETVAL |
| 831 |
|
| |
| 832 |
|
| bool |
| 833 |
|
| update_ttl(SV* self_sv, SV* key_sv, int64_t value, SV* ttl_sec_sv) |
| 834 |
|
| CODE: |
| 835 |
4 |
| uint32_t ttl_sec = shm_u32_arg(aTHX_ ttl_sec_sv, "ttl", "Data::HashMap::Shared::SI", 0); |
| 836 |
3 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
|
| 837 |
3 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
2 |
1 |
3 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
1 |
2 |
|
| 838 |
1 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
1 |
1 |
|
| 839 |
1 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
|
| 840 |
1 |
▶ | REQUIRE_TTL(h); |
Branch: 2 branches
| Branch | True | False | Total |
| REQUIRE_TTL(h); |
0 |
1 |
1 |
| REQUIRE_TTL(h); |
1 |
0 |
1 |
|
| 841 |
0 |
▶ | RETVAL = shm_si_update_ttl(h, _kstr, (uint32_t)_klen, _kutf8, value, (uint32_t)ttl_sec); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_si_update_ttl(h, _kstr, (uint32_t)_klen, _kutf8, value, (uint32_t)ttl_sec); |
0 |
0 |
0 |
|
| 842 |
|
| OUTPUT: |
| 843 |
|
| RETVAL |
| 844 |
|
| |
| 845 |
|
| SV* |
| 846 |
|
| swap(SV* self_sv, SV* key_sv, int64_t value) |
| 847 |
|
| CODE: |
| 848 |
5 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
5 |
5 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
5 |
5 |
|
| 849 |
5 |
▶ | if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
4 |
1 |
5 |
| if (h->readonly || shm_is_sealed(h)) croak("Data::HashMap::Shared::SI: map is frozen (read-only)"); |
1 |
3 |
4 |
|
| 850 |
3 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
3 |
3 |
|
| 851 |
|
| int64_t out_value; |
| 852 |
3 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
3 |
3 |
|
| 853 |
3 |
| int rc = shm_si_swap(h, _kstr, (uint32_t)_klen, _kutf8, value, &out_value); |
| 854 |
3 |
▶ | if (rc != 1) XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| if (rc != 1) XSRETURN_UNDEF; |
1 |
2 |
3 |
|
| 855 |
2 |
| RETVAL = newSViv(out_value); |
| 856 |
|
| OUTPUT: |
| 857 |
|
| RETVAL |
| 858 |
|
| |
| 859 |
|
| SV* |
| 860 |
|
| path(SV* self_sv) |
| 861 |
|
| CODE: |
| 862 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
|
| 863 |
2 |
▶ | 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; |
1 |
1 |
2 |
|
| 864 |
|
| OUTPUT: |
| 865 |
|
| RETVAL |
| 866 |
|
| |
| 867 |
|
| bool |
| 868 |
|
| unlink(SV* self_or_class, ...) |
| 869 |
|
| CODE: |
| 870 |
1 |
▶ | if (sv_isobject(self_or_class) && sv_derived_from(self_or_class, "Data::HashMap::Shared::SI")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (sv_isobject(self_or_class) && sv_derived_from(self_or_class, "Data::HashMap::Shared::SI")) { |
1 |
0 |
1 |
| if (sv_isobject(self_or_class) && sv_derived_from(self_or_class, "Data::HashMap::Shared::SI")) { |
1 |
0 |
1 |
|
| 871 |
1 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_or_class); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_or_class); |
0 |
1 |
1 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_or_class); |
0 |
1 |
1 |
|
| 872 |
1 |
▶ | if (h->path) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (h->path) { |
0 |
1 |
1 |
|
| 873 |
0 |
▶ | SHM_TAINT_CHECK("Data::HashMap::Shared::SI->unlink"); |
Branch: 1 branch
| Branch | True | False | Total |
| SHM_TAINT_CHECK("Data::HashMap::Shared::SI->unlink"); |
0 |
0 |
0 |
|
| 874 |
0 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_or_class); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_or_class); |
0 |
0 |
0 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_or_class); |
0 |
0 |
0 |
|
| 875 |
|
| } |
| 876 |
1 |
| RETVAL = shm_unlink_sharded(h); |
| 877 |
|
| } else { |
| 878 |
0 |
▶ | if (items < 2) croak("Usage: Data::HashMap::Shared::SI->unlink($path)"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 2) croak("Usage: Data::HashMap::Shared::SI->unlink($path)"); |
0 |
0 |
0 |
|
| 879 |
0 |
▶ | SvGETMAGIC(ST(1)); |
Branch: 2 branches
| Branch | True | False | Total |
| SvGETMAGIC(ST(1)); |
0 |
0 |
0 |
| SvGETMAGIC(ST(1)); |
0 |
0 |
0 |
|
| 880 |
0 |
| RETVAL = shm_unlink_path(shm_write_path_arg(aTHX_ ST(1), "path", "Data::HashMap::Shared::SI", "Data::HashMap::Shared::SI->unlink")); |
| 881 |
|
| } |
| 882 |
|
| OUTPUT: |
| 883 |
|
| RETVAL |
| 884 |
|
| |
| 885 |
|
| SV* |
| 886 |
|
| ttl_remaining(SV* self_sv, SV* key_sv) |
| 887 |
|
| CODE: |
| 888 |
2 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
|
| 889 |
2 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
2 |
2 |
|
| 890 |
2 |
▶ | REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
| REEXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
2 |
2 |
|
| 891 |
2 |
| int64_t remaining = shm_si_ttl_remaining(h, _kstr, (uint32_t)_klen, _kutf8); |
| 892 |
2 |
▶ | if (remaining < 0) XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| if (remaining < 0) XSRETURN_UNDEF; |
0 |
2 |
2 |
|
| 893 |
2 |
| RETVAL = newSViv(remaining); |
| 894 |
|
| OUTPUT: |
| 895 |
|
| RETVAL |
| 896 |
|
| |
| 897 |
|
| UV |
| 898 |
|
| capacity(SV* self_sv) |
| 899 |
|
| CODE: |
| 900 |
36 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
36 |
36 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
36 |
36 |
|
| 901 |
36 |
| RETVAL = (UV)shm_si_capacity(h); |
| 902 |
|
| OUTPUT: |
| 903 |
|
| RETVAL |
| 904 |
|
| |
| 905 |
|
| UV |
| 906 |
|
| tombstones(SV* self_sv) |
| 907 |
|
| CODE: |
| 908 |
0 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
0 |
0 |
|
| 909 |
0 |
| RETVAL = (UV)shm_si_tombstones(h); |
| 910 |
|
| OUTPUT: |
| 911 |
|
| RETVAL |
| 912 |
|
| |
| 913 |
|
| SV* |
| 914 |
|
| cursor(SV* self_sv) |
| 915 |
|
| CODE: |
| 916 |
1 |
▶ | EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
| EXTRACT_MAP("Data::HashMap::Shared::SI", self_sv); |
0 |
1 |
1 |
|
| 917 |
1 |
| ShmCursor* c = shm_cursor_create(h); |
| 918 |
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 |
|
| 919 |
1 |
| c->owner = SvREFCNT_inc(SvRV(self_sv)); |
| 920 |
1 |
| RETVAL = sv_setref_pv(newSV(0), "Data::HashMap::Shared::SI::Cursor", (void*)c); |
| 921 |
|
| OUTPUT: |
| 922 |
|
| RETVAL |
| 923 |
|
| |
| 924 |
|
| MODULE = Data::HashMap::Shared PACKAGE = Data::HashMap::Shared::SI::Cursor |
| 925 |
|
| PROTOTYPES: DISABLE |
| 926 |
|
| |
| 927 |
|
| void |
| 928 |
|
| DESTROY(SV* self_sv) |
| 929 |
|
| CODE: |
| 930 |
1 |
▶ | if (!sv_isobject(self_sv) || !sv_derived_from(self_sv, "Data::HashMap::Shared::SI::Cursor")) return; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!sv_isobject(self_sv) || !sv_derived_from(self_sv, "Data::HashMap::Shared::SI::Cursor")) return; |
1 |
0 |
1 |
| if (!sv_isobject(self_sv) || !sv_derived_from(self_sv, "Data::HashMap::Shared::SI::Cursor")) return; |
0 |
1 |
1 |
|
| 931 |
1 |
| ShmCursor* c = INT2PTR(ShmCursor*, SvIV(SvRV(self_sv))); |
| 932 |
1 |
▶ | if (!c) return; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!c) return; |
0 |
1 |
1 |
|
| 933 |
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 |
|
| 934 |
1 |
| shm_cursor_destroy(c); |
| 935 |
1 |
▶ | if (h) shm_si_flush_deferred(h); |
Branch: 1 branch
| Branch | True | False | Total |
| if (h) shm_si_flush_deferred(h); |
0 |
1 |
1 |
|
| 936 |
1 |
▶ | if (owner) SvREFCNT_dec(owner); |
Branch: 1 branch
| Branch | True | False | Total |
| if (owner) SvREFCNT_dec(owner); |
1 |
0 |
1 |
|
| 937 |
1 |
| sv_setiv(SvRV(self_sv), 0); |
| 938 |
|
| |
| 939 |
|
| void |
| 940 |
|
| next(SV* self_sv) |
| 941 |
|
| PPCODE: |
| 942 |
8 |
▶ | EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
Branch: 4 branches
| Branch | True | False | Total |
| EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
2 |
6 |
8 |
| EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
0 |
6 |
6 |
| EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
6 |
0 |
6 |
| EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
0 |
6 |
6 |
|
| 943 |
|
| const char *out_key; uint32_t out_klen; bool out_kutf8; |
| 944 |
|
| int64_t out_value; |
| 945 |
6 |
▶ | if (shm_si_cursor_next(c, &out_key, &out_klen, &out_kutf8, &out_value)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (shm_si_cursor_next(c, &out_key, &out_klen, &out_kutf8, &out_value)) { |
5 |
1 |
6 |
|
| 946 |
5 |
▶ | EXTEND(SP, 2); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 2); |
0 |
5 |
5 |
|
| 947 |
5 |
| SV* ksv = newSVpvn(out_key, out_klen); |
| 948 |
5 |
▶ | if (out_kutf8) SvUTF8_on(ksv); |
Branch: 1 branch
| Branch | True | False | Total |
| if (out_kutf8) SvUTF8_on(ksv); |
0 |
5 |
5 |
|
| 949 |
5 |
▶ | mXPUSHs(ksv); |
Branch: 1 branch
| Branch | True | False | Total |
| mXPUSHs(ksv); |
0 |
5 |
5 |
|
| 950 |
5 |
▶ | mXPUSHi(out_value); |
Branch: 1 branch
| Branch | True | False | Total |
| mXPUSHi(out_value); |
0 |
5 |
5 |
|
| 951 |
5 |
| XSRETURN(2); |
| 952 |
|
| } |
| 953 |
1 |
| XSRETURN_EMPTY; |
| 954 |
|
| |
| 955 |
|
| void |
| 956 |
|
| reset(SV* self_sv) |
| 957 |
|
| CODE: |
| 958 |
0 |
▶ | EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
Branch: 4 branches
| Branch | True | False | Total |
| EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
0 |
0 |
0 |
| EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
0 |
0 |
0 |
| EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
0 |
0 |
0 |
| EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
0 |
0 |
0 |
|
| 959 |
0 |
| shm_si_cursor_reset(c); |
| 960 |
|
| |
| 961 |
|
| bool |
| 962 |
|
| seek(SV* self_sv, SV* key_sv) |
| 963 |
|
| CODE: |
| 964 |
0 |
▶ | EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
Branch: 4 branches
| Branch | True | False | Total |
| EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
0 |
0 |
0 |
| EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
0 |
0 |
0 |
| EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
0 |
0 |
0 |
| EXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
0 |
0 |
0 |
|
| 965 |
0 |
▶ | EXTRACT_STR_KEY(key_sv); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTRACT_STR_KEY(key_sv); |
0 |
0 |
0 |
|
| 966 |
0 |
▶ | REEXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
Branch: 4 branches
| Branch | True | False | Total |
| REEXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
0 |
0 |
0 |
| REEXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
0 |
0 |
0 |
| REEXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
0 |
0 |
0 |
| REEXTRACT_CURSOR("Data::HashMap::Shared::SI::Cursor", self_sv); |
0 |
0 |
0 |
|
| 967 |
0 |
▶ | RETVAL = shm_si_cursor_seek(c, _kstr, (uint32_t)_klen, _kutf8); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = shm_si_cursor_seek(c, _kstr, (uint32_t)_klen, _kutf8); |
0 |
0 |
0 |
|
| 968 |
|
| OUTPUT: |
| 969 |
|
| RETVAL |
| 970 |
|
| |