C.xs

filter: Statementstmt 68.7% 121 / 176 Branchbran 43.4% 53 / 122 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 58.3% 174 / 298 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« blib/lib/ByteLoader.pm ↑ Summary ccode59i.pl »
1 #define PERL_NO_GET_CONTEXT
2 #include <EXTERN.h>
3 #include <perl.h>
4 #include <XSUB.h>
5  
6 #ifdef __cplusplus
7 /* Static OP* initialization 2x */
8 # error B-C cannot yet be compiled with C++
9 #endif
10  
11 #ifndef PM_GETRE
12 # if defined(USE_ITHREADS) && (PERL_VERSION > 8)
13 # define PM_GETRE(o) (INT2PTR(REGEXP*,SvIVX(PL_regex_pad[(o)->op_pmoffset])))
14 # else
15 # define PM_GETRE(o) ((o)->op_pmregexp)
16 # endif
17 #endif
18 /* for < 5.10 */
19 #if defined(DEBUGGING) && !defined(RX_WRAPPED)
20 # define RX_WRAPPED(rx) ((rx)->subbeg)
21 #endif
22 /* hack for 5.6.2: just want to know if PMf_ONCE or 0 */
23 #ifndef PmopSTASHPV
24 # define PmopSTASHPV(o) ((o)->op_pmflags & PMf_ONCE)
25 #endif
26 #ifndef RX_EXTFLAGS
27 # define RX_EXTFLAGS(prog) ((prog)->extflags)
28 #endif
29 /* added with v5.21.11/v5.22.1c, removed with v5.29.8/v5.29.2c */
30 #ifndef _OP_SIBPARENT_FIELDNAME
31 # ifdef PERL_OP_PARENT
32 # define _OP_SIBPARENT_FIELDNAME op_sibparent
33 # else
34 # define _OP_SIBPARENT_FIELDNAME op_sibling
35 # endif
36 #endif
37  
38 #if PERL_VERSION < 10
39 #undef MY_CXT_INIT
40 #define MY_CXT_INIT
41 #endif
42  
43 #if PERL_VERSION > 17 && (PERL_VERSION < 19 || (PERL_VERSION == 19 && PERL_SUBVERSION < 4))
44 #define need_op_slabbed
45 #endif
46 #if PERL_VERSION == 19 && (PERL_SUBVERSION > 2 && PERL_SUBVERSION <= 4)
47 #define need_op_folded
48 #endif
49 #if !defined(USE_ITHREADS) || (PERL_VERSION >= 10 && PERL_VERSION < 20)
50 #define need_make_sv_object
51 #endif
52 #if PERL_VERSION >= 10 && PERL_VERSION < 20
53 #define need_HvARRAY_utf8
54 #endif
55 #if (PERL_VERSION >= 15) && defined(USE_ITHREADS) && defined(CopSTASH_flags)
56 #define need_COP_stashflags
57 #endif
58  
59 typedef struct magic *B__MAGIC;
60 #if PERL_VERSION > 17
61 typedef PADNAME *B__PADNAME;
62 #endif
63 #if PERL_VERSION > 21
64 typedef PADLIST *B__PADLIST;
65 typedef PADNAMELIST *B__PADNAMELIST;
66 #endif
67 #if PERL_VERSION >= 11
68 typedef struct p5rx *B__REGEXP;
69 #endif
70 typedef COP *B__COP;
71 typedef OP *B__OP;
72 typedef HV *B__HV;
73  
74 STATIC U32 a_hash = 0;
75  
76 typedef struct {
77 U32 bits;
78 IV require_tag;
79 } a_hint_t;
80  
81 #if PERL_VERSION >= 10
82  
83 #ifdef need_make_sv_object
84 static const char* const svclassnames[] = {
85 "B::NULL",
86 #if PERL_VERSION < 19
87 "B::BIND",
88 #endif
89 "B::IV",
90 "B::NV",
91 #if PERL_VERSION <= 10
92 "B::RV",
93 #endif
94 "B::PV",
95 #if PERL_VERSION >= 19
96 "B::INVLIST",
97 #endif
98 "B::PVIV",
99 "B::PVNV",
100 "B::PVMG",
101 #if PERL_VERSION >= 11
102 "B::REGEXP",
103 #endif
104 "B::GV",
105 "B::PVLV",
106 "B::AV",
107 "B::HV",
108 "B::CV",
109 "B::FM",
110 "B::IO",
111 };
112 #endif
113  
114 #define MY_CXT_KEY "B::C::_guts" XS_VERSION
115  
116 typedef struct {
117 int x_walkoptree_debug; /* Flag for walkoptree debug hook */
118 SV * x_specialsv_list[7];
119 } my_cxt_t;
120  
121 START_MY_CXT
122  
123 #define walkoptree_debug (MY_CXT.x_walkoptree_debug)
124 #define specialsv_list (MY_CXT.x_specialsv_list)
125  
126 #ifdef need_make_sv_object
127  
128 static SV *
129 52845 make_sv_object(pTHX_ SV *sv)
130 {
131 52845 SV *const arg = sv_newmortal();
132 52845 const char *type = 0;
133 IV iv;
134 dMY_CXT;
135  
136 422760 ▶ for (iv = 0; iv < (IV)(sizeof(specialsv_list)/sizeof(SV*)); iv++) {
Branch: 1 branch
BranchTrueFalseTotal
for (iv = 0; iv < (IV)(sizeof(specialsv_list)/sizeof(SV*)); iv++) { 369915 52845 422760
137 369915 ▶ if (sv == specialsv_list[iv]) {
Branch: 1 branch
BranchTrueFalseTotal
if (sv == specialsv_list[iv]) { 0 369915 369915
138 0 type = "B::SPECIAL";
139 0 break;
140 }
141 }
142 52845 ▶ if (!type) {
Branch: 1 branch
BranchTrueFalseTotal
if (!type) { 52845 0 52845
143 52845 type = svclassnames[SvTYPE(sv)];
144 52845 iv = PTR2IV(sv);
145 }
146 52845 sv_setiv(newSVrv(arg, type), iv);
147 52845 return arg;
148 }
149  
150 #endif
151 #endif
152  
153 static int
154 156809 my_runops(pTHX)
155 {
156 156809 HV* regexp_hv = get_hv( "B::C::Regexp", GV_ADD );
157 156809 SV* key = newSViv( 0 );
158 int type;
159  
160 DEBUG_l(Perl_deb(aTHX_ "Entering new RUNOPS level (B::C)\n"));
161 do {
162 #if (PERL_VERSION < 13) || ((PERL_VERSION == 13) && (PERL_SUBVERSION < 2))
163 PERL_ASYNC_CHECK();
164 #endif
165  
166 25980343 ▶ if (PL_debug) {
Branch: 1 branch
BranchTrueFalseTotal
if (PL_debug) { 0 25980343 25980343
167 0 ▶ if (PL_watchaddr && (*PL_watchaddr != PL_watchok))
Branch: 2 branches
BranchTrueFalseTotal
if (PL_watchaddr && (*PL_watchaddr != PL_watchok)) 0 0 0
if (PL_watchaddr && (*PL_watchaddr != PL_watchok)) 0 0 0
168 0 PerlIO_printf(Perl_debug_log,
169 "WARNING: %" UVxf " changed from %" UVxf " to %" UVxf "\n",
170 PTR2UV(PL_watchaddr), PTR2UV(PL_watchok),
171 0 PTR2UV(*PL_watchaddr));
172 #if defined(DEBUGGING) \
173 && !(defined(_WIN32) || (defined(__CYGWIN__) && (__GNUC__ > 3)) || defined(AIX))
174 # if (PERL_VERSION > 7)
175 if (DEBUG_s_TEST_) debstack();
176 if (DEBUG_t_TEST_) debop(PL_op);
177 # else
178 DEBUG_s(debstack());
179 DEBUG_t(debop(PL_op));
180 # endif
181 #endif
182 }
183  
184 /* Need to store the rx all for QR PMOPs in a global %Regexp hash. MATCH once also */
185 25980343 type = PL_op->op_type;
186 #if 1
187 25980343 ▶ if (type == OP_QR
Branch: 1 branch
BranchTrueFalseTotal
if (type == OP_QR 25973508 6835 25980343
188 25973508 ▶ || (type == OP_MATCH
Branch: 1 branch
BranchTrueFalseTotal
|| (type == OP_MATCH 164203 25809305 25973508
189 # if PERL_VERSION < 20
190 && (((PMOP*)PL_op)->op_pmflags & PMf_ONCE)
191 # else
192 164203 ▶ && PmopSTASH((PMOP*)PL_op)
Branch: 2 branches
BranchTrueFalseTotal
&& PmopSTASH((PMOP*)PL_op) 0 164203 164203
&& PmopSTASH((PMOP*)PL_op) 0 0 0
193 # endif
194 ))
195 #else
196 if ((type == OP_QR)
197 || (type == OP_MATCH)
198 || (type == OP_PUSHRE)
199 || (type == OP_SUBST))
200 #endif
201 {
202 PMOP* op;
203 6835 REGEXP* rx = PM_GETRE( (PMOP*)PL_op );
204 6835 SV* rv = newSViv( 0 );
205  
206 6835 New(0, op, 1, PMOP );
207 6835 Copy( PL_op, op, 1, PMOP );
208 /* we need just the flags */
209 6835 op->op_next = NULL;
210 6835 op->_OP_SIBPARENT_FIELDNAME = NULL;
211 6835 op->op_first = NULL;
212 6835 op->op_last = NULL;
213  
214 #if PERL_VERSION < 10
215 op->op_pmreplroot = NULL;
216 op->op_pmreplstart = NULL;
217 op->op_pmnext = NULL;
218 #endif
219 #if defined(USE_ITHREADS) && (PERL_VERSION > 7)
220 op->op_pmoffset = 0;
221 #else
222 6835 op->op_pmregexp = 0;
223 #endif
224  
225 6835 sv_setiv( key, PTR2IV( rx ) );
226 6835 sv_setref_iv( rv, "B::PMOP", PTR2IV( op ) );
227 #if defined(DEBUGGING) && (PERL_VERSION > 7)
228 if (DEBUG_D_TEST_) fprintf(stderr, "pmop %p => rx %s %p 0x%x %s\n",
229 op, PL_op_name[type], rx, (unsigned)op->op_pmflags,
230 RX_WRAPPED(rx));
231 #endif
232 6835 hv_store_ent( regexp_hv, key, rv, 0 );
233 }
234 25980343 ▶ } while ((PL_op = CALL_FPTR(PL_op->op_ppaddr)(aTHX)));
Branch: 1 branch
BranchTrueFalseTotal
} while ((PL_op = CALL_FPTR(PL_op->op_ppaddr)(aTHX))); 25823534 155882 25979416
235  
236 155882 SvREFCNT_dec( key );
237  
238 155882 TAINT_NOT;
239 155882 return 0;
240 }
241  
242 MODULE = B__MAGIC PACKAGE = B::MAGIC
243  
244 #if PERL_VERSION < 7
245  
246 SV*
247 precomp(mg)
248 B::MAGIC mg
249 CODE:
250 if (mg->mg_type == 'r') {
251 REGEXP* rx = (REGEXP*)mg->mg_obj;
252 RETVAL = Nullsv;
253 if (rx)
254 RETVAL = newSVpvn( rx->precomp, rx->prelen );
255 }
256 else {
257 croak( "precomp is only meaningful on r-magic" );
258 }
259 OUTPUT:
260 RETVAL
261  
262 #endif
263  
264 MODULE = B PACKAGE = B::PMOP
265  
266 #if defined(RX_UTF8) && PERL_VERSION < 20
267  
268 SV*
269 precomp(o)
270 B::OP o
271 PPCODE:
272 {
273 if (SvROK(ST(0))) {
274 IV tmp = SvIV((SV*)SvRV(ST(0)));
275 o = INT2PTR(B__OP,tmp);
276 }
277 else
278 croak("precomp(o) argument is not a reference");
279 if (o) {
280 REGEXP *rx = PM_GETRE(cPMOPo);
281 if (!rx)
282 XSRETURN_UNDEF;
283 ST(0) = sv_2mortal(newSVpvn_flags(RX_PRECOMP(rx), RX_PRELEN(rx), RX_UTF8(rx) ? SVf_UTF8 : 0));
284 XSRETURN(1);
285 } else {
286 XSRETURN_UNDEF;
287 }
288 }
289  
290 #endif
291  
292 MODULE = B PACKAGE = B::HV
293  
294 IV
295 Gv_AMG(stash)
296 B::HV stash
297 CODE:
298 7359 ▶ RETVAL = (!SvREADONLY(stash) && Gv_AMG(stash)) ? 1 : 0;
Branch: 10 branches
BranchTrueFalseTotal
RETVAL = (!SvREADONLY(stash) && Gv_AMG(stash)) ? 1 : 0; 7359 0 7359
RETVAL = (!SvREADONLY(stash) && Gv_AMG(stash)) ? 1 : 0; 7359 0 7359
RETVAL = (!SvREADONLY(stash) && Gv_AMG(stash)) ? 1 : 0; 7359 0 7359
RETVAL = (!SvREADONLY(stash) && Gv_AMG(stash)) ? 1 : 0; 0 7359 7359
RETVAL = (!SvREADONLY(stash) && Gv_AMG(stash)) ? 1 : 0; 0 0 0
RETVAL = (!SvREADONLY(stash) && Gv_AMG(stash)) ? 1 : 0; 7359 0 7359
RETVAL = (!SvREADONLY(stash) && Gv_AMG(stash)) ? 1 : 0; 0 7359 7359
RETVAL = (!SvREADONLY(stash) && Gv_AMG(stash)) ? 1 : 0; 7359 0 7359
RETVAL = (!SvREADONLY(stash) && Gv_AMG(stash)) ? 1 : 0; 7101 258 7359
RETVAL = (!SvREADONLY(stash) && Gv_AMG(stash)) ? 1 : 0; 6817 542 7359
299 OUTPUT:
300 RETVAL
301  
302 #if PERL_VERSION > 13
303  
304 # returns a single or multiple ENAME(s), since 5.14
305 void
306 ENAMES(hv)
307 B::HV hv
308 PPCODE:
309 7864 ▶ if (SvOOK(hv)) {
Branch: 4 branches
BranchTrueFalseTotal
if (SvOOK(hv)) { 7864 0 7864
if (SvOOK(hv)) { 0 7864 7864
if (SvOOK(hv)) { 0 0 0
if (SvOOK(hv)) { 7864 0 7864
310 7864 ▶ if (HvENAME_HEK(hv)) {
Branch: 7 branches
BranchTrueFalseTotal
if (HvENAME_HEK(hv)) { 7864 0 7864
if (HvENAME_HEK(hv)) { 7864 0 7864
if (HvENAME_HEK(hv)) { 0 7864 7864
if (HvENAME_HEK(hv)) { 0 7864 7864
if (HvENAME_HEK(hv)) { 7864 0 7864
if (HvENAME_HEK(hv)) { 7864 0 7864
if (HvENAME_HEK(hv)) { 7864 0 7864
311 7864 I32 i = 0;
312 7864 const I32 count = HvAUX(hv)->xhv_name_count;
313 7864 ▶ if (count) {
Branch: 1 branch
BranchTrueFalseTotal
if (count) { 0 7864 7864
314 0 HEK** names = HvAUX(hv)->xhv_name_u.xhvnameu_names;
315 0 HEK *const *hekp = names + (count < 0 ? 1 : 0);
316 0 ▶ HEK *const *const endp = names + (count < 0 ? -count : count);
Branch: 1 branch
BranchTrueFalseTotal
HEK *const *const endp = names + (count < 0 ? -count : count); 0 0 0
317 0 ▶ while (hekp < endp) {
Branch: 1 branch
BranchTrueFalseTotal
while (hekp < endp) { 0 0 0
318 assert(*hekp);
319 0 ▶ PUSHs(newSVpvn_flags(HEK_KEY(*hekp), HEK_LEN(*hekp),
Branch: 1 branch
BranchTrueFalseTotal
PUSHs(newSVpvn_flags(HEK_KEY(*hekp), HEK_LEN(*hekp), 0 0 0
320 HEK_UTF8(*hekp) ? SVf_UTF8|SVs_TEMP : SVs_TEMP));
321 0 ++hekp;
322 0 i++;
323 }
324 0 XSRETURN(i);
325 }
326 else {
327 7864 ▶ HEK *const hek = HvENAME_HEK_NN(hv);
Branch: 3 branches
BranchTrueFalseTotal
HEK *const hek = HvENAME_HEK_NN(hv); 0 7864 7864
HEK *const hek = HvENAME_HEK_NN(hv); 0 7864 7864
HEK *const hek = HvENAME_HEK_NN(hv); 7864 0 7864
328 7864 ▶ ST(0) = newSVpvn_flags(HEK_KEY(hek), HEK_LEN(hek),
Branch: 1 branch
BranchTrueFalseTotal
ST(0) = newSVpvn_flags(HEK_KEY(hek), HEK_LEN(hek), 3 7861 7864
329 HEK_UTF8(hek) ? SVf_UTF8|SVs_TEMP : SVs_TEMP);
330 7864 XSRETURN(1);
331 }
332 }
333 }
334 0 XSRETURN_UNDEF;
335  
336 I32
337 name_count(hv)
338 B::HV hv
339 PPCODE:
340 PERL_UNUSED_VAR(RETVAL);
341 PERL_UNUSED_VAR(TARG);
342 0 ▶ if (SvOOK(hv))
Branch: 4 branches
BranchTrueFalseTotal
if (SvOOK(hv)) 0 0 0
if (SvOOK(hv)) 0 0 0
if (SvOOK(hv)) 0 0 0
if (SvOOK(hv)) 0 0 0
343 0 mPUSHi(HvAUX(hv)->xhv_name_count);
344 else
345 0 mPUSHi(0);
346 0 XSRETURN(1);
347  
348 #endif
349  
350 MODULE = B PACKAGE = B::UNOP_AUX
351  
352 #if PERL_VERSION > 21
353  
354 SV*
355 aux(o)
356 B::OP o
357 CODE:
358 {
359 2 UNOP_AUX_item *items = cUNOP_AUXo->op_aux;
360 2 UV len = items[-1].uv;
361 2 RETVAL = newSVpvn_flags((char*)&items[-1], (1+len) * sizeof(UNOP_AUX_item), 0);
362 }
363 OUTPUT:
364 RETVAL
365  
366 # Needed only for the ill-designed perl5 signatures: argelem
367 SV*
368 aux_ptr2iv(o)
369 B::OP o
370 CODE:
371 0 RETVAL = newSViv(PTR2IV(cUNOP_AUXo->op_aux));
372 OUTPUT:
373 RETVAL
374  
375 # Return the contents of the op_aux array as a list of IV/SV/GV/PADOFFSET objects.
376 # This version here returns the padoffset of SV/GV under ithreads, and not the
377 # SV/GV itself. It also uses simplified mPUSH macros.
378 # With MCONCAT contrary to B::aux_list always return both slots, binary and utf8.
379 # The design of the upstream aux_list method deviates significantly from proper B design.
380  
381 void
382 aux_list_thr(o)
383 B::OP o
384 PPCODE:
385 PERL_UNUSED_VAR(cv); /* not needed on unthreaded builds */
386 53647 switch (o->op_type) {
387 0 default:
388 0 XSRETURN(0); /* by default, an empty list */
389  
390 53647 case OP_MULTIDEREF:
391 #ifdef USE_ITHREADS
392 # define PUSH_SV(item) mPUSHu((item)->pad_offset)
393 #else
394 # define PUSH_SV(item) PUSHs(make_sv_object(aTHX_ (item)->sv))
395 #endif
396 {
397 53647 UNOP_AUX_item *items = cUNOP_AUXo->op_aux;
398 53647 UV actions = items->uv;
399 53647 UV len = items[-1].uv;
400 53647 bool last = 0;
401 53647 bool is_hash = FALSE;
402  
403 assert(len <= SSize_t_MAX);
404 53647 ▶ EXTEND(SP, (SSize_t)len);
Branch: 2 branches
BranchTrueFalseTotal
EXTEND(SP, (SSize_t)len); 53647 0 53647
EXTEND(SP, (SSize_t)len); 0 53647 53647
405 53647 mPUSHu(actions);
406  
407 107796 ▶ while (!last) {
Branch: 1 branch
BranchTrueFalseTotal
while (!last) { 54149 53647 107796
408 54149 switch (actions & MDEREF_ACTION_MASK) {
409  
410 0 case MDEREF_reload:
411 0 actions = (++items)->uv;
412 0 mPUSHu(actions);
413 0 continue;
414 NOT_REACHED; /* NOTREACHED */
415  
416 13912 case MDEREF_HV_padhv_helem:
417 13912 is_hash = TRUE;
418 /* FALLTHROUGH */
419 15383 case MDEREF_AV_padav_aelem:
420 15383 mPUSHu((++items)->pad_offset);
421 15383 goto do_elem;
422 NOT_REACHED; /* NOTREACHED */
423  
424 23404 case MDEREF_HV_gvhv_helem:
425 23404 is_hash = TRUE;
426 /* FALLTHROUGH */
427 25211 case MDEREF_AV_gvav_aelem:
428 25211 PUSH_SV(++items);
429 25211 goto do_elem;
430 NOT_REACHED; /* NOTREACHED */
431  
432 1042 case MDEREF_HV_gvsv_vivify_rv2hv_helem:
433 1042 is_hash = TRUE;
434 /* FALLTHROUGH */
435 1042 case MDEREF_AV_gvsv_vivify_rv2av_aelem:
436 1042 PUSH_SV(++items);
437 1042 goto do_vivify_rv2xv_elem;
438 NOT_REACHED; /* NOTREACHED */
439  
440 7318 case MDEREF_HV_padsv_vivify_rv2hv_helem:
441 7318 is_hash = TRUE;
442 /* FALLTHROUGH */
443 10522 case MDEREF_AV_padsv_vivify_rv2av_aelem:
444 10522 mPUSHu((++items)->pad_offset);
445 10522 goto do_vivify_rv2xv_elem;
446 NOT_REACHED; /* NOTREACHED */
447  
448 1007 case MDEREF_HV_pop_rv2hv_helem:
449 case MDEREF_HV_vivify_rv2hv_helem:
450 1007 is_hash = TRUE;
451 /* FALLTHROUGH */
452 12571 do_vivify_rv2xv_elem:
453 case MDEREF_AV_pop_rv2av_aelem:
454 case MDEREF_AV_vivify_rv2av_aelem:
455 54149 do_elem:
456 54149 switch (actions & MDEREF_INDEX_MASK) {
457 252 case MDEREF_INDEX_none:
458 252 last = 1;
459 252 break;
460 28112 case MDEREF_INDEX_const:
461 28112 ▶ if (is_hash)
Branch: 1 branch
BranchTrueFalseTotal
if (is_hash) 23359 4753 28112
462 23359 PUSH_SV(++items);
463 else
464 4753 mPUSHi((++items)->iv);
465 28112 break;
466 22552 case MDEREF_INDEX_padsv:
467 22552 mPUSHu((++items)->pad_offset);
468 22552 break;
469 3233 case MDEREF_INDEX_gvsv:
470 3233 PUSH_SV(++items);
471 3233 break;
472 }
473 54149 ▶ if (actions & MDEREF_FLAG_last)
Branch: 1 branch
BranchTrueFalseTotal
if (actions & MDEREF_FLAG_last) 53647 502 54149
474 53647 last = 1;
475 54149 is_hash = FALSE;
476  
477 54149 break;
478 } /* switch */
479  
480 54149 actions >>= MDEREF_SHIFT;
481 } /* while */
482 53647 XSRETURN(len);
483 } /* OP_MULTIDEREF */
484 #if PERL_VERSION > 23 && defined(OP_SIGNATURE)
485 case OP_SIGNATURE:
486 {
487 UNOP_AUX_item *items = cUNOP_AUXo->op_aux;
488 UV len = items[-1].uv;
489 UV actions = items[1].uv;
490  
491 assert(len <= SSize_t_MAX);
492 EXTEND(SP, (SSize_t)len);
493 mPUSHu(items[0].uv);
494 mPUSHu(actions);
495 items++;
496  
497 while (1) {
498 switch (actions & SIGNATURE_ACTION_MASK) {
499  
500 case SIGNATURE_reload:
501 actions = (++items)->uv;
502 mPUSHu(actions);
503 continue;
504  
505 case SIGNATURE_end:
506 goto finish;
507  
508 case SIGNATURE_padintro:
509 mPUSHu((++items)->uv);
510 break;
511  
512 case SIGNATURE_arg:
513 case SIGNATURE_arg_default_none:
514 case SIGNATURE_arg_default_undef:
515 case SIGNATURE_arg_default_0:
516 case SIGNATURE_arg_default_1:
517 case SIGNATURE_arg_default_op:
518 case SIGNATURE_array:
519 case SIGNATURE_hash:
520 break;
521  
522 case SIGNATURE_arg_default_iv:
523 mPUSHu((++items)->iv);
524 break;
525  
526 case SIGNATURE_arg_default_const:
527 PUSH_SV(++items);
528 break;
529  
530 case SIGNATURE_arg_default_padsv:
531 mPUSHu((++items)->pad_offset);
532 break;
533  
534 case SIGNATURE_arg_default_gvsv:
535 PUSH_SV(++items);
536 break;
537  
538 } /* switch */
539  
540 actions >>= SIGNATURE_SHIFT;
541 } /* while */
542 finish:
543 XSRETURN(len);
544 } /* OP_SIGNATURE */
545 #endif
546 #if PERL_VERSION >= 27
547 0 case OP_MULTICONCAT:
548 {
549 0 UNOP_AUX_item *aux = cUNOP_AUXo->op_aux;
550 UNOP_AUX_item *lens;
551 char *p;
552 STRLEN len;
553 0 SSize_t nargs = aux[PERL_MULTICONCAT_IX_NARGS].ssize;
554  
555 /* return (nargs, const string, segment len 0, 1, 2, ...) */
556  
557 /* if this changes, this block of code probably needs fixing */
558 assert(PERL_MULTICONCAT_HEADER_SIZE == 5);
559 0 ▶ EXTEND(SP, ((SSize_t)(2 + (nargs+1))));
Branch: 2 branches
BranchTrueFalseTotal
EXTEND(SP, ((SSize_t)(2 + (nargs+1)))); 0 0 0
EXTEND(SP, ((SSize_t)(2 + (nargs+1)))); 0 0 0
560 0 mPUSHi((IV)nargs);
561  
562 0 p = aux[PERL_MULTICONCAT_IX_PLAIN_PV].pv;
563 0 len = aux[PERL_MULTICONCAT_IX_PLAIN_LEN].ssize;
564 /* Contrary to B always return both slots, PLAIN and UTF8 */
565 0 ▶ if (p) {
Branch: 1 branch
BranchTrueFalseTotal
if (p) { 0 0 0
566 0 mPUSHp(p, len);
567 } else {
568 0 PUSHs(&PL_sv_undef);
569 }
570  
571 0 p = aux[PERL_MULTICONCAT_IX_UTF8_PV].pv;
572 0 len = aux[PERL_MULTICONCAT_IX_UTF8_LEN].ssize;
573 0 ▶ if (p) {
Branch: 1 branch
BranchTrueFalseTotal
if (p) { 0 0 0
574 0 PUSHs(newSVpvn_flags(p, len, SVf_UTF8|SVs_TEMP));
575 } else {
576 0 PUSHs(&PL_sv_undef);
577 }
578  
579 0 lens = aux + PERL_MULTICONCAT_IX_LENGTHS;
580 0 nargs++; /* loop (nargs+1) times */
581 0 ▶ while (nargs--) {
Branch: 1 branch
BranchTrueFalseTotal
while (nargs--) { 0 0 0
582 0 mPUSHi(lens->ssize);
583 0 lens++;
584 }
585 0 break;
586 }
587 #endif
588 } /* switch */
589 0 XSRETURN(0); /* force removal of PUTBACK, return */
590  
591 #endif
592  
593 #if PERL_VERSION > 21
594  
595 MODULE = B PACKAGE = B::PADNAME PREFIX = Padname
596  
597 int
598 PadnameGEN(padn)
599 B::PADNAME padn
600 CODE:
601 154084 ▶ RETVAL = padn->xpadn_gen;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = padn->xpadn_gen; 153561 523 154084
602 OUTPUT:
603 RETVAL
604  
605 MODULE = B PACKAGE = B::PADNAMELIST PREFIX = Padnamelist
606  
607 size_t
608 PadnamelistMAXNAMED(padnl)
609 B::PADNAMELIST padnl
610  
611 #endif
612  
613 MODULE = B PACKAGE = B::REGEXP PREFIX = RX_
614  
615 #if PERL_VERSION > 10
616  
617 U32
618 RX_EXTFLAGS(rx)
619 B::REGEXP rx
620  
621 #endif
622  
623 MODULE = B PACKAGE = B::COP PREFIX = COP_
624  
625 #ifdef need_COP_stashflags
626  
627 #define COP_stashflags(o) CopSTASH_flags(o)
628  
629 U32
630 COP_stashflags(o)
631 B::COP o
632  
633 #endif
634  
635 #ifdef CopLABEL_len_flags
636  
637 SV*
638 COP_label(o)
639 B::OP o
640 PPCODE:
641 {
642 STRLEN len;
643 U32 flags;
644 389236 const char *pv = CopLABEL_len_flags(cCOPo, &len, &flags);
645 PERL_UNUSED_VAR(RETVAL);
646 2492 ST(0) = pv ? sv_2mortal(newSVpvn_flags(pv, len, flags))
647 389236 ▶ : &PL_sv_undef;
Branch: 1 branch
BranchTrueFalseTotal
: &PL_sv_undef; 2492 386744 389236
648 }
649 389236 XSRETURN(1);
650  
651 #endif
652  
653 MODULE = B__CC PACKAGE = B::CC
654  
655 PROTOTYPES: DISABLE
656  
657 # Perl_ck_null is not exported on Windows, so disable autovivification
658 # optimizations there
659  
660 U32
661 _autovivification(cop)
662 B::COP cop
663 CODE:
664 {
665 SV *hint;
666 IV h;
667  
668 0 RETVAL = 1;
669 0 ▶ if (PL_check[OP_PADSV] != PL_check[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (PL_check[OP_PADSV] != PL_check[0]) { 0 0 0
670 /*char *package = CopSTASHPV(cop);*/
671 #ifdef cop_hints_fetch_pvn
672 0 hint = cop_hints_fetch_pvn(cop, "autovivification", strlen("autovivification"), a_hash, 0);
673 #elif PERL_VERSION > 9
674 hint = Perl_refcounted_he_fetch(aTHX_ cop->cop_hints_hash,
675 NULL, "autovivification", strlen("autovivification"), 0, a_hash);
676 #else
677 SV **val = hv_fetch(GvHV(PL_hintgv), "autovivification", strlen("autovivification"), 0);
678 if (!val)
679 return;
680 hint = *val;
681 #endif
682 0 ▶ if (!(hint && SvIOK(hint)))
Branch: 2 branches
BranchTrueFalseTotal
if (!(hint && SvIOK(hint))) 0 0 0
if (!(hint && SvIOK(hint))) 0 0 0
683 0 return;
684 0 h = SvIVX(hint);
685 0 ▶ if (h & 4) /* A_HINT_FETCH 4 */
Branch: 1 branch
BranchTrueFalseTotal
if (h & 4) /* A_HINT_FETCH 4 */ 0 0 0
686 0 RETVAL = 0;
687 }
688 }
689 OUTPUT:
690 RETVAL
691  
692  
693 MODULE = B__OP PACKAGE = B::OP PREFIX = op_
694  
695 #ifdef need_op_slabbed
696  
697 I32
698 op_slabbed(op)
699 B::OP op
700 PPCODE:
701 mPUSHi(op->op_slabbed);
702  
703 I32
704 op_savefree(op)
705 B::OP op
706 PPCODE:
707 mPUSHi(op->op_savefree);
708  
709 I32
710 op_static(op)
711 B::OP op
712 PPCODE:
713 mPUSHi(op->op_static);
714  
715 #endif
716  
717 #ifdef need_op_folded
718  
719 I32
720 op_folded(op)
721 B::OP op
722 PPCODE:
723 mPUSHi(op->op_folded);
724  
725 #endif
726  
727 MODULE = B PACKAGE = B::HV PREFIX = Hv
728  
729 #ifdef need_HvARRAY_utf8
730  
731 void
732 HvARRAY_utf8(hv)
733 B::HV hv
734 PPCODE:
735 if (HvKEYS(hv) > 0) {
736 HE *he;
737 (void)hv_iterinit(hv);
738 EXTEND(sp, HvKEYS(hv) * 2);
739 while ((he = hv_iternext(hv))) {
740 if (HeSVKEY(he)) {
741 mPUSHs(HeSVKEY(he));
742 } else if (HeKUTF8(he)) {
743 PUSHs(newSVpvn_flags(HeKEY(he), HeKLEN(he), SVf_UTF8|SVs_TEMP));
744 } else {
745 mPUSHp(HeKEY(he), HeKLEN(he));
746 }
747 PUSHs(make_sv_object(aTHX_ HeVAL(he)));
748 }
749 }
750  
751 #endif
752  
753 MODULE = B__C PACKAGE = B::C
754  
755 #if PERL_VERSION >= 10
756  
757 SV*
758 get_linear_isa(classname)
759 SV* classname;
760 CODE:
761 {
762 38660 HV *class_stash = gv_stashsv(classname, 0);
763  
764 38660 ▶ if (!class_stash) {
Branch: 1 branch
BranchTrueFalseTotal
if (!class_stash) { 6 38654 38660
765 /* No stash exists yet, give them just the classname */
766 6 AV* isalin = newAV();
767 6 av_push(isalin, newSVsv(classname));
768 6 RETVAL = newRV(MUTABLE_SV(isalin));
769 }
770 else { /* just dfs */
771 38654 RETVAL = newRV(MUTABLE_SV(Perl_mro_get_linear_isa(aTHX_ class_stash)));
772 }
773 }
774 OUTPUT:
775 RETVAL
776  
777 #endif
778  
779 BOOT:
780 #if PERL_VERSION >= 10
781 {
782 MY_CXT_INIT;
783 #endif
784 275 PL_runops = my_runops;
785 #if PERL_VERSION >= 10
786 {
787 dMY_CXT;
788 275 specialsv_list[0] = Nullsv;
789 275 specialsv_list[1] = &PL_sv_undef;
790 275 specialsv_list[2] = &PL_sv_yes;
791 275 specialsv_list[3] = &PL_sv_no;
792 275 specialsv_list[4] = (SV *) pWARN_ALL;
793 275 specialsv_list[5] = (SV *) pWARN_NONE;
794 275 specialsv_list[6] = (SV *) pWARN_STD;
795 }
796 }
797 #endif
« blib/lib/ByteLoader.pm ↑ Summary ccode59i.pl »