| 1 |
|
| #define PERL_NO_GET_CONTEXT |
| 2 |
|
| #include "EXTERN.h" |
| 3 |
|
| #include "perl.h" |
| 4 |
|
| #include "XSUB.h" |
| 5 |
|
| |
| 6 |
|
| #include "ppport.h" |
| 7 |
|
| |
| 8 |
6 |
| static int pool_wait_interrupted(void) { dTHX; return PL_sig_pending != 0; } |
| 9 |
|
| #define POOL_WAIT_INTERRUPTED() pool_wait_interrupted() |
| 10 |
|
| #include "pool.h" |
| 11 |
|
| |
| 12 |
|
| static XS(XS_Data__Pool__Shared_alloc); |
| 13 |
|
| static XS(XS_Data__Pool__Shared_try_alloc); |
| 14 |
|
| static XS(XS_Data__Pool__Shared_set); |
| 15 |
|
| static XS(XS_Data__Pool__Shared__I64_set); |
| 16 |
|
| static XS(XS_Data__Pool__Shared__I32_set); |
| 17 |
|
| static XS(XS_Data__Pool__Shared__F64_set); |
| 18 |
|
| static XS(XS_Data__Pool__Shared__Str_set); |
| 19 |
|
| |
| 20 |
71 |
| static int pool_native_set(CV *cv) { |
| 21 |
71 |
▶ | if (!cv || !CvISXSUB(cv)) return -1; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!cv || !CvISXSUB(cv)) return -1; |
71 |
0 |
71 |
| if (!cv || !CvISXSUB(cv)) return -1; |
6 |
65 |
71 |
|
| 22 |
65 |
| XSUBADDR_t fn = CvXSUB(cv); |
| 23 |
65 |
▶ | if (fn == XS_Data__Pool__Shared_set) return POOL_VAR_RAW; |
Branch: 1 branch
| Branch | True | False | Total |
| if (fn == XS_Data__Pool__Shared_set) return POOL_VAR_RAW; |
8 |
57 |
65 |
|
| 24 |
57 |
▶ | if (fn == XS_Data__Pool__Shared__I64_set) return POOL_VAR_I64; |
Branch: 1 branch
| Branch | True | False | Total |
| if (fn == XS_Data__Pool__Shared__I64_set) return POOL_VAR_I64; |
33 |
24 |
57 |
|
| 25 |
24 |
▶ | if (fn == XS_Data__Pool__Shared__I32_set) return POOL_VAR_I32; |
Branch: 1 branch
| Branch | True | False | Total |
| if (fn == XS_Data__Pool__Shared__I32_set) return POOL_VAR_I32; |
8 |
16 |
24 |
|
| 26 |
16 |
▶ | if (fn == XS_Data__Pool__Shared__F64_set) return POOL_VAR_F64; |
Branch: 1 branch
| Branch | True | False | Total |
| if (fn == XS_Data__Pool__Shared__F64_set) return POOL_VAR_F64; |
8 |
8 |
16 |
|
| 27 |
8 |
▶ | if (fn == XS_Data__Pool__Shared__Str_set) return POOL_VAR_STR; |
Branch: 1 branch
| Branch | True | False | Total |
| if (fn == XS_Data__Pool__Shared__Str_set) return POOL_VAR_STR; |
8 |
0 |
8 |
|
| 28 |
0 |
| return -1; |
| 29 |
|
| } |
| 30 |
|
| |
| 31 |
|
| /* slot_sv lifetime magic: returned scalar pins the pool object alive by |
| 32 |
|
| * holding an incremented refcount, released when the scalar is freed. */ |
| 33 |
4 |
| static int pool_scalar_magic_free(pTHX_ SV *sv, MAGIC *mg) { |
| 34 |
|
| PERL_UNUSED_ARG(sv); |
| 35 |
4 |
▶ | if (mg->mg_obj) SvREFCNT_dec(mg->mg_obj); |
Branch: 1 branch
| Branch | True | False | Total |
| if (mg->mg_obj) SvREFCNT_dec(mg->mg_obj); |
4 |
0 |
4 |
|
| 36 |
4 |
| return 0; |
| 37 |
|
| } |
| 38 |
|
| |
| 39 |
|
| static const MGVTBL pool_scalar_magic_vtbl = { |
| 40 |
|
| NULL, NULL, NULL, NULL, pool_scalar_magic_free, NULL, NULL, NULL |
| 41 |
|
| }; |
| 42 |
|
| |
| 43 |
|
| typedef struct { |
| 44 |
|
| SV *object; |
| 45 |
|
| SV *slot; |
| 46 |
|
| int committed; |
| 47 |
|
| } PoolAllocation; |
| 48 |
|
| |
| 49 |
69 |
| static void pool_allocation_cleanup(pTHX_ void *offset) { |
| 50 |
69 |
| PoolAllocation *allocation = SSPTRt(PTR2IV(offset), PoolAllocation); |
| 51 |
69 |
| SV *object = allocation->object, *slot = allocation->slot; |
| 52 |
69 |
▶ | if (!allocation->committed) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!allocation->committed) { |
39 |
30 |
69 |
|
| 53 |
39 |
| dSP; |
| 54 |
39 |
| ENTER; |
| 55 |
39 |
| SAVETMPS; |
| 56 |
39 |
| save_scalar(PL_errgv); |
| 57 |
39 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
39 |
39 |
|
| 58 |
39 |
▶ | XPUSHs(object); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(object); |
0 |
39 |
39 |
|
| 59 |
39 |
▶ | XPUSHs(slot); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(slot); |
0 |
39 |
39 |
|
| 60 |
39 |
| PUTBACK; |
| 61 |
39 |
| call_method("free", G_DISCARD | G_EVAL); |
| 62 |
39 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
39 |
0 |
39 |
|
| 63 |
39 |
| LEAVE; |
| 64 |
|
| } |
| 65 |
69 |
| SvREFCNT_dec(slot); |
| 66 |
69 |
| SvREFCNT_dec(object); |
| 67 |
69 |
| } |
| 68 |
|
| |
| 69 |
|
| #define EXTRACT_POOL(sv) \ |
| 70 |
|
| if (!sv_isobject(sv) || !sv_derived_from(sv, "Data::Pool::Shared")) \ |
| 71 |
|
| croak("Expected a Data::Pool::Shared object"); \ |
| 72 |
|
| PoolHandle *h = INT2PTR(PoolHandle*, SvIV(SvRV(sv))); \ |
| 73 |
|
| if (!h) croak("Attempted to use a destroyed Data::Pool::Shared object"); \ |
| 74 |
|
| PoolHandle *h0 = h; PERL_UNUSED_VAR(h0); \ |
| 75 |
|
| sv_2mortal(SvREFCNT_inc(SvRV(sv))) |
| 76 |
|
| |
| 77 |
|
| /* Re-read the handle after a call that can run Perl code (tied/overloaded |
| 78 |
|
| * argument magic, tied-array fetches). That code may call $obj->DESTROY |
| 79 |
|
| * explicitly, which frees the handle and zeroes the IV; EXTRACT's mortal |
| 80 |
|
| * pins the referent only against refcount-driven destruction, not an |
| 81 |
|
| * explicit DESTROY, so the local `h` would dangle. Used only where magic |
| 82 |
|
| * can actually intervene between EXTRACT and the first use of h. */ |
| 83 |
|
| /* The same Perl can also REPLACE the invocant ($obj = 42 from an overload |
| 84 |
|
| * handler mutates ST(0), because Perl passes aliases), so SvROK is re-checked |
| 85 |
|
| * before SvRV -- otherwise SvRV would run on a non-reference. */ |
| 86 |
|
| #define REEXTRACT_POOL(sv) \ |
| 87 |
|
| if (!SvROK(sv)) \ |
| 88 |
|
| croak("Data::Pool::Shared object was replaced during the call"); \ |
| 89 |
|
| h = INT2PTR(PoolHandle*, SvIV(SvRV(sv))); \ |
| 90 |
|
| if (h != h0) croak("Data::Pool::Shared object replaced or destroyed during the call") |
| 91 |
|
| |
| 92 |
|
| #define MAKE_OBJ(class, handle) \ |
| 93 |
|
| SV *obj = newSViv(PTR2IV(handle)); \ |
| 94 |
|
| SV *ref = newRV_noinc(obj); \ |
| 95 |
|
| sv_bless(ref, gv_stashpv(class, GV_ADD)); \ |
| 96 |
|
| RETVAL = ref |
| 97 |
|
| |
| 98 |
|
| #define CHECK_SLOT(h, slot) \ |
| 99 |
|
| if ((UV)(slot) >= (h)->capacity) \ |
| 100 |
|
| croak("slot %" UVuf " out of range (capacity %" UVuf ")", \ |
| 101 |
|
| (UV)(slot), (UV)(h)->capacity) |
| 102 |
|
| |
| 103 |
|
| #define CHECK_ALLOCATED(h, slot) \ |
| 104 |
|
| if (!pool_is_allocated(h, slot)) \ |
| 105 |
|
| croak("slot %" UVuf " is not allocated", (UV)(slot)) |
| 106 |
|
| |
| 107 |
|
| |
| 108 |
968 |
| static int64_t pool_perl_alloc(pTHX_ SV *self, PoolHandle *h, double timeout) { |
| 109 |
968 |
| PoolHandle *h0 = h; |
| 110 |
|
| struct timespec deadline, remaining; |
| 111 |
968 |
▶ | if (timeout > 0) pool_make_deadline(timeout, &deadline); |
Branch: 1 branch
| Branch | True | False | Total |
| if (timeout > 0) pool_make_deadline(timeout, &deadline); |
3 |
965 |
968 |
|
| 112 |
968 |
| double seconds = timeout; |
| 113 |
1 |
| for (;;) { |
| 114 |
969 |
| int64_t result = pool_alloc(h, seconds); |
| 115 |
969 |
▶ | if (result != -2) return result; |
Branch: 1 branch
| Branch | True | False | Total |
| if (result != -2) return result; |
968 |
1 |
969 |
|
| 116 |
1 |
▶ | PERL_ASYNC_CHECK(); |
Branch: 1 branch
| Branch | True | False | Total |
| PERL_ASYNC_CHECK(); |
1 |
0 |
1 |
|
| 117 |
1 |
▶ | REEXTRACT_POOL(self); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_POOL(self); |
0 |
1 |
1 |
| REEXTRACT_POOL(self); |
0 |
1 |
1 |
|
| 118 |
1 |
▶ | if (timeout > 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (timeout > 0) { |
1 |
0 |
1 |
|
| 119 |
1 |
▶ | if (!pool_remaining_time(&deadline, &remaining)) return -1; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!pool_remaining_time(&deadline, &remaining)) return -1; |
0 |
1 |
1 |
|
| 120 |
1 |
| seconds = (double)remaining.tv_sec + (double)remaining.tv_nsec / 1e9; |
| 121 |
|
| } |
| 122 |
|
| } |
| 123 |
|
| } |
| 124 |
|
| |
| 125 |
6 |
| static int pool_perl_alloc_n(pTHX_ SV *self, PoolHandle *h, uint64_t *out, uint32_t count, double timeout) { |
| 126 |
6 |
| PoolHandle *h0 = h; |
| 127 |
|
| struct timespec deadline, remaining; |
| 128 |
6 |
▶ | if (timeout > 0) pool_make_deadline(timeout, &deadline); |
Branch: 1 branch
| Branch | True | False | Total |
| if (timeout > 0) pool_make_deadline(timeout, &deadline); |
0 |
6 |
6 |
|
| 129 |
6 |
| double seconds = timeout; |
| 130 |
0 |
| for (;;) { |
| 131 |
6 |
| int result = pool_alloc_n(h, out, count, seconds); |
| 132 |
6 |
▶ | if (result >= 0) return result; |
Branch: 1 branch
| Branch | True | False | Total |
| if (result >= 0) return result; |
6 |
0 |
6 |
|
| 133 |
0 |
▶ | PERL_ASYNC_CHECK(); |
Branch: 1 branch
| Branch | True | False | Total |
| PERL_ASYNC_CHECK(); |
0 |
0 |
0 |
|
| 134 |
0 |
▶ | REEXTRACT_POOL(self); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_POOL(self); |
0 |
0 |
0 |
| REEXTRACT_POOL(self); |
0 |
0 |
0 |
|
| 135 |
0 |
▶ | if (timeout > 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (timeout > 0) { |
0 |
0 |
0 |
|
| 136 |
0 |
▶ | if (!pool_remaining_time(&deadline, &remaining)) return 0; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!pool_remaining_time(&deadline, &remaining)) return 0; |
0 |
0 |
0 |
|
| 137 |
0 |
| seconds = (double)remaining.tv_sec + (double)remaining.tv_nsec / 1e9; |
| 138 |
|
| } |
| 139 |
|
| } |
| 140 |
|
| } |
| 141 |
|
| |
| 142 |
|
| MODULE = Data::Pool::Shared PACKAGE = Data::Pool::Shared |
| 143 |
|
| |
| 144 |
|
| PROTOTYPES: DISABLE |
| 145 |
|
| |
| 146 |
|
| SV * |
| 147 |
|
| new(class, path, capacity, elem_size, ...) |
| 148 |
|
| const char *class |
| 149 |
|
| SV *path |
| 150 |
|
| UV capacity |
| 151 |
|
| UV elem_size |
| 152 |
|
| PREINIT: |
| 153 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 154 |
|
| CODE: |
| 155 |
20 |
▶ | mode_t mode = (items > 4 && (SvGETMAGIC(ST(4)), SvOK(ST(4)))) ? (mode_t)SvUV(ST(4)) : 0600; |
Branch: 4 branches
| Branch | True | False | Total |
| mode_t mode = (items > 4 && (SvGETMAGIC(ST(4)), SvOK(ST(4)))) ? (mode_t)SvUV(ST(4)) : 0600; |
0 |
20 |
20 |
| mode_t mode = (items > 4 && (SvGETMAGIC(ST(4)), SvOK(ST(4)))) ? (mode_t)SvUV(ST(4)) : 0600; |
0 |
0 |
0 |
| mode_t mode = (items > 4 && (SvGETMAGIC(ST(4)), SvOK(ST(4)))) ? (mode_t)SvUV(ST(4)) : 0600; |
0 |
0 |
0 |
| mode_t mode = (items > 4 && (SvGETMAGIC(ST(4)), SvOK(ST(4)))) ? (mode_t)SvUV(ST(4)) : 0600; |
0 |
0 |
0 |
|
| 156 |
28 |
▶ | const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
Branch: 3 branches
| Branch | True | False | Total |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
0 |
20 |
20 |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
0 |
0 |
0 |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
8 |
12 |
20 |
|
| 157 |
20 |
| PoolHandle *h = pool_create(p, capacity, (uint32_t)elem_size, POOL_VAR_RAW, mode, errbuf); |
| 158 |
20 |
▶ | if (!h) croak("Data::Pool::Shared->new: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared->new: %s", errbuf[0] ? errbuf : "out of memory"); |
3 |
17 |
20 |
| if (!h) croak("Data::Pool::Shared->new: %s", errbuf[0] ? errbuf : "out of memory"); |
3 |
0 |
3 |
|
| 159 |
17 |
| MAKE_OBJ(class, h); |
| 160 |
|
| OUTPUT: |
| 161 |
|
| RETVAL |
| 162 |
|
| |
| 163 |
|
| SV * |
| 164 |
|
| new_memfd(class, name, capacity, elem_size) |
| 165 |
|
| const char *class |
| 166 |
|
| const char *name |
| 167 |
|
| UV capacity |
| 168 |
|
| UV elem_size |
| 169 |
|
| PREINIT: |
| 170 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 171 |
|
| CODE: |
| 172 |
1 |
| PoolHandle *h = pool_create_memfd(name, capacity, (uint32_t)elem_size, POOL_VAR_RAW, errbuf); |
| 173 |
1 |
▶ | if (!h) croak("Data::Pool::Shared->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
1 |
1 |
| if (!h) croak("Data::Pool::Shared->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
0 |
0 |
|
| 174 |
1 |
| MAKE_OBJ(class, h); |
| 175 |
|
| OUTPUT: |
| 176 |
|
| RETVAL |
| 177 |
|
| |
| 178 |
|
| SV * |
| 179 |
|
| new_from_fd(class, fd) |
| 180 |
|
| const char *class |
| 181 |
|
| int fd |
| 182 |
|
| PREINIT: |
| 183 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 184 |
|
| CODE: |
| 185 |
1 |
| PoolHandle *h = pool_open_fd(fd, POOL_VAR_RAW, errbuf); |
| 186 |
1 |
▶ | if (!h) croak("Data::Pool::Shared->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
1 |
1 |
| if (!h) croak("Data::Pool::Shared->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
0 |
0 |
|
| 187 |
1 |
| MAKE_OBJ(class, h); |
| 188 |
|
| OUTPUT: |
| 189 |
|
| RETVAL |
| 190 |
|
| |
| 191 |
|
| void |
| 192 |
|
| DESTROY(self) |
| 193 |
|
| SV *self |
| 194 |
|
| CODE: |
| 195 |
80 |
▶ | if (!sv_isobject(self) || !sv_derived_from(self, "Data::Pool::Shared")) return; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!sv_isobject(self) || !sv_derived_from(self, "Data::Pool::Shared")) return; |
80 |
0 |
80 |
| if (!sv_isobject(self) || !sv_derived_from(self, "Data::Pool::Shared")) return; |
0 |
80 |
80 |
|
| 196 |
80 |
| PoolHandle *h = INT2PTR(PoolHandle*, SvIV(SvRV(self))); |
| 197 |
80 |
▶ | if (!h) return; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!h) return; |
0 |
80 |
80 |
|
| 198 |
80 |
| sv_setiv(SvRV(self), 0); |
| 199 |
80 |
| pool_destroy(h); |
| 200 |
|
| |
| 201 |
|
| SV * |
| 202 |
|
| alloc(self, ...) |
| 203 |
|
| SV *self |
| 204 |
|
| PREINIT: |
| 205 |
918 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
918 |
0 |
918 |
| EXTRACT_POOL(self); |
0 |
918 |
918 |
| EXTRACT_POOL(self); |
0 |
918 |
918 |
|
| 206 |
918 |
| double timeout = -1; |
| 207 |
|
| CODE: |
| 208 |
918 |
▶ | if (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) timeout = SvNV(ST(1)); |
Branch: 4 branches
| Branch | True | False | Total |
| if (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) timeout = SvNV(ST(1)); |
7 |
911 |
918 |
| if (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) timeout = SvNV(ST(1)); |
0 |
7 |
7 |
| if (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) timeout = SvNV(ST(1)); |
0 |
0 |
0 |
| if (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) timeout = SvNV(ST(1)); |
7 |
0 |
7 |
|
| 209 |
918 |
▶ | REEXTRACT_POOL(self); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_POOL(self); |
0 |
918 |
918 |
| REEXTRACT_POOL(self); |
0 |
918 |
918 |
|
| 210 |
918 |
| int64_t slot = pool_perl_alloc(aTHX_ self, h, timeout); |
| 211 |
918 |
▶ | RETVAL = (slot >= 0) ? newSViv((IV)slot) : &PL_sv_undef; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (slot >= 0) ? newSViv((IV)slot) : &PL_sv_undef; |
915 |
3 |
918 |
|
| 212 |
|
| OUTPUT: |
| 213 |
|
| RETVAL |
| 214 |
|
| |
| 215 |
|
| SV * |
| 216 |
|
| try_alloc(self) |
| 217 |
|
| SV *self |
| 218 |
|
| PREINIT: |
| 219 |
20 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
20 |
0 |
20 |
| EXTRACT_POOL(self); |
0 |
20 |
20 |
| EXTRACT_POOL(self); |
0 |
20 |
20 |
|
| 220 |
|
| CODE: |
| 221 |
20 |
| int64_t slot = pool_try_alloc(h); |
| 222 |
20 |
▶ | RETVAL = (slot >= 0) ? newSViv((IV)slot) : &PL_sv_undef; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (slot >= 0) ? newSViv((IV)slot) : &PL_sv_undef; |
8 |
12 |
20 |
|
| 223 |
|
| OUTPUT: |
| 224 |
|
| RETVAL |
| 225 |
|
| |
| 226 |
|
| SV * |
| 227 |
|
| alloc_set(self, value, ...) |
| 228 |
|
| SV *self |
| 229 |
|
| SV *value |
| 230 |
|
| ALIAS: |
| 231 |
|
| try_alloc_set = 1 |
| 232 |
|
| CODE: |
| 233 |
71 |
| ENTER; |
| 234 |
71 |
| SAVETMPS; |
| 235 |
71 |
| SV *object = sv_2mortal(newSVsv(self)); |
| 236 |
71 |
| SV *val = sv_2mortal(newSVsv(value)); |
| 237 |
71 |
| SV *timeout = NULL; |
| 238 |
71 |
▶ | if (!ix) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!ix) { |
53 |
18 |
71 |
|
| 239 |
53 |
▶ | timeout = sv_2mortal(items > 2 ? newSVsv(ST(2)) : newSViv(-1)); |
Branch: 1 branch
| Branch | True | False | Total |
| timeout = sv_2mortal(items > 2 ? newSVsv(ST(2)) : newSViv(-1)); |
2 |
51 |
53 |
|
| 240 |
53 |
▶ | if (!SvOK(timeout)) sv_setiv(timeout, -1); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!SvOK(timeout)) sv_setiv(timeout, -1); |
0 |
53 |
53 |
|
| 241 |
|
| } |
| 242 |
71 |
▶ | EXTRACT_POOL(object); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(object); |
71 |
0 |
71 |
| EXTRACT_POOL(object); |
0 |
71 |
71 |
| EXTRACT_POOL(object); |
0 |
71 |
71 |
|
| 243 |
71 |
▶ | GV *alloc_gv = gv_fetchmethod_autoload(SvSTASH(SvRV(object)), ix ? "try_alloc" : "alloc", 0); |
Branch: 1 branch
| Branch | True | False | Total |
| GV *alloc_gv = gv_fetchmethod_autoload(SvSTASH(SvRV(object)), ix ? "try_alloc" : "alloc", 0); |
18 |
53 |
71 |
|
| 244 |
71 |
| GV *set_gv = gv_fetchmethod_autoload(SvSTASH(SvRV(object)), "set", 0); |
| 245 |
71 |
▶ | CV *alloc_cv = alloc_gv ? GvCV(alloc_gv) : NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| CV *alloc_cv = alloc_gv ? GvCV(alloc_gv) : NULL; |
71 |
0 |
71 |
|
| 246 |
71 |
▶ | int variant = set_gv ? pool_native_set(GvCV(set_gv)) : -1; |
Branch: 1 branch
| Branch | True | False | Total |
| int variant = set_gv ? pool_native_set(GvCV(set_gv)) : -1; |
71 |
0 |
71 |
|
| 247 |
65 |
▶ | int native = variant >= 0 && alloc_cv && CvISXSUB(alloc_cv) |
Branch: 2 branches
| Branch | True | False | Total |
| int native = variant >= 0 && alloc_cv && CvISXSUB(alloc_cv) |
65 |
0 |
65 |
| int native = variant >= 0 && alloc_cv && CvISXSUB(alloc_cv) |
65 |
0 |
65 |
|
| 248 |
136 |
▶ | && CvXSUB(alloc_cv) == (ix ? XS_Data__Pool__Shared_try_alloc : XS_Data__Pool__Shared_alloc); |
Branch: 3 branches
| Branch | True | False | Total |
| && CvXSUB(alloc_cv) == (ix ? XS_Data__Pool__Shared_try_alloc : XS_Data__Pool__Shared_alloc); |
65 |
6 |
71 |
| && CvXSUB(alloc_cv) == (ix ? XS_Data__Pool__Shared_try_alloc : XS_Data__Pool__Shared_alloc); |
15 |
50 |
65 |
| && CvXSUB(alloc_cv) == (ix ? XS_Data__Pool__Shared_try_alloc : XS_Data__Pool__Shared_alloc); |
65 |
0 |
65 |
|
| 249 |
71 |
| dSP; |
| 250 |
|
| SV *slot; |
| 251 |
71 |
▶ | if (native) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (native) { |
65 |
6 |
71 |
|
| 252 |
65 |
▶ | double seconds = ix ? 0 : SvNV(timeout); |
Branch: 1 branch
| Branch | True | False | Total |
| double seconds = ix ? 0 : SvNV(timeout); |
50 |
15 |
65 |
|
| 253 |
65 |
▶ | REEXTRACT_POOL(object); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_POOL(object); |
0 |
65 |
65 |
| REEXTRACT_POOL(object); |
0 |
65 |
65 |
|
| 254 |
65 |
▶ | int64_t index = ix ? pool_try_alloc(h) : pool_perl_alloc(aTHX_ object, h, seconds); |
Branch: 1 branch
| Branch | True | False | Total |
| int64_t index = ix ? pool_try_alloc(h) : pool_perl_alloc(aTHX_ object, h, seconds); |
15 |
50 |
65 |
|
| 255 |
65 |
| SPAGAIN; |
| 256 |
65 |
▶ | slot = index >= 0 ? sv_2mortal(newSViv((IV)index)) : &PL_sv_undef; |
Branch: 1 branch
| Branch | True | False | Total |
| slot = index >= 0 ? sv_2mortal(newSViv((IV)index)) : &PL_sv_undef; |
65 |
0 |
65 |
|
| 257 |
|
| } else { |
| 258 |
6 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
6 |
6 |
|
| 259 |
6 |
▶ | XPUSHs(object); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(object); |
0 |
6 |
6 |
|
| 260 |
6 |
▶ | if (!ix) XPUSHs(timeout); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!ix) XPUSHs(timeout); |
3 |
3 |
6 |
| if (!ix) XPUSHs(timeout); |
0 |
3 |
3 |
|
| 261 |
6 |
| PUTBACK; |
| 262 |
6 |
▶ | call_method(ix ? "try_alloc" : "alloc", G_SCALAR); |
Branch: 1 branch
| Branch | True | False | Total |
| call_method(ix ? "try_alloc" : "alloc", G_SCALAR); |
3 |
3 |
6 |
|
| 263 |
6 |
| SPAGAIN; |
| 264 |
6 |
| slot = POPs; |
| 265 |
|
| } |
| 266 |
71 |
▶ | if (SvOK(slot)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvOK(slot)) { |
69 |
2 |
71 |
|
| 267 |
69 |
| SSize_t offset = SSNEWt(1, PoolAllocation); |
| 268 |
69 |
| PoolAllocation *allocation = SSPTRt(offset, PoolAllocation); |
| 269 |
69 |
| allocation->object = SvREFCNT_inc(object); |
| 270 |
69 |
| allocation->slot = SvREFCNT_inc(slot); |
| 271 |
69 |
| allocation->committed = 0; |
| 272 |
69 |
| SAVEDESTRUCTOR_X(pool_allocation_cleanup, INT2PTR(void *, offset)); |
| 273 |
69 |
▶ | if (native) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (native) { |
65 |
4 |
69 |
|
| 274 |
65 |
| UV index = SvUV(slot); |
| 275 |
65 |
| IV integer = 0; |
| 276 |
65 |
| NV number = 0; |
| 277 |
65 |
| STRLEN len = 0; |
| 278 |
65 |
| const char *bytes = NULL; |
| 279 |
65 |
▶ | if (variant == POOL_VAR_I64 || variant == POOL_VAR_I32) integer = SvIV(val); |
Branch: 2 branches
| Branch | True | False | Total |
| if (variant == POOL_VAR_I64 || variant == POOL_VAR_I32) integer = SvIV(val); |
32 |
33 |
65 |
| if (variant == POOL_VAR_I64 || variant == POOL_VAR_I32) integer = SvIV(val); |
8 |
24 |
32 |
|
| 280 |
24 |
▶ | else if (variant == POOL_VAR_F64) number = SvNV(val); |
Branch: 1 branch
| Branch | True | False | Total |
| else if (variant == POOL_VAR_F64) number = SvNV(val); |
8 |
16 |
24 |
|
| 281 |
8 |
| else bytes = SvPV(val, len); |
| 282 |
28 |
| SPAGAIN; |
| 283 |
28 |
▶ | REEXTRACT_POOL(object); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_POOL(object); |
0 |
28 |
28 |
| REEXTRACT_POOL(object); |
0 |
28 |
28 |
|
| 284 |
28 |
▶ | CHECK_SLOT(h, index); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, index); |
0 |
28 |
28 |
|
| 285 |
28 |
▶ | CHECK_ALLOCATED(h, index); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, index); |
0 |
28 |
28 |
|
| 286 |
28 |
| switch (variant) { |
| 287 |
12 |
| case POOL_VAR_I64: pool_set_i64(h, index, (int64_t)integer); break; |
| 288 |
4 |
| case POOL_VAR_I32: pool_set_i32(h, index, (int32_t)integer); break; |
| 289 |
4 |
| case POOL_VAR_F64: pool_set_f64(h, index, (double)number); break; |
| 290 |
4 |
| case POOL_VAR_STR: pool_set_str(h, index, bytes, (uint32_t)len); break; |
| 291 |
4 |
| default: |
| 292 |
4 |
▶ | if (len > h->elem_size) len = h->elem_size; |
Branch: 1 branch
| Branch | True | False | Total |
| if (len > h->elem_size) len = h->elem_size; |
0 |
4 |
4 |
|
| 293 |
4 |
| memcpy(pool_slot_ptr(h, index), bytes, len); |
| 294 |
4 |
▶ | if (len < h->elem_size) |
Branch: 1 branch
| Branch | True | False | Total |
| if (len < h->elem_size) |
4 |
0 |
4 |
|
| 295 |
4 |
| memset(pool_slot_ptr(h, index) + len, 0, h->elem_size - len); |
| 296 |
|
| } |
| 297 |
|
| } else { |
| 298 |
4 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
4 |
4 |
|
| 299 |
4 |
▶ | XPUSHs(object); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(object); |
0 |
4 |
4 |
|
| 300 |
4 |
▶ | XPUSHs(slot); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(slot); |
0 |
4 |
4 |
|
| 301 |
4 |
▶ | XPUSHs(val); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(val); |
0 |
4 |
4 |
|
| 302 |
4 |
| PUTBACK; |
| 303 |
4 |
| call_method("set", G_DISCARD); |
| 304 |
2 |
| SPAGAIN; |
| 305 |
|
| } |
| 306 |
30 |
| RETVAL = newSVsv(slot); |
| 307 |
30 |
| SSPTRt(offset, PoolAllocation)->committed = 1; |
| 308 |
|
| } else { |
| 309 |
2 |
| RETVAL = &PL_sv_undef; |
| 310 |
|
| } |
| 311 |
32 |
| PUTBACK; |
| 312 |
32 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
32 |
0 |
32 |
|
| 313 |
32 |
| LEAVE; |
| 314 |
32 |
▶ | if (!SvOK(RETVAL) && GIMME_V == G_ARRAY) XSRETURN_EMPTY; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!SvOK(RETVAL) && GIMME_V == G_ARRAY) XSRETURN_EMPTY; |
2 |
30 |
32 |
| if (!SvOK(RETVAL) && GIMME_V == G_ARRAY) XSRETURN_EMPTY; |
2 |
0 |
2 |
|
| 315 |
|
| OUTPUT: |
| 316 |
|
| RETVAL |
| 317 |
|
| |
| 318 |
|
| bool |
| 319 |
|
| free(self, slot) |
| 320 |
|
| SV *self |
| 321 |
|
| UV slot |
| 322 |
|
| PREINIT: |
| 323 |
755 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
755 |
0 |
755 |
| EXTRACT_POOL(self); |
0 |
755 |
755 |
| EXTRACT_POOL(self); |
0 |
755 |
755 |
|
| 324 |
|
| CODE: |
| 325 |
755 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
1 |
754 |
755 |
|
| 326 |
754 |
▶ | RETVAL = pool_free_slot(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = pool_free_slot(h, slot); |
752 |
2 |
754 |
|
| 327 |
|
| OUTPUT: |
| 328 |
|
| RETVAL |
| 329 |
|
| |
| 330 |
|
| SV * |
| 331 |
|
| get(self, slot) |
| 332 |
|
| SV *self |
| 333 |
|
| UV slot |
| 334 |
|
| PREINIT: |
| 335 |
6 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
6 |
0 |
6 |
| EXTRACT_POOL(self); |
0 |
6 |
6 |
| EXTRACT_POOL(self); |
0 |
6 |
6 |
|
| 336 |
|
| CODE: |
| 337 |
6 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
1 |
5 |
6 |
|
| 338 |
5 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
1 |
4 |
5 |
|
| 339 |
4 |
| RETVAL = newSVpvn((const char *)pool_slot_ptr(h, slot), h->elem_size); |
| 340 |
|
| OUTPUT: |
| 341 |
|
| RETVAL |
| 342 |
|
| |
| 343 |
|
| void |
| 344 |
|
| set(self, slot, data) |
| 345 |
|
| SV *self |
| 346 |
|
| UV slot |
| 347 |
|
| SV *data |
| 348 |
|
| PREINIT: |
| 349 |
8 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
8 |
0 |
8 |
| EXTRACT_POOL(self); |
0 |
8 |
8 |
| EXTRACT_POOL(self); |
0 |
8 |
8 |
|
| 350 |
|
| CODE: |
| 351 |
8 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
1 |
7 |
8 |
|
| 352 |
7 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
7 |
7 |
|
| 353 |
|
| STRLEN len; |
| 354 |
7 |
| const char *bytes = SvPV(data, len); |
| 355 |
|
| /* SvPV on a bare SV arg runs overload/tie magic = arbitrary Perl, which can |
| 356 |
|
| * have destroyed self before h is used below. (CHECK_SLOT/CHECK_ALLOCATED |
| 357 |
|
| * above ran on the pre-magic handle; re-validate against the current one.) */ |
| 358 |
7 |
▶ | REEXTRACT_POOL(self); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_POOL(self); |
0 |
7 |
7 |
| REEXTRACT_POOL(self); |
0 |
7 |
7 |
|
| 359 |
7 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
7 |
7 |
|
| 360 |
7 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
7 |
7 |
|
| 361 |
7 |
▶ | if (len > h->elem_size) |
Branch: 1 branch
| Branch | True | False | Total |
| if (len > h->elem_size) |
0 |
7 |
7 |
|
| 362 |
0 |
| len = h->elem_size; |
| 363 |
7 |
| memcpy(pool_slot_ptr(h, slot), bytes, len); |
| 364 |
7 |
▶ | if (len < h->elem_size) |
Branch: 1 branch
| Branch | True | False | Total |
| if (len < h->elem_size) |
3 |
4 |
7 |
|
| 365 |
3 |
| memset(pool_slot_ptr(h, slot) + len, 0, h->elem_size - len); |
| 366 |
|
| |
| 367 |
|
| bool |
| 368 |
|
| is_allocated(self, slot) |
| 369 |
|
| SV *self |
| 370 |
|
| UV slot |
| 371 |
|
| PREINIT: |
| 372 |
26 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
26 |
0 |
26 |
| EXTRACT_POOL(self); |
0 |
26 |
26 |
| EXTRACT_POOL(self); |
0 |
26 |
26 |
|
| 373 |
|
| CODE: |
| 374 |
26 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
1 |
25 |
26 |
|
| 375 |
25 |
▶ | RETVAL = pool_is_allocated(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = pool_is_allocated(h, slot); |
23 |
2 |
25 |
|
| 376 |
|
| OUTPUT: |
| 377 |
|
| RETVAL |
| 378 |
|
| |
| 379 |
|
| UV |
| 380 |
|
| capacity(self) |
| 381 |
|
| SV *self |
| 382 |
|
| PREINIT: |
| 383 |
11 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
11 |
0 |
11 |
| EXTRACT_POOL(self); |
0 |
11 |
11 |
| EXTRACT_POOL(self); |
0 |
11 |
11 |
|
| 384 |
|
| CODE: |
| 385 |
11 |
▶ | RETVAL = (UV)h->hdr->capacity; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (UV)h->hdr->capacity; |
7 |
4 |
11 |
|
| 386 |
|
| OUTPUT: |
| 387 |
|
| RETVAL |
| 388 |
|
| |
| 389 |
|
| UV |
| 390 |
|
| elem_size(self) |
| 391 |
|
| SV *self |
| 392 |
|
| PREINIT: |
| 393 |
3 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
3 |
0 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
|
| 394 |
|
| CODE: |
| 395 |
3 |
▶ | RETVAL = h->hdr->elem_size; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = h->hdr->elem_size; |
0 |
3 |
3 |
|
| 396 |
|
| OUTPUT: |
| 397 |
|
| RETVAL |
| 398 |
|
| |
| 399 |
|
| UV |
| 400 |
|
| used(self) |
| 401 |
|
| SV *self |
| 402 |
|
| PREINIT: |
| 403 |
67 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
67 |
0 |
67 |
| EXTRACT_POOL(self); |
0 |
67 |
67 |
| EXTRACT_POOL(self); |
0 |
67 |
67 |
|
| 404 |
|
| CODE: |
| 405 |
67 |
▶ | RETVAL = __atomic_load_n(&h->hdr->used, __ATOMIC_RELAXED); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = __atomic_load_n(&h->hdr->used, __ATOMIC_RELAXED); |
37 |
30 |
67 |
|
| 406 |
|
| OUTPUT: |
| 407 |
|
| RETVAL |
| 408 |
|
| |
| 409 |
|
| UV |
| 410 |
|
| available(self) |
| 411 |
|
| SV *self |
| 412 |
|
| PREINIT: |
| 413 |
3 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
3 |
0 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
|
| 414 |
|
| CODE: |
| 415 |
3 |
| RETVAL = (UV)pool_available(h); |
| 416 |
|
| OUTPUT: |
| 417 |
|
| RETVAL |
| 418 |
|
| |
| 419 |
|
| UV |
| 420 |
|
| owner(self, slot) |
| 421 |
|
| SV *self |
| 422 |
|
| UV slot |
| 423 |
|
| PREINIT: |
| 424 |
2 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
2 |
0 |
2 |
| EXTRACT_POOL(self); |
0 |
2 |
2 |
| EXTRACT_POOL(self); |
0 |
2 |
2 |
|
| 425 |
|
| CODE: |
| 426 |
2 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
1 |
1 |
2 |
|
| 427 |
1 |
▶ | RETVAL = __atomic_load_n(&h->owners[slot], __ATOMIC_RELAXED) & ~POOL_OWNER_RECOVERING; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = __atomic_load_n(&h->owners[slot], __ATOMIC_RELAXED) & ~POOL_OWNER_RECOVERING; |
0 |
1 |
1 |
|
| 428 |
|
| OUTPUT: |
| 429 |
|
| RETVAL |
| 430 |
|
| |
| 431 |
|
| UV |
| 432 |
|
| recover_stale(self) |
| 433 |
|
| SV *self |
| 434 |
|
| PREINIT: |
| 435 |
3 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
3 |
0 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
|
| 436 |
|
| CODE: |
| 437 |
3 |
▶ | RETVAL = pool_recover_stale(h); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = pool_recover_stale(h); |
0 |
3 |
3 |
|
| 438 |
|
| OUTPUT: |
| 439 |
|
| RETVAL |
| 440 |
|
| |
| 441 |
|
| void |
| 442 |
|
| reset(self) |
| 443 |
|
| SV *self |
| 444 |
|
| PREINIT: |
| 445 |
10 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
10 |
0 |
10 |
| EXTRACT_POOL(self); |
0 |
10 |
10 |
| EXTRACT_POOL(self); |
0 |
10 |
10 |
|
| 446 |
|
| CODE: |
| 447 |
10 |
| pool_reset(h); |
| 448 |
|
| |
| 449 |
|
| void |
| 450 |
|
| scan_from(self, slot) |
| 451 |
|
| SV *self |
| 452 |
|
| UV slot |
| 453 |
|
| PREINIT: |
| 454 |
8 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
8 |
0 |
8 |
| EXTRACT_POOL(self); |
0 |
8 |
8 |
| EXTRACT_POOL(self); |
0 |
8 |
8 |
|
| 455 |
|
| CODE: |
| 456 |
8 |
| pool_scan_from(h, (uint64_t)slot); |
| 457 |
|
| |
| 458 |
|
| SV * |
| 459 |
|
| path(self) |
| 460 |
|
| SV *self |
| 461 |
|
| PREINIT: |
| 462 |
3 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
3 |
0 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
|
| 463 |
|
| CODE: |
| 464 |
3 |
▶ | 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 |
2 |
3 |
|
| 465 |
|
| OUTPUT: |
| 466 |
|
| RETVAL |
| 467 |
|
| |
| 468 |
|
| IV |
| 469 |
|
| memfd(self) |
| 470 |
|
| SV *self |
| 471 |
|
| PREINIT: |
| 472 |
5 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
5 |
0 |
5 |
| EXTRACT_POOL(self); |
0 |
5 |
5 |
| EXTRACT_POOL(self); |
0 |
5 |
5 |
|
| 473 |
|
| CODE: |
| 474 |
5 |
▶ | RETVAL = h->backing_fd; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = h->backing_fd; |
0 |
5 |
5 |
|
| 475 |
|
| OUTPUT: |
| 476 |
|
| RETVAL |
| 477 |
|
| |
| 478 |
|
| IV |
| 479 |
|
| eventfd(self) |
| 480 |
|
| SV *self |
| 481 |
|
| PREINIT: |
| 482 |
3 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
3 |
0 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
|
| 483 |
|
| CODE: |
| 484 |
3 |
| RETVAL = pool_create_eventfd(h); |
| 485 |
3 |
▶ | if (RETVAL < 0) croak("eventfd: %s", strerror(errno)); |
Branch: 1 branch
| Branch | True | False | Total |
| if (RETVAL < 0) croak("eventfd: %s", strerror(errno)); |
0 |
3 |
3 |
|
| 486 |
|
| OUTPUT: |
| 487 |
|
| RETVAL |
| 488 |
|
| |
| 489 |
|
| void |
| 490 |
|
| eventfd_set(self, fd) |
| 491 |
|
| SV *self |
| 492 |
|
| int fd |
| 493 |
|
| PREINIT: |
| 494 |
3 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
3 |
0 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
|
| 495 |
|
| CODE: |
| 496 |
3 |
▶ | if (h->notify_fd >= 0 && h->notify_fd != fd) close(h->notify_fd); |
Branch: 2 branches
| Branch | True | False | Total |
| if (h->notify_fd >= 0 && h->notify_fd != fd) close(h->notify_fd); |
3 |
0 |
3 |
| if (h->notify_fd >= 0 && h->notify_fd != fd) close(h->notify_fd); |
2 |
1 |
3 |
|
| 497 |
3 |
| h->notify_fd = fd; |
| 498 |
|
| |
| 499 |
|
| IV |
| 500 |
|
| fileno(self) |
| 501 |
|
| SV *self |
| 502 |
|
| PREINIT: |
| 503 |
6 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
6 |
0 |
6 |
| EXTRACT_POOL(self); |
0 |
6 |
6 |
| EXTRACT_POOL(self); |
0 |
6 |
6 |
|
| 504 |
|
| CODE: |
| 505 |
6 |
▶ | RETVAL = h->notify_fd; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = h->notify_fd; |
0 |
6 |
6 |
|
| 506 |
|
| OUTPUT: |
| 507 |
|
| RETVAL |
| 508 |
|
| |
| 509 |
|
| bool |
| 510 |
|
| notify(self) |
| 511 |
|
| SV *self |
| 512 |
|
| PREINIT: |
| 513 |
4 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
4 |
0 |
4 |
| EXTRACT_POOL(self); |
0 |
4 |
4 |
| EXTRACT_POOL(self); |
0 |
4 |
4 |
|
| 514 |
|
| CODE: |
| 515 |
4 |
▶ | RETVAL = pool_notify(h); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = pool_notify(h); |
4 |
0 |
4 |
|
| 516 |
|
| OUTPUT: |
| 517 |
|
| RETVAL |
| 518 |
|
| |
| 519 |
|
| SV * |
| 520 |
|
| eventfd_consume(self) |
| 521 |
|
| SV *self |
| 522 |
|
| PREINIT: |
| 523 |
4 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
4 |
0 |
4 |
| EXTRACT_POOL(self); |
0 |
4 |
4 |
| EXTRACT_POOL(self); |
0 |
4 |
4 |
|
| 524 |
|
| CODE: |
| 525 |
4 |
| int64_t v = pool_eventfd_consume(h); |
| 526 |
4 |
▶ | RETVAL = (v >= 0) ? newSViv((IV)v) : &PL_sv_undef; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (v >= 0) ? newSViv((IV)v) : &PL_sv_undef; |
3 |
1 |
4 |
|
| 527 |
|
| OUTPUT: |
| 528 |
|
| RETVAL |
| 529 |
|
| |
| 530 |
|
| void |
| 531 |
|
| sync(self) |
| 532 |
|
| SV *self |
| 533 |
|
| PREINIT: |
| 534 |
1 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
1 |
0 |
1 |
| EXTRACT_POOL(self); |
0 |
1 |
1 |
| EXTRACT_POOL(self); |
0 |
1 |
1 |
|
| 535 |
|
| CODE: |
| 536 |
1 |
▶ | if (pool_msync(h) != 0) croak("msync: %s", strerror(errno)); |
Branch: 1 branch
| Branch | True | False | Total |
| if (pool_msync(h) != 0) croak("msync: %s", strerror(errno)); |
0 |
1 |
1 |
|
| 537 |
|
| |
| 538 |
|
| void |
| 539 |
|
| unlink(self_or_class, ...) |
| 540 |
|
| SV *self_or_class |
| 541 |
|
| CODE: |
| 542 |
|
| const char *p; |
| 543 |
3 |
▶ | if (sv_isobject(self_or_class) && sv_derived_from(self_or_class, "Data::Pool::Shared")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (sv_isobject(self_or_class) && sv_derived_from(self_or_class, "Data::Pool::Shared")) { |
2 |
1 |
3 |
| if (sv_isobject(self_or_class) && sv_derived_from(self_or_class, "Data::Pool::Shared")) { |
2 |
0 |
2 |
|
| 544 |
2 |
| PoolHandle *h = INT2PTR(PoolHandle*, SvIV(SvRV(self_or_class))); |
| 545 |
2 |
▶ | if (!h) croak("Attempted to use a destroyed object"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!h) croak("Attempted to use a destroyed object"); |
0 |
2 |
2 |
|
| 546 |
2 |
| p = h->path; |
| 547 |
|
| } else { |
| 548 |
1 |
▶ | if (items < 2) croak("Usage: ...->unlink($path)"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 2) croak("Usage: ...->unlink($path)"); |
0 |
1 |
1 |
|
| 549 |
2 |
| p = SvPV_nolen(ST(1)); |
| 550 |
|
| } |
| 551 |
3 |
▶ | if (!p) croak("cannot unlink anonymous or memfd object"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!p) croak("cannot unlink anonymous or memfd object"); |
1 |
2 |
3 |
|
| 552 |
2 |
▶ | if (unlink(p) != 0 && errno != ENOENT) |
Branch: 2 branches
| Branch | True | False | Total |
| if (unlink(p) != 0 && errno != ENOENT) |
0 |
2 |
2 |
| if (unlink(p) != 0 && errno != ENOENT) |
0 |
0 |
0 |
|
| 553 |
0 |
| croak("unlink(%s): %s", p, strerror(errno)); |
| 554 |
|
| |
| 555 |
|
| SV * |
| 556 |
|
| stats(self) |
| 557 |
|
| SV *self |
| 558 |
|
| PREINIT: |
| 559 |
6 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
6 |
0 |
6 |
| EXTRACT_POOL(self); |
0 |
6 |
6 |
| EXTRACT_POOL(self); |
0 |
6 |
6 |
|
| 560 |
|
| CODE: |
| 561 |
6 |
| HV *hv = newHV(); |
| 562 |
6 |
| PoolHeader *hdr = h->hdr; |
| 563 |
6 |
| hv_store(hv, "capacity", 8, newSVuv((UV)hdr->capacity), 0); |
| 564 |
6 |
| hv_store(hv, "elem_size", 9, newSVuv(hdr->elem_size), 0); |
| 565 |
6 |
| hv_store(hv, "used", 4, newSVuv((UV)__atomic_load_n(&hdr->used, __ATOMIC_RELAXED)), 0); |
| 566 |
6 |
| hv_store(hv, "available", 9, |
| 567 |
|
| newSVuv((UV)pool_available(h)), 0); |
| 568 |
6 |
| hv_store(hv, "waiters", 7, newSVuv((UV)__atomic_load_n(&hdr->waiters, __ATOMIC_RELAXED)), 0); |
| 569 |
6 |
| hv_store(hv, "mmap_size", 9, newSVuv((UV)h->mmap_size), 0); |
| 570 |
6 |
| hv_store(hv, "allocs", 6, newSVuv((UV)__atomic_load_n(&hdr->stat_allocs, __ATOMIC_RELAXED)), 0); |
| 571 |
6 |
| hv_store(hv, "frees", 5, newSVuv((UV)__atomic_load_n(&hdr->stat_frees, __ATOMIC_RELAXED)), 0); |
| 572 |
6 |
| hv_store(hv, "waits", 5, newSVuv((UV)__atomic_load_n(&hdr->stat_waits, __ATOMIC_RELAXED)), 0); |
| 573 |
6 |
| hv_store(hv, "timeouts", 8, newSVuv((UV)__atomic_load_n(&hdr->stat_timeouts, __ATOMIC_RELAXED)), 0); |
| 574 |
6 |
| hv_store(hv, "recoveries", 10, newSVuv((UV)__atomic_load_n(&hdr->stat_recoveries, __ATOMIC_RELAXED)), 0); |
| 575 |
6 |
| RETVAL = newRV_noinc((SV *)hv); |
| 576 |
|
| OUTPUT: |
| 577 |
|
| RETVAL |
| 578 |
|
| |
| 579 |
|
| |
| 580 |
|
| SV * |
| 581 |
|
| alloc_n(self, count, ...) |
| 582 |
|
| SV *self |
| 583 |
|
| UV count |
| 584 |
|
| PREINIT: |
| 585 |
7 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
7 |
0 |
7 |
| EXTRACT_POOL(self); |
0 |
7 |
7 |
| EXTRACT_POOL(self); |
0 |
7 |
7 |
|
| 586 |
7 |
| double timeout = -1; |
| 587 |
|
| CODE: |
| 588 |
7 |
▶ | if (items > 2 && (SvGETMAGIC(ST(2)), SvOK(ST(2)))) timeout = SvNV(ST(2)); |
Branch: 4 branches
| Branch | True | False | Total |
| if (items > 2 && (SvGETMAGIC(ST(2)), SvOK(ST(2)))) timeout = SvNV(ST(2)); |
1 |
6 |
7 |
| if (items > 2 && (SvGETMAGIC(ST(2)), SvOK(ST(2)))) timeout = SvNV(ST(2)); |
0 |
1 |
1 |
| if (items > 2 && (SvGETMAGIC(ST(2)), SvOK(ST(2)))) timeout = SvNV(ST(2)); |
0 |
0 |
0 |
| if (items > 2 && (SvGETMAGIC(ST(2)), SvOK(ST(2)))) timeout = SvNV(ST(2)); |
1 |
0 |
1 |
|
| 589 |
7 |
▶ | if (count == 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (count == 0) { |
1 |
6 |
7 |
|
| 590 |
1 |
| RETVAL = newRV_noinc((SV *)newAV()); |
| 591 |
6 |
▶ | } else if (count > 0xFFFFFFFFU) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (count > 0xFFFFFFFFU) { |
0 |
6 |
6 |
|
| 592 |
0 |
| croak("Data::Pool::Shared->alloc_n: count exceeds 2^32"); /* would truncate to uint32 for pool_alloc_n */ |
| 593 |
|
| } else { |
| 594 |
|
| uint64_t *buf; |
| 595 |
6 |
▶ | Newx(buf, count, uint64_t); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(buf, count, uint64_t); |
0 |
6 |
6 |
|
| 596 |
6 |
| SAVEFREEPV(buf); /* freed on scope exit, incl. a croak from newSViv/av_push */ |
| 597 |
6 |
▶ | REEXTRACT_POOL(self); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_POOL(self); |
0 |
6 |
6 |
| REEXTRACT_POOL(self); |
0 |
6 |
6 |
|
| 598 |
6 |
▶ | if (pool_perl_alloc_n(aTHX_ self, h, buf, (uint32_t)count, timeout)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (pool_perl_alloc_n(aTHX_ self, h, buf, (uint32_t)count, timeout)) { |
5 |
1 |
6 |
|
| 599 |
5 |
| AV *av = newAV(); |
| 600 |
5 |
| av_extend(av, count - 1); |
| 601 |
14 |
▶ | for (UV i = 0; i < count; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (UV i = 0; i < count; i++) |
9 |
5 |
14 |
|
| 602 |
9 |
| av_push(av, newSViv((IV)buf[i])); |
| 603 |
5 |
| RETVAL = newRV_noinc((SV *)av); |
| 604 |
|
| } else { |
| 605 |
1 |
| RETVAL = &PL_sv_undef; |
| 606 |
|
| } |
| 607 |
|
| } |
| 608 |
|
| OUTPUT: |
| 609 |
|
| RETVAL |
| 610 |
|
| |
| 611 |
|
| UV |
| 612 |
|
| free_n(self, slots_av) |
| 613 |
|
| SV *self |
| 614 |
|
| SV *slots_av |
| 615 |
|
| PREINIT: |
| 616 |
10 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
10 |
0 |
10 |
| EXTRACT_POOL(self); |
0 |
10 |
10 |
| EXTRACT_POOL(self); |
0 |
10 |
10 |
|
| 617 |
|
| CODE: |
| 618 |
10 |
▶ | SvGETMAGIC(slots_av); /* a tied/overloaded scalar may FETCH to an arrayref */ |
Branch: 2 branches
| Branch | True | False | Total |
| SvGETMAGIC(slots_av); /* a tied/overloaded scalar may FETCH to an arrayref */ |
0 |
10 |
10 |
| SvGETMAGIC(slots_av); /* a tied/overloaded scalar may FETCH to an arrayref */ |
0 |
0 |
0 |
|
| 619 |
10 |
▶ | if (!SvROK(slots_av) || SvTYPE(SvRV(slots_av)) != SVt_PVAV) |
Branch: 2 branches
| Branch | True | False | Total |
| if (!SvROK(slots_av) || SvTYPE(SvRV(slots_av)) != SVt_PVAV) |
9 |
1 |
10 |
| if (!SvROK(slots_av) || SvTYPE(SvRV(slots_av)) != SVt_PVAV) |
0 |
9 |
9 |
|
| 620 |
1 |
| croak("free_n: expected arrayref"); |
| 621 |
9 |
| AV *av = (AV *)SvRV(slots_av); |
| 622 |
9 |
| sv_2mortal(SvREFCNT_inc((SV *)av)); /* pin the arrayref: element magic below cannot free it mid-loop */ |
| 623 |
9 |
| SSize_t len = av_top_index(av) + 1; |
| 624 |
9 |
▶ | if (len <= 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (len <= 0) { |
1 |
8 |
9 |
|
| 625 |
1 |
| RETVAL = 0; |
| 626 |
|
| } else { |
| 627 |
|
| uint64_t *buf; |
| 628 |
8 |
▶ | Newx(buf, len, uint64_t); |
Branch: 1 branch
| Branch | True | False | Total |
| Newx(buf, len, uint64_t); |
0 |
8 |
8 |
|
| 629 |
8 |
| SAVEFREEPV(buf); /* freed on scope exit, incl. a croak from SvUV magic */ |
| 630 |
21 |
▶ | for (SSize_t i = 0; i < len; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (SSize_t i = 0; i < len; i++) { |
15 |
6 |
21 |
|
| 631 |
15 |
| SV **svp = av_fetch(av, i, 0); |
| 632 |
15 |
▶ | if (svp && *svp) SvGETMAGIC(*svp); /* a tied-array element is a deferred-magic PVLV */ |
Branch: 4 branches
| Branch | True | False | Total |
| if (svp && *svp) SvGETMAGIC(*svp); /* a tied-array element is a deferred-magic PVLV */ |
15 |
0 |
15 |
| if (svp && *svp) SvGETMAGIC(*svp); /* a tied-array element is a deferred-magic PVLV */ |
15 |
0 |
15 |
| if (svp && *svp) SvGETMAGIC(*svp); /* a tied-array element is a deferred-magic PVLV */ |
0 |
15 |
15 |
| if (svp && *svp) SvGETMAGIC(*svp); /* a tied-array element is a deferred-magic PVLV */ |
0 |
0 |
0 |
|
| 633 |
15 |
▶ | if (!svp || !SvOK(*svp)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (!svp || !SvOK(*svp)) |
15 |
0 |
15 |
| if (!svp || !SvOK(*svp)) |
2 |
13 |
15 |
|
| 634 |
2 |
| croak("free_n: undef slot at index %ld", (long)i); |
| 635 |
13 |
| buf[i] = (uint64_t)SvUV(*svp); |
| 636 |
|
| } |
| 637 |
6 |
▶ | REEXTRACT_POOL(self); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_POOL(self); |
0 |
6 |
6 |
| REEXTRACT_POOL(self); |
0 |
6 |
6 |
|
| 638 |
6 |
| RETVAL = pool_free_n(h, buf, (uint32_t)len); |
| 639 |
|
| } |
| 640 |
|
| OUTPUT: |
| 641 |
|
| RETVAL |
| 642 |
|
| |
| 643 |
|
| SV * |
| 644 |
|
| allocated_slots(self) |
| 645 |
|
| SV *self |
| 646 |
|
| PREINIT: |
| 647 |
7 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
7 |
0 |
7 |
| EXTRACT_POOL(self); |
0 |
7 |
7 |
| EXTRACT_POOL(self); |
0 |
7 |
7 |
|
| 648 |
|
| CODE: |
| 649 |
7 |
| AV *av = newAV(); |
| 650 |
7 |
| uint64_t cap = h->capacity; |
| 651 |
7 |
| uint32_t nwords = h->bitmap_words; |
| 652 |
15 |
▶ | for (uint32_t widx = 0; widx < nwords; widx++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (uint32_t widx = 0; widx < nwords; widx++) { |
8 |
7 |
15 |
|
| 653 |
8 |
| uint64_t word = __atomic_load_n(&h->bitmap[widx], __ATOMIC_RELAXED); |
| 654 |
37 |
▶ | while (word) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (word) { |
29 |
8 |
37 |
|
| 655 |
29 |
| int bit = __builtin_ctzll(word); |
| 656 |
29 |
| uint64_t slot = (uint64_t)widx * 64 + bit; |
| 657 |
29 |
▶ | if (slot < cap) |
Branch: 1 branch
| Branch | True | False | Total |
| if (slot < cap) |
29 |
0 |
29 |
|
| 658 |
29 |
| av_push(av, newSViv((IV)slot)); |
| 659 |
29 |
| word &= word - 1; |
| 660 |
|
| } |
| 661 |
|
| } |
| 662 |
7 |
| RETVAL = newRV_noinc((SV *)av); |
| 663 |
|
| OUTPUT: |
| 664 |
|
| RETVAL |
| 665 |
|
| |
| 666 |
|
| UV |
| 667 |
|
| ptr(self, slot) |
| 668 |
|
| SV *self |
| 669 |
|
| UV slot |
| 670 |
|
| PREINIT: |
| 671 |
3 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
3 |
0 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
|
| 672 |
|
| CODE: |
| 673 |
3 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
1 |
2 |
3 |
|
| 674 |
2 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
1 |
1 |
2 |
|
| 675 |
1 |
▶ | RETVAL = PTR2UV(pool_slot_ptr(h, slot)); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = PTR2UV(pool_slot_ptr(h, slot)); |
0 |
1 |
1 |
|
| 676 |
|
| OUTPUT: |
| 677 |
|
| RETVAL |
| 678 |
|
| |
| 679 |
|
| UV |
| 680 |
|
| data_ptr(self) |
| 681 |
|
| SV *self |
| 682 |
|
| PREINIT: |
| 683 |
1 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
1 |
0 |
1 |
| EXTRACT_POOL(self); |
0 |
1 |
1 |
| EXTRACT_POOL(self); |
0 |
1 |
1 |
|
| 684 |
|
| CODE: |
| 685 |
1 |
▶ | RETVAL = PTR2UV(h->data); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = PTR2UV(h->data); |
0 |
1 |
1 |
|
| 686 |
|
| OUTPUT: |
| 687 |
|
| RETVAL |
| 688 |
|
| |
| 689 |
|
| SV * |
| 690 |
|
| slot_sv(self, slot) |
| 691 |
|
| SV *self |
| 692 |
|
| UV slot |
| 693 |
|
| PREINIT: |
| 694 |
5 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
5 |
0 |
5 |
| EXTRACT_POOL(self); |
0 |
5 |
5 |
| EXTRACT_POOL(self); |
0 |
5 |
5 |
|
| 695 |
|
| CODE: |
| 696 |
5 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
5 |
5 |
|
| 697 |
5 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
1 |
4 |
5 |
|
| 698 |
4 |
| RETVAL = newSV(0); |
| 699 |
4 |
| sv_upgrade(RETVAL, SVt_PV); |
| 700 |
4 |
| SvPV_set(RETVAL, (char *)pool_slot_ptr(h, slot)); |
| 701 |
4 |
| SvLEN_set(RETVAL, 0); |
| 702 |
4 |
| SvCUR_set(RETVAL, h->elem_size); |
| 703 |
4 |
| SvPOK_on(RETVAL); |
| 704 |
|
| /* Pin pool alive while this SV is referenced -- magic before READONLY */ |
| 705 |
4 |
| MAGIC *mg = sv_magicext(RETVAL, NULL, PERL_MAGIC_ext, &pool_scalar_magic_vtbl, NULL, 0); |
| 706 |
|
| /* Pin the REFERENT (the blessed handle), not the container RV: pinning self |
| 707 |
|
| * lets `$pool = undef` still drop the referent -> DESTROY munmaps -> the |
| 708 |
|
| * view SV's PV into the mapping dangles (SEGV). Guard SvRV(self). */ |
| 709 |
4 |
| mg->mg_obj = SvREFCNT_inc_simple_NN(SvRV(self)); |
| 710 |
4 |
| SvREADONLY_on(RETVAL); |
| 711 |
|
| OUTPUT: |
| 712 |
|
| RETVAL |
| 713 |
|
| |
| 714 |
|
| |
| 715 |
|
| MODULE = Data::Pool::Shared PACKAGE = Data::Pool::Shared::I64 |
| 716 |
|
| |
| 717 |
|
| PROTOTYPES: DISABLE |
| 718 |
|
| |
| 719 |
|
| SV * |
| 720 |
|
| new(class, path, capacity, ...) |
| 721 |
|
| const char *class |
| 722 |
|
| SV *path |
| 723 |
|
| UV capacity |
| 724 |
|
| PREINIT: |
| 725 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 726 |
|
| CODE: |
| 727 |
37 |
▶ | mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
Branch: 4 branches
| Branch | True | False | Total |
| mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
0 |
37 |
37 |
| mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
0 |
0 |
0 |
| mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
0 |
0 |
0 |
| mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
0 |
0 |
0 |
|
| 728 |
46 |
▶ | const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
Branch: 3 branches
| Branch | True | False | Total |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
0 |
37 |
37 |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
0 |
0 |
0 |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
9 |
28 |
37 |
|
| 729 |
37 |
| PoolHandle *h = pool_create(p, capacity, sizeof(int64_t), POOL_VAR_I64, mode, errbuf); |
| 730 |
37 |
▶ | if (!h) croak("Data::Pool::Shared::I64->new: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared::I64->new: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
37 |
37 |
| if (!h) croak("Data::Pool::Shared::I64->new: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
0 |
0 |
|
| 731 |
37 |
| MAKE_OBJ(class, h); |
| 732 |
|
| OUTPUT: |
| 733 |
|
| RETVAL |
| 734 |
|
| |
| 735 |
|
| SV * |
| 736 |
|
| new_memfd(class, name, capacity) |
| 737 |
|
| const char *class |
| 738 |
|
| const char *name |
| 739 |
|
| UV capacity |
| 740 |
|
| PREINIT: |
| 741 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 742 |
|
| CODE: |
| 743 |
2 |
| PoolHandle *h = pool_create_memfd(name, capacity, sizeof(int64_t), POOL_VAR_I64, errbuf); |
| 744 |
2 |
▶ | if (!h) croak("Data::Pool::Shared::I64->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared::I64->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
2 |
2 |
| if (!h) croak("Data::Pool::Shared::I64->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
0 |
0 |
|
| 745 |
2 |
| MAKE_OBJ(class, h); |
| 746 |
|
| OUTPUT: |
| 747 |
|
| RETVAL |
| 748 |
|
| |
| 749 |
|
| SV * |
| 750 |
|
| new_from_fd(class, fd) |
| 751 |
|
| const char *class |
| 752 |
|
| int fd |
| 753 |
|
| PREINIT: |
| 754 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 755 |
|
| CODE: |
| 756 |
1 |
| PoolHandle *h = pool_open_fd(fd, POOL_VAR_I64, errbuf); |
| 757 |
1 |
▶ | if (!h) croak("Data::Pool::Shared::I64->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared::I64->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
1 |
1 |
| if (!h) croak("Data::Pool::Shared::I64->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
0 |
0 |
|
| 758 |
1 |
| MAKE_OBJ(class, h); |
| 759 |
|
| OUTPUT: |
| 760 |
|
| RETVAL |
| 761 |
|
| |
| 762 |
|
| IV |
| 763 |
|
| get(self, slot) |
| 764 |
|
| SV *self |
| 765 |
|
| UV slot |
| 766 |
|
| PREINIT: |
| 767 |
67 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
67 |
0 |
67 |
| EXTRACT_POOL(self); |
0 |
67 |
67 |
| EXTRACT_POOL(self); |
0 |
67 |
67 |
|
| 768 |
|
| CODE: |
| 769 |
67 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
1 |
66 |
67 |
|
| 770 |
66 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
1 |
65 |
66 |
|
| 771 |
65 |
| RETVAL = (IV)pool_get_i64(h, slot); |
| 772 |
|
| OUTPUT: |
| 773 |
|
| RETVAL |
| 774 |
|
| |
| 775 |
|
| void |
| 776 |
|
| set(self, slot, val) |
| 777 |
|
| SV *self |
| 778 |
|
| UV slot |
| 779 |
|
| IV val |
| 780 |
|
| PREINIT: |
| 781 |
610 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
610 |
0 |
610 |
| EXTRACT_POOL(self); |
0 |
610 |
610 |
| EXTRACT_POOL(self); |
0 |
610 |
610 |
|
| 782 |
|
| CODE: |
| 783 |
610 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
1 |
609 |
610 |
|
| 784 |
609 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
1 |
608 |
609 |
|
| 785 |
608 |
| pool_set_i64(h, slot, (int64_t)val); |
| 786 |
|
| |
| 787 |
|
| bool |
| 788 |
|
| cas(self, slot, expected, desired) |
| 789 |
|
| SV *self |
| 790 |
|
| UV slot |
| 791 |
|
| IV expected |
| 792 |
|
| IV desired |
| 793 |
|
| PREINIT: |
| 794 |
4 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
4 |
0 |
4 |
| EXTRACT_POOL(self); |
0 |
4 |
4 |
| EXTRACT_POOL(self); |
0 |
4 |
4 |
|
| 795 |
|
| CODE: |
| 796 |
4 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
4 |
4 |
|
| 797 |
4 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
1 |
3 |
4 |
|
| 798 |
3 |
▶ | RETVAL = pool_cas_i64(h, slot, (int64_t)expected, (int64_t)desired); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = pool_cas_i64(h, slot, (int64_t)expected, (int64_t)desired); |
2 |
1 |
3 |
|
| 799 |
|
| OUTPUT: |
| 800 |
|
| RETVAL |
| 801 |
|
| |
| 802 |
|
| IV |
| 803 |
|
| cmpxchg(self, slot, expected, desired) |
| 804 |
|
| SV *self |
| 805 |
|
| UV slot |
| 806 |
|
| IV expected |
| 807 |
|
| IV desired |
| 808 |
|
| PREINIT: |
| 809 |
2 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
2 |
0 |
2 |
| EXTRACT_POOL(self); |
0 |
2 |
2 |
| EXTRACT_POOL(self); |
0 |
2 |
2 |
|
| 810 |
|
| CODE: |
| 811 |
2 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
2 |
2 |
|
| 812 |
2 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
2 |
2 |
|
| 813 |
2 |
| RETVAL = (IV)pool_cmpxchg_i64(h, slot, (int64_t)expected, (int64_t)desired); |
| 814 |
|
| OUTPUT: |
| 815 |
|
| RETVAL |
| 816 |
|
| |
| 817 |
|
| IV |
| 818 |
|
| xchg(self, slot, val) |
| 819 |
|
| SV *self |
| 820 |
|
| UV slot |
| 821 |
|
| IV val |
| 822 |
|
| PREINIT: |
| 823 |
1 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
1 |
0 |
1 |
| EXTRACT_POOL(self); |
0 |
1 |
1 |
| EXTRACT_POOL(self); |
0 |
1 |
1 |
|
| 824 |
|
| CODE: |
| 825 |
1 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
1 |
1 |
|
| 826 |
1 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
1 |
1 |
|
| 827 |
1 |
| RETVAL = (IV)pool_xchg_i64(h, slot, (int64_t)val); |
| 828 |
|
| OUTPUT: |
| 829 |
|
| RETVAL |
| 830 |
|
| |
| 831 |
|
| IV |
| 832 |
|
| add(self, slot, delta) |
| 833 |
|
| SV *self |
| 834 |
|
| UV slot |
| 835 |
|
| IV delta |
| 836 |
|
| PREINIT: |
| 837 |
3 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
3 |
0 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
|
| 838 |
|
| CODE: |
| 839 |
3 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
3 |
3 |
|
| 840 |
3 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
1 |
2 |
3 |
|
| 841 |
2 |
| RETVAL = (IV)pool_add_i64(h, slot, (int64_t)delta); |
| 842 |
|
| OUTPUT: |
| 843 |
|
| RETVAL |
| 844 |
|
| |
| 845 |
|
| IV |
| 846 |
|
| incr(self, slot) |
| 847 |
|
| SV *self |
| 848 |
|
| UV slot |
| 849 |
|
| PREINIT: |
| 850 |
4 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
4 |
0 |
4 |
| EXTRACT_POOL(self); |
0 |
4 |
4 |
| EXTRACT_POOL(self); |
0 |
4 |
4 |
|
| 851 |
|
| CODE: |
| 852 |
4 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
4 |
4 |
|
| 853 |
4 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
1 |
3 |
4 |
|
| 854 |
3 |
| RETVAL = (IV)pool_add_i64(h, slot, 1); |
| 855 |
|
| OUTPUT: |
| 856 |
|
| RETVAL |
| 857 |
|
| |
| 858 |
|
| IV |
| 859 |
|
| decr(self, slot) |
| 860 |
|
| SV *self |
| 861 |
|
| UV slot |
| 862 |
|
| PREINIT: |
| 863 |
3 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
3 |
0 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
| EXTRACT_POOL(self); |
0 |
3 |
3 |
|
| 864 |
|
| CODE: |
| 865 |
3 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
3 |
3 |
|
| 866 |
3 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
1 |
2 |
3 |
|
| 867 |
2 |
| RETVAL = (IV)pool_add_i64(h, slot, -1); |
| 868 |
|
| OUTPUT: |
| 869 |
|
| RETVAL |
| 870 |
|
| |
| 871 |
|
| |
| 872 |
|
| MODULE = Data::Pool::Shared PACKAGE = Data::Pool::Shared::F64 |
| 873 |
|
| |
| 874 |
|
| PROTOTYPES: DISABLE |
| 875 |
|
| |
| 876 |
|
| SV * |
| 877 |
|
| new(class, path, capacity, ...) |
| 878 |
|
| const char *class |
| 879 |
|
| SV *path |
| 880 |
|
| UV capacity |
| 881 |
|
| PREINIT: |
| 882 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 883 |
|
| CODE: |
| 884 |
4 |
▶ | mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
Branch: 4 branches
| Branch | True | False | Total |
| mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
0 |
4 |
4 |
| mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
0 |
0 |
0 |
| mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
0 |
0 |
0 |
| mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
0 |
0 |
0 |
|
| 885 |
4 |
▶ | const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
Branch: 3 branches
| Branch | True | False | Total |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
0 |
4 |
4 |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
0 |
0 |
0 |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
0 |
4 |
4 |
|
| 886 |
4 |
| PoolHandle *h = pool_create(p, capacity, sizeof(double), POOL_VAR_F64, mode, errbuf); |
| 887 |
4 |
▶ | if (!h) croak("Data::Pool::Shared::F64->new: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared::F64->new: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
4 |
4 |
| if (!h) croak("Data::Pool::Shared::F64->new: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
0 |
0 |
|
| 888 |
4 |
| MAKE_OBJ(class, h); |
| 889 |
|
| OUTPUT: |
| 890 |
|
| RETVAL |
| 891 |
|
| |
| 892 |
|
| SV * |
| 893 |
|
| new_memfd(class, name, capacity) |
| 894 |
|
| const char *class |
| 895 |
|
| const char *name |
| 896 |
|
| UV capacity |
| 897 |
|
| PREINIT: |
| 898 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 899 |
|
| CODE: |
| 900 |
1 |
| PoolHandle *h = pool_create_memfd(name, capacity, sizeof(double), POOL_VAR_F64, errbuf); |
| 901 |
1 |
▶ | if (!h) croak("Data::Pool::Shared::F64->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared::F64->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
1 |
1 |
| if (!h) croak("Data::Pool::Shared::F64->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
0 |
0 |
|
| 902 |
1 |
| MAKE_OBJ(class, h); |
| 903 |
|
| OUTPUT: |
| 904 |
|
| RETVAL |
| 905 |
|
| |
| 906 |
|
| SV * |
| 907 |
|
| new_from_fd(class, fd) |
| 908 |
|
| const char *class |
| 909 |
|
| int fd |
| 910 |
|
| PREINIT: |
| 911 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 912 |
|
| CODE: |
| 913 |
1 |
| PoolHandle *h = pool_open_fd(fd, POOL_VAR_F64, errbuf); |
| 914 |
1 |
▶ | if (!h) croak("Data::Pool::Shared::F64->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared::F64->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
1 |
1 |
| if (!h) croak("Data::Pool::Shared::F64->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
0 |
0 |
|
| 915 |
1 |
| MAKE_OBJ(class, h); |
| 916 |
|
| OUTPUT: |
| 917 |
|
| RETVAL |
| 918 |
|
| |
| 919 |
|
| NV |
| 920 |
|
| get(self, slot) |
| 921 |
|
| SV *self |
| 922 |
|
| UV slot |
| 923 |
|
| PREINIT: |
| 924 |
7 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
7 |
0 |
7 |
| EXTRACT_POOL(self); |
0 |
7 |
7 |
| EXTRACT_POOL(self); |
0 |
7 |
7 |
|
| 925 |
|
| CODE: |
| 926 |
7 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
7 |
7 |
|
| 927 |
7 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
7 |
7 |
|
| 928 |
7 |
| RETVAL = pool_get_f64(h, slot); |
| 929 |
|
| OUTPUT: |
| 930 |
|
| RETVAL |
| 931 |
|
| |
| 932 |
|
| void |
| 933 |
|
| set(self, slot, val) |
| 934 |
|
| SV *self |
| 935 |
|
| UV slot |
| 936 |
|
| NV val |
| 937 |
|
| PREINIT: |
| 938 |
7 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
7 |
0 |
7 |
| EXTRACT_POOL(self); |
0 |
7 |
7 |
| EXTRACT_POOL(self); |
0 |
7 |
7 |
|
| 939 |
|
| CODE: |
| 940 |
7 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
7 |
7 |
|
| 941 |
7 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
7 |
7 |
|
| 942 |
7 |
| pool_set_f64(h, slot, (double)val); |
| 943 |
|
| |
| 944 |
|
| |
| 945 |
|
| MODULE = Data::Pool::Shared PACKAGE = Data::Pool::Shared::I32 |
| 946 |
|
| |
| 947 |
|
| PROTOTYPES: DISABLE |
| 948 |
|
| |
| 949 |
|
| SV * |
| 950 |
|
| new(class, path, capacity, ...) |
| 951 |
|
| const char *class |
| 952 |
|
| SV *path |
| 953 |
|
| UV capacity |
| 954 |
|
| PREINIT: |
| 955 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 956 |
|
| CODE: |
| 957 |
5 |
▶ | mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
Branch: 4 branches
| Branch | True | False | Total |
| mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
0 |
5 |
5 |
| mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
0 |
0 |
0 |
| mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
0 |
0 |
0 |
| mode_t mode = (items > 3 && (SvGETMAGIC(ST(3)), SvOK(ST(3)))) ? (mode_t)SvUV(ST(3)) : 0600; |
0 |
0 |
0 |
|
| 958 |
5 |
▶ | const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
Branch: 3 branches
| Branch | True | False | Total |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
0 |
5 |
5 |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
0 |
0 |
0 |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
0 |
5 |
5 |
|
| 959 |
5 |
| PoolHandle *h = pool_create(p, capacity, sizeof(int32_t), POOL_VAR_I32, mode, errbuf); |
| 960 |
5 |
▶ | if (!h) croak("Data::Pool::Shared::I32->new: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared::I32->new: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
5 |
5 |
| if (!h) croak("Data::Pool::Shared::I32->new: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
0 |
0 |
|
| 961 |
5 |
| MAKE_OBJ(class, h); |
| 962 |
|
| OUTPUT: |
| 963 |
|
| RETVAL |
| 964 |
|
| |
| 965 |
|
| SV * |
| 966 |
|
| new_memfd(class, name, capacity) |
| 967 |
|
| const char *class |
| 968 |
|
| const char *name |
| 969 |
|
| UV capacity |
| 970 |
|
| PREINIT: |
| 971 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 972 |
|
| CODE: |
| 973 |
1 |
| PoolHandle *h = pool_create_memfd(name, capacity, sizeof(int32_t), POOL_VAR_I32, errbuf); |
| 974 |
1 |
▶ | if (!h) croak("Data::Pool::Shared::I32->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared::I32->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
1 |
1 |
| if (!h) croak("Data::Pool::Shared::I32->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
0 |
0 |
|
| 975 |
1 |
| MAKE_OBJ(class, h); |
| 976 |
|
| OUTPUT: |
| 977 |
|
| RETVAL |
| 978 |
|
| |
| 979 |
|
| SV * |
| 980 |
|
| new_from_fd(class, fd) |
| 981 |
|
| const char *class |
| 982 |
|
| int fd |
| 983 |
|
| PREINIT: |
| 984 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 985 |
|
| CODE: |
| 986 |
1 |
| PoolHandle *h = pool_open_fd(fd, POOL_VAR_I32, errbuf); |
| 987 |
1 |
▶ | if (!h) croak("Data::Pool::Shared::I32->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared::I32->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
1 |
1 |
| if (!h) croak("Data::Pool::Shared::I32->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
0 |
0 |
|
| 988 |
1 |
| MAKE_OBJ(class, h); |
| 989 |
|
| OUTPUT: |
| 990 |
|
| RETVAL |
| 991 |
|
| |
| 992 |
|
| IV |
| 993 |
|
| get(self, slot) |
| 994 |
|
| SV *self |
| 995 |
|
| UV slot |
| 996 |
|
| PREINIT: |
| 997 |
5 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
5 |
0 |
5 |
| EXTRACT_POOL(self); |
0 |
5 |
5 |
| EXTRACT_POOL(self); |
0 |
5 |
5 |
|
| 998 |
|
| CODE: |
| 999 |
5 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
5 |
5 |
|
| 1000 |
5 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
5 |
5 |
|
| 1001 |
5 |
▶ | RETVAL = (IV)pool_get_i32(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (IV)pool_get_i32(h, slot); |
0 |
5 |
5 |
|
| 1002 |
|
| OUTPUT: |
| 1003 |
|
| RETVAL |
| 1004 |
|
| |
| 1005 |
|
| void |
| 1006 |
|
| set(self, slot, val) |
| 1007 |
|
| SV *self |
| 1008 |
|
| UV slot |
| 1009 |
|
| IV val |
| 1010 |
|
| PREINIT: |
| 1011 |
6 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
6 |
0 |
6 |
| EXTRACT_POOL(self); |
0 |
6 |
6 |
| EXTRACT_POOL(self); |
0 |
6 |
6 |
|
| 1012 |
|
| CODE: |
| 1013 |
6 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
6 |
6 |
|
| 1014 |
6 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
6 |
6 |
|
| 1015 |
6 |
| pool_set_i32(h, slot, (int32_t)val); |
| 1016 |
|
| |
| 1017 |
|
| bool |
| 1018 |
|
| cas(self, slot, expected, desired) |
| 1019 |
|
| SV *self |
| 1020 |
|
| UV slot |
| 1021 |
|
| IV expected |
| 1022 |
|
| IV desired |
| 1023 |
|
| PREINIT: |
| 1024 |
1 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
1 |
0 |
1 |
| EXTRACT_POOL(self); |
0 |
1 |
1 |
| EXTRACT_POOL(self); |
0 |
1 |
1 |
|
| 1025 |
|
| CODE: |
| 1026 |
1 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
1 |
1 |
|
| 1027 |
1 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
1 |
1 |
|
| 1028 |
1 |
▶ | RETVAL = pool_cas_i32(h, slot, (int32_t)expected, (int32_t)desired); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = pool_cas_i32(h, slot, (int32_t)expected, (int32_t)desired); |
1 |
0 |
1 |
|
| 1029 |
|
| OUTPUT: |
| 1030 |
|
| RETVAL |
| 1031 |
|
| |
| 1032 |
|
| IV |
| 1033 |
|
| cmpxchg(self, slot, expected, desired) |
| 1034 |
|
| SV *self |
| 1035 |
|
| UV slot |
| 1036 |
|
| IV expected |
| 1037 |
|
| IV desired |
| 1038 |
|
| PREINIT: |
| 1039 |
2 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
2 |
0 |
2 |
| EXTRACT_POOL(self); |
0 |
2 |
2 |
| EXTRACT_POOL(self); |
0 |
2 |
2 |
|
| 1040 |
|
| CODE: |
| 1041 |
2 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
2 |
2 |
|
| 1042 |
2 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
2 |
2 |
|
| 1043 |
2 |
▶ | RETVAL = (IV)pool_cmpxchg_i32(h, slot, (int32_t)expected, (int32_t)desired); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (IV)pool_cmpxchg_i32(h, slot, (int32_t)expected, (int32_t)desired); |
0 |
2 |
2 |
|
| 1044 |
|
| OUTPUT: |
| 1045 |
|
| RETVAL |
| 1046 |
|
| |
| 1047 |
|
| IV |
| 1048 |
|
| xchg(self, slot, val) |
| 1049 |
|
| SV *self |
| 1050 |
|
| UV slot |
| 1051 |
|
| IV val |
| 1052 |
|
| PREINIT: |
| 1053 |
1 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
1 |
0 |
1 |
| EXTRACT_POOL(self); |
0 |
1 |
1 |
| EXTRACT_POOL(self); |
0 |
1 |
1 |
|
| 1054 |
|
| CODE: |
| 1055 |
1 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
1 |
1 |
|
| 1056 |
1 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
1 |
1 |
|
| 1057 |
1 |
▶ | RETVAL = (IV)pool_xchg_i32(h, slot, (int32_t)val); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (IV)pool_xchg_i32(h, slot, (int32_t)val); |
0 |
1 |
1 |
|
| 1058 |
|
| OUTPUT: |
| 1059 |
|
| RETVAL |
| 1060 |
|
| |
| 1061 |
|
| IV |
| 1062 |
|
| add(self, slot, delta) |
| 1063 |
|
| SV *self |
| 1064 |
|
| UV slot |
| 1065 |
|
| IV delta |
| 1066 |
|
| PREINIT: |
| 1067 |
2 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
2 |
0 |
2 |
| EXTRACT_POOL(self); |
0 |
2 |
2 |
| EXTRACT_POOL(self); |
0 |
2 |
2 |
|
| 1068 |
|
| CODE: |
| 1069 |
2 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
2 |
2 |
|
| 1070 |
2 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
2 |
2 |
|
| 1071 |
2 |
▶ | RETVAL = (IV)pool_add_i32(h, slot, (int32_t)delta); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (IV)pool_add_i32(h, slot, (int32_t)delta); |
0 |
2 |
2 |
|
| 1072 |
|
| OUTPUT: |
| 1073 |
|
| RETVAL |
| 1074 |
|
| |
| 1075 |
|
| IV |
| 1076 |
|
| incr(self, slot) |
| 1077 |
|
| SV *self |
| 1078 |
|
| UV slot |
| 1079 |
|
| PREINIT: |
| 1080 |
0 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
0 |
0 |
0 |
| EXTRACT_POOL(self); |
0 |
0 |
0 |
| EXTRACT_POOL(self); |
0 |
0 |
0 |
|
| 1081 |
|
| CODE: |
| 1082 |
0 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
0 |
0 |
|
| 1083 |
0 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
0 |
0 |
|
| 1084 |
0 |
▶ | RETVAL = (IV)pool_add_i32(h, slot, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (IV)pool_add_i32(h, slot, 1); |
0 |
0 |
0 |
|
| 1085 |
|
| OUTPUT: |
| 1086 |
|
| RETVAL |
| 1087 |
|
| |
| 1088 |
|
| IV |
| 1089 |
|
| decr(self, slot) |
| 1090 |
|
| SV *self |
| 1091 |
|
| UV slot |
| 1092 |
|
| PREINIT: |
| 1093 |
0 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
0 |
0 |
0 |
| EXTRACT_POOL(self); |
0 |
0 |
0 |
| EXTRACT_POOL(self); |
0 |
0 |
0 |
|
| 1094 |
|
| CODE: |
| 1095 |
0 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
0 |
0 |
|
| 1096 |
0 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
0 |
0 |
|
| 1097 |
0 |
▶ | RETVAL = (IV)pool_add_i32(h, slot, -1); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (IV)pool_add_i32(h, slot, -1); |
0 |
0 |
0 |
|
| 1098 |
|
| OUTPUT: |
| 1099 |
|
| RETVAL |
| 1100 |
|
| |
| 1101 |
|
| |
| 1102 |
|
| MODULE = Data::Pool::Shared PACKAGE = Data::Pool::Shared::Str |
| 1103 |
|
| |
| 1104 |
|
| PROTOTYPES: DISABLE |
| 1105 |
|
| |
| 1106 |
|
| SV * |
| 1107 |
|
| new(class, path, capacity, max_len, ...) |
| 1108 |
|
| const char *class |
| 1109 |
|
| SV *path |
| 1110 |
|
| UV capacity |
| 1111 |
|
| UV max_len |
| 1112 |
|
| PREINIT: |
| 1113 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 1114 |
|
| CODE: |
| 1115 |
6 |
▶ | mode_t mode = (items > 4 && (SvGETMAGIC(ST(4)), SvOK(ST(4)))) ? (mode_t)SvUV(ST(4)) : 0600; |
Branch: 4 branches
| Branch | True | False | Total |
| mode_t mode = (items > 4 && (SvGETMAGIC(ST(4)), SvOK(ST(4)))) ? (mode_t)SvUV(ST(4)) : 0600; |
0 |
6 |
6 |
| mode_t mode = (items > 4 && (SvGETMAGIC(ST(4)), SvOK(ST(4)))) ? (mode_t)SvUV(ST(4)) : 0600; |
0 |
0 |
0 |
| mode_t mode = (items > 4 && (SvGETMAGIC(ST(4)), SvOK(ST(4)))) ? (mode_t)SvUV(ST(4)) : 0600; |
0 |
0 |
0 |
| mode_t mode = (items > 4 && (SvGETMAGIC(ST(4)), SvOK(ST(4)))) ? (mode_t)SvUV(ST(4)) : 0600; |
0 |
0 |
0 |
|
| 1116 |
6 |
▶ | if (max_len == 0) croak("Data::Pool::Shared::Str->new: max_len must be > 0"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (max_len == 0) croak("Data::Pool::Shared::Str->new: max_len must be > 0"); |
0 |
6 |
6 |
|
| 1117 |
6 |
▶ | if (max_len > (UV)(UINT32_MAX - sizeof(uint32_t))) |
Branch: 1 branch
| Branch | True | False | Total |
| if (max_len > (UV)(UINT32_MAX - sizeof(uint32_t))) |
0 |
6 |
6 |
|
| 1118 |
0 |
| croak("Data::Pool::Shared::Str->new: max_len too large"); |
| 1119 |
6 |
| uint32_t elem_size = (uint32_t)(sizeof(uint32_t) + max_len); |
| 1120 |
8 |
▶ | const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
Branch: 3 branches
| Branch | True | False | Total |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
0 |
6 |
6 |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
0 |
0 |
0 |
| const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL; |
2 |
4 |
6 |
|
| 1121 |
6 |
| PoolHandle *h = pool_create(p, capacity, elem_size, POOL_VAR_STR, mode, errbuf); |
| 1122 |
6 |
▶ | if (!h) croak("Data::Pool::Shared::Str->new: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared::Str->new: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
6 |
6 |
| if (!h) croak("Data::Pool::Shared::Str->new: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
0 |
0 |
|
| 1123 |
6 |
| MAKE_OBJ(class, h); |
| 1124 |
|
| OUTPUT: |
| 1125 |
|
| RETVAL |
| 1126 |
|
| |
| 1127 |
|
| SV * |
| 1128 |
|
| new_memfd(class, name, capacity, max_len) |
| 1129 |
|
| const char *class |
| 1130 |
|
| const char *name |
| 1131 |
|
| UV capacity |
| 1132 |
|
| UV max_len |
| 1133 |
|
| PREINIT: |
| 1134 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 1135 |
|
| CODE: |
| 1136 |
1 |
▶ | if (max_len == 0) croak("Data::Pool::Shared::Str->new_memfd: max_len must be > 0"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (max_len == 0) croak("Data::Pool::Shared::Str->new_memfd: max_len must be > 0"); |
0 |
1 |
1 |
|
| 1137 |
1 |
▶ | if (max_len > (UV)(UINT32_MAX - sizeof(uint32_t))) |
Branch: 1 branch
| Branch | True | False | Total |
| if (max_len > (UV)(UINT32_MAX - sizeof(uint32_t))) |
0 |
1 |
1 |
|
| 1138 |
0 |
| croak("Data::Pool::Shared::Str->new_memfd: max_len too large"); |
| 1139 |
1 |
| uint32_t elem_size = (uint32_t)(sizeof(uint32_t) + max_len); |
| 1140 |
1 |
| PoolHandle *h = pool_create_memfd(name, capacity, elem_size, POOL_VAR_STR, errbuf); |
| 1141 |
1 |
▶ | if (!h) croak("Data::Pool::Shared::Str->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared::Str->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
1 |
1 |
| if (!h) croak("Data::Pool::Shared::Str->new_memfd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
0 |
0 |
|
| 1142 |
1 |
| MAKE_OBJ(class, h); |
| 1143 |
|
| OUTPUT: |
| 1144 |
|
| RETVAL |
| 1145 |
|
| |
| 1146 |
|
| SV * |
| 1147 |
|
| new_from_fd(class, fd) |
| 1148 |
|
| const char *class |
| 1149 |
|
| int fd |
| 1150 |
|
| PREINIT: |
| 1151 |
|
| char errbuf[POOL_ERR_BUFLEN]; |
| 1152 |
|
| CODE: |
| 1153 |
1 |
| PoolHandle *h = pool_open_fd(fd, POOL_VAR_STR, errbuf); |
| 1154 |
1 |
▶ | if (!h) croak("Data::Pool::Shared::Str->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (!h) croak("Data::Pool::Shared::Str->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
1 |
1 |
| if (!h) croak("Data::Pool::Shared::Str->new_from_fd: %s", errbuf[0] ? errbuf : "out of memory"); |
0 |
0 |
0 |
|
| 1155 |
1 |
| MAKE_OBJ(class, h); |
| 1156 |
|
| OUTPUT: |
| 1157 |
|
| RETVAL |
| 1158 |
|
| |
| 1159 |
|
| SV * |
| 1160 |
|
| get(self, slot) |
| 1161 |
|
| SV *self |
| 1162 |
|
| UV slot |
| 1163 |
|
| PREINIT: |
| 1164 |
11 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
11 |
0 |
11 |
| EXTRACT_POOL(self); |
0 |
11 |
11 |
| EXTRACT_POOL(self); |
0 |
11 |
11 |
|
| 1165 |
|
| CODE: |
| 1166 |
11 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
11 |
11 |
|
| 1167 |
11 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
11 |
11 |
|
| 1168 |
11 |
| uint32_t len = pool_get_str_len(h, slot); |
| 1169 |
11 |
| RETVAL = newSVpvn(pool_get_str_ptr(h, slot), len); |
| 1170 |
|
| OUTPUT: |
| 1171 |
|
| RETVAL |
| 1172 |
|
| |
| 1173 |
|
| void |
| 1174 |
|
| set(self, slot, val) |
| 1175 |
|
| SV *self |
| 1176 |
|
| UV slot |
| 1177 |
|
| SV *val |
| 1178 |
|
| PREINIT: |
| 1179 |
8 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
8 |
0 |
8 |
| EXTRACT_POOL(self); |
0 |
8 |
8 |
| EXTRACT_POOL(self); |
0 |
8 |
8 |
|
| 1180 |
|
| CODE: |
| 1181 |
8 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
8 |
8 |
|
| 1182 |
8 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
8 |
8 |
|
| 1183 |
|
| STRLEN len; |
| 1184 |
8 |
| const char *str = SvPV(val, len); |
| 1185 |
|
| /* SvPV on a bare SV arg runs overload/tie magic = arbitrary Perl, which can |
| 1186 |
|
| * have destroyed self before h is used below. (CHECK_SLOT/CHECK_ALLOCATED |
| 1187 |
|
| * above ran on the pre-magic handle; re-validate against the current one.) */ |
| 1188 |
8 |
▶ | REEXTRACT_POOL(self); |
Branch: 2 branches
| Branch | True | False | Total |
| REEXTRACT_POOL(self); |
0 |
8 |
8 |
| REEXTRACT_POOL(self); |
0 |
8 |
8 |
|
| 1189 |
8 |
▶ | CHECK_SLOT(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_SLOT(h, slot); |
0 |
8 |
8 |
|
| 1190 |
8 |
▶ | CHECK_ALLOCATED(h, slot); |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_ALLOCATED(h, slot); |
0 |
8 |
8 |
|
| 1191 |
8 |
| pool_set_str(h, slot, str, (uint32_t)len); |
| 1192 |
|
| |
| 1193 |
|
| UV |
| 1194 |
|
| max_len(self) |
| 1195 |
|
| SV *self |
| 1196 |
|
| PREINIT: |
| 1197 |
1 |
▶ | EXTRACT_POOL(self); |
Branch: 3 branches
| Branch | True | False | Total |
| EXTRACT_POOL(self); |
1 |
0 |
1 |
| EXTRACT_POOL(self); |
0 |
1 |
1 |
| EXTRACT_POOL(self); |
0 |
1 |
1 |
|
| 1198 |
|
| CODE: |
| 1199 |
1 |
▶ | RETVAL = h->hdr->elem_size > sizeof(uint32_t) ? h->hdr->elem_size - sizeof(uint32_t) : 0; |
Branch: 2 branches
| Branch | True | False | Total |
| RETVAL = h->hdr->elem_size > sizeof(uint32_t) ? h->hdr->elem_size - sizeof(uint32_t) : 0; |
1 |
0 |
1 |
| RETVAL = h->hdr->elem_size > sizeof(uint32_t) ? h->hdr->elem_size - sizeof(uint32_t) : 0; |
0 |
1 |
1 |
|
| 1200 |
|
| OUTPUT: |
| 1201 |
|
| RETVAL |