3 * Copyright (c) 1996 Malcolm Beattie
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
10 #define PERL_NO_GET_CONTEXT
16 typedef PerlIO * InputStream;
18 typedef FILE * InputStream;
22 static const char* const svclassnames[] = {
27 #if PERL_VERSION <= 10
34 #if PERL_VERSION >= 11
61 static const char* const opclassnames[] = {
76 static const size_t opsizes[] = {
91 #define MY_CXT_KEY "B::_guts" XS_VERSION
94 int x_walkoptree_debug; /* Flag for walkoptree debug hook */
95 SV * x_specialsv_list[7];
100 #define walkoptree_debug (MY_CXT.x_walkoptree_debug)
101 #define specialsv_list (MY_CXT.x_specialsv_list)
104 cc_opclass(pTHX_ const OP *o)
112 return (o->op_flags & OPf_KIDS) ? OPc_UNOP : OPc_BASEOP;
114 if (o->op_type == OP_SASSIGN)
115 return ((o->op_private & OPpASSIGN_BACKWARDS) ? OPc_UNOP : OPc_BINOP);
117 if (o->op_type == OP_AELEMFAST) {
118 #if PERL_VERSION <= 14
119 if (o->op_flags & OPf_SPECIAL)
131 if (o->op_type == OP_GV || o->op_type == OP_GVSV ||
132 o->op_type == OP_RCATLINE)
136 if (o->op_type == OP_CUSTOM)
139 switch (OP_CLASS(o)) {
164 case OA_PVOP_OR_SVOP:
166 * Character translations (tr///) are usually a PVOP, keeping a
167 * pointer to a table of shorts used to look up translations.
168 * Under utf8, however, a simple table isn't practical; instead,
169 * the OP is an SVOP (or, under threads, a PADOP),
170 * and the SV is a reference to a swash
171 * (i.e., an RV pointing to an HV).
174 (o->op_private & (OPpTRANS_TO_UTF|OPpTRANS_FROM_UTF))
176 #if defined(USE_ITHREADS)
177 ? OPc_PADOP : OPc_PVOP;
179 ? OPc_SVOP : OPc_PVOP;
188 case OA_BASEOP_OR_UNOP:
190 * UNI(OP_foo) in toke.c returns token UNI or FUNC1 depending on
191 * whether parens were seen. perly.y uses OPf_SPECIAL to
192 * signal whether a BASEOP had empty parens or none.
193 * Some other UNOPs are created later, though, so the best
194 * test is OPf_KIDS, which is set in newUNOP.
196 return (o->op_flags & OPf_KIDS) ? OPc_UNOP : OPc_BASEOP;
200 * The file stat OPs are created via UNI(OP_foo) in toke.c but use
201 * the OPf_REF flag to distinguish between OP types instead of the
202 * usual OPf_SPECIAL flag. As usual, if OPf_KIDS is set, then we
203 * return OPc_UNOP so that walkoptree can find our children. If
204 * OPf_KIDS is not set then we check OPf_REF. Without OPf_REF set
205 * (no argument to the operator) it's an OP; with OPf_REF set it's
206 * an SVOP (and op_sv is the GV for the filehandle argument).
208 return ((o->op_flags & OPf_KIDS) ? OPc_UNOP :
210 (o->op_flags & OPf_REF) ? OPc_PADOP : OPc_BASEOP);
212 (o->op_flags & OPf_REF) ? OPc_SVOP : OPc_BASEOP);
216 * next, last, redo, dump and goto use OPf_SPECIAL to indicate that a
217 * label was omitted (in which case it's a BASEOP) or else a term was
218 * seen. In this last case, all except goto are definitely PVOP but
219 * goto is either a PVOP (with an ordinary constant label), an UNOP
220 * with OPf_STACKED (with a non-constant non-sub) or an UNOP for
221 * OP_REFGEN (with goto &sub) in which case OPf_STACKED also seems to
224 if (o->op_flags & OPf_STACKED)
226 else if (o->op_flags & OPf_SPECIAL)
231 warn("can't determine class of operator %s, assuming BASEOP\n",
237 make_op_object(pTHX_ const OP *o)
239 SV *opsv = sv_newmortal();
240 sv_setiv(newSVrv(opsv, opclassnames[cc_opclass(aTHX_ o)]), PTR2IV(o));
245 make_sv_object(pTHX_ SV *sv)
247 SV *const arg = sv_newmortal();
248 const char *type = 0;
252 for (iv = 0; iv < (IV)(sizeof(specialsv_list)/sizeof(SV*)); iv++) {
253 if (sv == specialsv_list[iv]) {
259 type = svclassnames[SvTYPE(sv)];
262 sv_setiv(newSVrv(arg, type), iv);
267 make_temp_object(pTHX_ SV *temp)
270 SV *arg = sv_newmortal();
271 const char *const type = svclassnames[SvTYPE(temp)];
272 const IV iv = PTR2IV(temp);
274 target = newSVrv(arg, type);
275 sv_setiv(target, iv);
277 /* Need to keep our "temp" around as long as the target exists.
278 Simplest way seems to be to hang it from magic, and let that clear
279 it up. No vtable, so won't actually get in the way of anything. */
280 sv_magicext(target, temp, PERL_MAGIC_sv, NULL, NULL, 0);
281 /* magic object has had its reference count increased, so we must drop
288 make_warnings_object(pTHX_ const COP *const cop)
290 const STRLEN *const warnings = cop->cop_warnings;
291 const char *type = 0;
293 IV iv = sizeof(specialsv_list)/sizeof(SV*);
295 /* Counting down is deliberate. Before the split between make_sv_object
296 and make_warnings_obj there appeared to be a bug - Nullsv and pWARN_STD
297 were both 0, so you could never get a B::SPECIAL for pWARN_STD */
300 if ((SV*)warnings == specialsv_list[iv]) {
306 SV *arg = sv_newmortal();
307 sv_setiv(newSVrv(arg, type), iv);
310 /* B assumes that warnings are a regular SV. Seems easier to keep it
311 happy by making them into a regular SV. */
312 return make_temp_object(aTHX_ newSVpvn((char *)(warnings + 1), *warnings));
317 make_cop_io_object(pTHX_ COP *cop)
319 SV *const value = newSV(0);
321 Perl_emulate_cop_io(aTHX_ cop, value);
324 return make_sv_object(aTHX_ value);
327 return make_sv_object(aTHX_ NULL);
332 make_mg_object(pTHX_ MAGIC *mg)
334 SV *arg = sv_newmortal();
335 sv_setiv(newSVrv(arg, "B::MAGIC"), PTR2IV(mg));
340 cstring(pTHX_ SV *sv, bool perlstyle)
345 return newSVpvs_flags("0", SVs_TEMP);
347 sstr = newSVpvs_flags("\"", SVs_TEMP);
349 if (perlstyle && SvUTF8(sv)) {
350 SV *tmpsv = sv_newmortal(); /* Temporary SV to feed sv_uni_display */
351 const STRLEN len = SvCUR(sv);
352 const char *s = sv_uni_display(tmpsv, sv, 8*len, UNI_DISPLAY_QQ);
356 sv_catpvs(sstr, "\\\"");
358 sv_catpvs(sstr, "\\$");
360 sv_catpvs(sstr, "\\@");
363 if (strchr("nrftax\\",*(s+1)))
364 sv_catpvn(sstr, s++, 2);
366 sv_catpvs(sstr, "\\\\");
368 else /* should always be printable */
369 sv_catpvn(sstr, s, 1);
377 const char *s = SvPV(sv, len);
378 for (; len; len--, s++)
380 /* At least try a little for readability */
382 sv_catpvs(sstr, "\\\"");
384 sv_catpvs(sstr, "\\\\");
385 /* trigraphs - bleagh */
386 else if (!perlstyle && *s == '?' && len>=3 && s[1] == '?') {
387 Perl_sv_catpvf(aTHX_ sstr, "\\%03o", '?');
389 else if (perlstyle && *s == '$')
390 sv_catpvs(sstr, "\\$");
391 else if (perlstyle && *s == '@')
392 sv_catpvs(sstr, "\\@");
393 else if (isPRINT(*s))
394 sv_catpvn(sstr, s, 1);
396 sv_catpvs(sstr, "\\n");
398 sv_catpvs(sstr, "\\r");
400 sv_catpvs(sstr, "\\t");
402 sv_catpvs(sstr, "\\a");
404 sv_catpvs(sstr, "\\b");
406 sv_catpvs(sstr, "\\f");
407 else if (!perlstyle && *s == '\v')
408 sv_catpvs(sstr, "\\v");
411 /* Don't want promotion of a signed -1 char in sprintf args */
412 const unsigned char c = (unsigned char) *s;
413 Perl_sv_catpvf(aTHX_ sstr, "\\%03o", c);
415 /* XXX Add line breaks if string is long */
418 sv_catpvs(sstr, "\"");
425 SV *sstr = newSVpvs_flags("'", SVs_TEMP);
426 const char *s = SvPV_nolen(sv);
427 /* Don't want promotion of a signed -1 char in sprintf args */
428 const unsigned char c = (unsigned char) *s;
431 sv_catpvs(sstr, "\\'");
433 sv_catpvs(sstr, "\\\\");
435 sv_catpvn(sstr, s, 1);
437 sv_catpvs(sstr, "\\n");
439 sv_catpvs(sstr, "\\r");
441 sv_catpvs(sstr, "\\t");
443 sv_catpvs(sstr, "\\a");
445 sv_catpvs(sstr, "\\b");
447 sv_catpvs(sstr, "\\f");
449 sv_catpvs(sstr, "\\v");
451 Perl_sv_catpvf(aTHX_ sstr, "\\%03o", c);
452 sv_catpvs(sstr, "'");
456 #define PMOP_pmreplstart(o) o->op_pmstashstartu.op_pmreplstart
457 #define PMOP_pmreplroot(o) o->op_pmreplrootu.op_pmreplroot
460 walkoptree(pTHX_ OP *o, const char *method, SV *ref)
465 const char *const classname = opclassnames[cc_opclass(aTHX_ o)];
468 /* Check that no-one has changed our reference, or is holding a reference
470 if (SvREFCNT(ref) == 1 && SvROK(ref) && SvTYPE(ref) == SVt_RV
471 && (object = SvRV(ref)) && SvREFCNT(object) == 1
472 && SvTYPE(object) == SVt_PVMG && SvIOK_only(object)
473 && !SvMAGICAL(object) && !SvMAGIC(object) && SvSTASH(object)) {
474 /* Looks good, so rebless it for the class we need: */
475 sv_bless(ref, gv_stashpv(classname, GV_ADD));
477 /* Need to make a new one. */
478 ref = sv_newmortal();
479 object = newSVrv(ref, classname);
481 sv_setiv(object, PTR2IV(o));
483 if (walkoptree_debug) {
487 perl_call_method("walkoptree_debug", G_DISCARD);
492 perl_call_method(method, G_DISCARD);
493 if (o && (o->op_flags & OPf_KIDS)) {
494 for (kid = ((UNOP*)o)->op_first; kid; kid = kid->op_sibling) {
495 ref = walkoptree(aTHX_ kid, method, ref);
498 if (o && (cc_opclass(aTHX_ o) == OPc_PMOP) && o->op_type != OP_PUSHRE
499 && (kid = PMOP_pmreplroot(cPMOPo)))
501 ref = walkoptree(aTHX_ kid, method, ref);
507 oplist(pTHX_ OP *o, SV **SP)
509 for(; o; o = o->op_next) {
513 XPUSHs(make_op_object(aTHX_ o));
514 switch (o->op_type) {
516 SP = oplist(aTHX_ PMOP_pmreplstart(cPMOPo), SP);
519 if (o->op_flags & OPf_STACKED && o->op_flags & OPf_SPECIAL) {
520 OP *kid = cLISTOPo->op_first->op_sibling; /* pass pushmark */
521 kid = kUNOP->op_first; /* pass rv2gv */
522 kid = kUNOP->op_first; /* pass leave */
523 SP = oplist(aTHX_ kid->op_next, SP);
527 switch (PL_opargs[o->op_type] & OA_CLASS_MASK) {
529 SP = oplist(aTHX_ cLOGOPo->op_other, SP);
532 SP = oplist(aTHX_ cLOOPo->op_lastop, SP);
533 SP = oplist(aTHX_ cLOOPo->op_nextop, SP);
534 SP = oplist(aTHX_ cLOOPo->op_redoop, SP);
542 typedef UNOP *B__UNOP;
543 typedef BINOP *B__BINOP;
544 typedef LOGOP *B__LOGOP;
545 typedef LISTOP *B__LISTOP;
546 typedef PMOP *B__PMOP;
547 typedef SVOP *B__SVOP;
548 typedef PADOP *B__PADOP;
549 typedef PVOP *B__PVOP;
550 typedef LOOP *B__LOOP;
558 #if PERL_VERSION >= 11
559 typedef SV *B__REGEXP;
571 typedef MAGIC *B__MAGIC;
573 typedef struct refcounted_he *B__RHE;
575 typedef PADLIST *B__PADLIST;
579 # define ASSIGN_COMMON_ALIAS(prefix, var) \
580 STMT_START { XSANY.any_i32 = offsetof(struct interpreter, prefix##var); } STMT_END
582 # define ASSIGN_COMMON_ALIAS(prefix, var) \
583 STMT_START { XSANY.any_ptr = (void *)&PL_##var; } STMT_END
586 /* This needs to be ALIASed in a custom way, hence can't easily be defined as
588 static XSPROTO(intrpvar_sv_common); /* prototype to pass -Wmissing-prototypes */
589 static XSPROTO(intrpvar_sv_common)
595 croak_xs_usage(cv, "");
597 ret = *(SV **)(XSANY.any_i32 + (char *)my_perl);
599 ret = *(SV **)(XSANY.any_ptr);
601 ST(0) = make_sv_object(aTHX_ ret);
605 #include "const-c.inc"
607 MODULE = B PACKAGE = B
609 INCLUDE: const-xs.inc
616 const char *file = __FILE__;
618 specialsv_list[0] = Nullsv;
619 specialsv_list[1] = &PL_sv_undef;
620 specialsv_list[2] = &PL_sv_yes;
621 specialsv_list[3] = &PL_sv_no;
622 specialsv_list[4] = (SV *) pWARN_ALL;
623 specialsv_list[5] = (SV *) pWARN_NONE;
624 specialsv_list[6] = (SV *) pWARN_STD;
626 cv = newXS("B::init_av", intrpvar_sv_common, file);
627 ASSIGN_COMMON_ALIAS(I, initav);
628 cv = newXS("B::check_av", intrpvar_sv_common, file);
629 ASSIGN_COMMON_ALIAS(I, checkav_save);
630 cv = newXS("B::unitcheck_av", intrpvar_sv_common, file);
631 ASSIGN_COMMON_ALIAS(I, unitcheckav_save);
632 cv = newXS("B::begin_av", intrpvar_sv_common, file);
633 ASSIGN_COMMON_ALIAS(I, beginav_save);
634 cv = newXS("B::end_av", intrpvar_sv_common, file);
635 ASSIGN_COMMON_ALIAS(I, endav);
636 cv = newXS("B::main_cv", intrpvar_sv_common, file);
637 ASSIGN_COMMON_ALIAS(I, main_cv);
638 cv = newXS("B::inc_gv", intrpvar_sv_common, file);
639 ASSIGN_COMMON_ALIAS(I, incgv);
640 cv = newXS("B::defstash", intrpvar_sv_common, file);
641 ASSIGN_COMMON_ALIAS(I, defstash);
642 cv = newXS("B::curstash", intrpvar_sv_common, file);
643 ASSIGN_COMMON_ALIAS(I, curstash);
645 cv = newXS("B::formfeed", intrpvar_sv_common, file);
646 ASSIGN_COMMON_ALIAS(I, formfeed);
649 cv = newXS("B::regex_padav", intrpvar_sv_common, file);
650 ASSIGN_COMMON_ALIAS(I, regex_padav);
652 cv = newXS("B::warnhook", intrpvar_sv_common, file);
653 ASSIGN_COMMON_ALIAS(I, warnhook);
654 cv = newXS("B::diehook", intrpvar_sv_common, file);
655 ASSIGN_COMMON_ALIAS(I, diehook);
663 PUSHs(make_sv_object(aTHX_ GvSV(gv_fetchpvs("\f", GV_ADD, SVt_PV))));
670 RETVAL = PL_amagic_generation;
677 PADLIST *padlist = CvPADLIST(PL_main_cv ? PL_main_cv : PL_compcv);
681 SV * const rv = sv_newmortal();
682 sv_setiv(newSVrv(rv, padlist ? "B::PADLIST" : "B::NULL"),
687 PUSHs(make_sv_object(aTHX_ (SV *)padlist));
696 PUSHs(make_sv_object(aTHX_ ix > 1 ? &PL_sv_yes
697 : ix < 1 ? &PL_sv_undef
705 PUSHs(make_op_object(aTHX_ ix ? PL_main_start : PL_main_root));
712 RETVAL = ix ? PL_dowarn : PL_sub_generation;
717 walkoptree(op, method)
721 (void) walkoptree(aTHX_ op, method, &PL_sv_undef);
724 walkoptree_debug(...)
727 RETVAL = walkoptree_debug;
728 if (items > 0 && SvTRUE(ST(1)))
729 walkoptree_debug = 1;
733 #define address(sv) PTR2IV(sv)
744 croak("argument is not a reference");
745 PUSHs(make_sv_object(aTHX_ SvRV(sv)));
754 ST(0) = sv_newmortal();
755 if (strncmp(name,"pp_",3) == 0)
757 for (i = 0; i < PL_maxo; i++)
759 if (strcmp(name, PL_op_name[i]) == 0)
765 sv_setiv(ST(0),result);
772 ST(0) = sv_newmortal();
773 if (opnum >= 0 && opnum < PL_maxo)
774 Perl_sv_setpvf(aTHX_ ST(0), "pp_%s", PL_op_name[opnum]);
782 const char *s = SvPVbyte(sv, len);
783 PERL_HASH(hash, s, len);
784 ST(0) = sv_2mortal(Perl_newSVpvf(aTHX_ "0x%"UVxf, (UV)hash));
786 #define cast_I32(foo) (I32)foo
808 PUSHs(ix == 2 ? cchar(aTHX_ sv) : cstring(aTHX_ sv, (bool)ix));
817 #define line_tp 0x20000
819 #define PADOFFSETp 0x40000
822 #define char_pp 0x70000
824 #define OP_next_ix OPp | offsetof(struct op, op_next)
825 #define OP_sibling_ix OPp | offsetof(struct op, op_sibling)
826 #define UNOP_first_ix OPp | offsetof(struct unop, op_first)
827 #define BINOP_last_ix OPp | offsetof(struct binop, op_last)
828 #define LOGOP_other_ix OPp | offsetof(struct logop, op_other)
829 #define PMOP_pmreplstart_ix \
830 OPp | offsetof(struct pmop, op_pmstashstartu.op_pmreplstart)
831 #define LOOP_redoop_ix OPp | offsetof(struct loop, op_redoop)
832 #define LOOP_nextop_ix OPp | offsetof(struct loop, op_nextop)
833 #define LOOP_lastop_ix OPp | offsetof(struct loop, op_lastop)
835 #define OP_targ_ix PADOFFSETp | offsetof(struct op, op_targ)
836 #define OP_flags_ix U8p | offsetof(struct op, op_flags)
837 #define OP_private_ix U8p | offsetof(struct op, op_private)
839 #define PMOP_pmflags_ix U32p | offsetof(struct pmop, op_pmflags)
840 #if PERL_VERSION >= 17
841 # define PMOP_code_list_ix OPp | offsetof(struct pmop, op_code_list)
843 # define PMOP_code_list_ix -1
847 #define PMOP_pmoffset_ix IVp | offsetof(struct pmop, op_pmoffset)
850 # Yes, B::SV::sv and B::SV::gv really do end up generating identical code.
851 #define SVOP_sv_ix SVp | offsetof(struct svop, op_sv)
852 #define SVOP_gv_ix SVp | offsetof(struct svop, op_sv)
854 #define PADOP_padix_ix PADOFFSETp | offsetof(struct padop, op_padix)
856 #define COP_seq_ix U32p | offsetof(struct cop, cop_seq)
857 #define COP_line_ix line_tp | offsetof(struct cop, cop_line)
858 #define COP_hints_ix U32p | offsetof(struct cop, cop_hints)
861 #define COP_stashpv_ix char_pp | offsetof(struct cop, cop_stashpv)
862 #define COP_stashoff_ix PADOFFSETp | offsetof(struct cop, cop_stashoff)
863 #define COP_file_ix char_pp | offsetof(struct cop, cop_file)
865 #define COP_stash_ix SVp | offsetof(struct cop, cop_stash)
866 #define COP_filegv_ix SVp | offsetof(struct cop, cop_filegv)
869 MODULE = B PACKAGE = B::OP
875 RETVAL = opsizes[cc_opclass(aTHX_ o)];
879 # The type checking code in B has always been identical for all OP types,
880 # irrespective of whether the action is actually defined on that OP.
886 B::OP::next = OP_next_ix
887 B::OP::sibling = OP_sibling_ix
888 B::OP::targ = OP_targ_ix
889 B::OP::flags = OP_flags_ix
890 B::OP::private = OP_private_ix
891 B::UNOP::first = UNOP_first_ix
892 B::BINOP::last = BINOP_last_ix
893 B::LOGOP::other = LOGOP_other_ix
894 B::PMOP::pmreplstart = PMOP_pmreplstart_ix
895 B::LOOP::redoop = LOOP_redoop_ix
896 B::LOOP::nextop = LOOP_nextop_ix
897 B::LOOP::lastop = LOOP_lastop_ix
898 B::PMOP::pmflags = PMOP_pmflags_ix
899 B::PMOP::code_list = PMOP_code_list_ix
900 B::SVOP::sv = SVOP_sv_ix
901 B::SVOP::gv = SVOP_gv_ix
902 B::PADOP::padix = PADOP_padix_ix
903 B::COP::cop_seq = COP_seq_ix
904 B::COP::line = COP_line_ix
905 B::COP::hints = COP_hints_ix
910 ptr = (ix & 0xFFFF) + (char *)o;
911 switch ((U8)(ix >> 16)) {
912 case (U8)(OPp >> 16):
913 ret = make_op_object(aTHX_ *((OP **)ptr));
915 case (U8)(PADOFFSETp >> 16):
916 ret = sv_2mortal(newSVuv(*((PADOFFSET*)ptr)));
918 case (U8)(U8p >> 16):
919 ret = sv_2mortal(newSVuv(*((U8*)ptr)));
921 case (U8)(U32p >> 16):
922 ret = sv_2mortal(newSVuv(*((U32*)ptr)));
924 case (U8)(SVp >> 16):
925 ret = make_sv_object(aTHX_ *((SV **)ptr));
927 case (U8)(line_tp >> 16):
928 ret = sv_2mortal(newSVuv(*((line_t *)ptr)));
931 case (U8)(IVp >> 16):
932 ret = sv_2mortal(newSViv(*((IV*)ptr)));
934 case (U8)(char_pp >> 16):
935 ret = sv_2mortal(newSVpv(*((char **)ptr), 0));
939 croak("Illegal alias 0x%08x for B::*next", (unsigned)ix);
951 RETVAL = (char *)(ix ? OP_DESC(o) : OP_NAME(o));
962 sv = sv_2mortal(Perl_newSVpvf(aTHX_ "PL_ppaddr[OP_%s]",
963 PL_op_name[o->op_type]));
964 for (i=13; (STRLEN)i < SvCUR(sv); ++i)
965 SvPVX(sv)[i] = toUPPER(SvPVX(sv)[i]);
968 # These 3 are all bitfields, so we can't take their addresses.
981 RETVAL = o->op_spare;
994 SP = oplist(aTHX_ o, SP);
996 MODULE = B PACKAGE = B::LISTOP
1005 for (kid = o->op_first; kid; kid = kid->op_sibling)
1011 MODULE = B PACKAGE = B::PMOP PREFIX = PMOP_
1018 if (o->op_type == OP_PUSHRE) {
1020 ST(0) = sv_newmortal();
1021 sv_setiv(ST(0), o->op_pmreplrootu.op_pmtargetoff);
1023 GV *const target = o->op_pmreplrootu.op_pmtargetgv;
1024 ST(0) = sv_newmortal();
1025 sv_setiv(newSVrv(ST(0), target ?
1026 svclassnames[SvTYPE((SV*)target)] : "B::SV"),
1031 OP *const root = o->op_pmreplrootu.op_pmreplroot;
1032 ST(0) = make_op_object(aTHX_ root);
1037 #define PMOP_pmstashpv(o) PmopSTASHPV(o);
1049 PUSHs(make_sv_object(aTHX_ (SV *) PmopSTASH(o)));
1062 ST(0) = sv_newmortal();
1065 sv_setuv(ST(0), RX_EXTFLAGS(rx));
1068 sv_setpvn(ST(0), RX_PRECOMP(rx), RX_PRELEN(rx));
1076 cv = newXS("B::PMOP::pmoffset", XS_B__OP_next, __FILE__);
1077 XSANY.any_i32 = PMOP_pmoffset_ix;
1078 # if PERL_VERSION < 17
1079 cv = newXS("B::COP::stashpv", XS_B__OP_next, __FILE__);
1080 XSANY.any_i32 = COP_stashpv_ix;
1082 cv = newXS("B::COP::stashoff", XS_B__OP_next, __FILE__);
1083 XSANY.any_i32 = COP_stashoff_ix;
1085 cv = newXS("B::COP::file", XS_B__OP_next, __FILE__);
1086 XSANY.any_i32 = COP_file_ix;
1088 cv = newXS("B::COP::stash", XS_B__OP_next, __FILE__);
1089 XSANY.any_i32 = COP_stash_ix;
1090 cv = newXS("B::COP::filegv", XS_B__OP_next, __FILE__);
1091 XSANY.any_i32 = COP_filegv_ix;
1093 cv = newXS("B::PMOP::reflags", XS_B__PMOP_precomp, __FILE__);
1097 MODULE = B PACKAGE = B::PADOP
1107 /* It happens that the output typemaps for B::SV and B::GV are
1108 identical. The "smarts" are in make_sv_object(), which determines
1109 which class to use based on SvTYPE(), rather than anything baked in
1112 ret = PAD_SVl(o->op_padix);
1113 if (ix && SvTYPE(ret) != SVt_PVGV)
1118 PUSHs(make_sv_object(aTHX_ ret));
1120 MODULE = B PACKAGE = B::PVOP
1127 * OP_TRANS uses op_pv to point to a table of 256 or >=258 shorts
1128 * whereas other PVOPs point to a null terminated string.
1130 if ((o->op_type == OP_TRANS || o->op_type == OP_TRANSR) &&
1131 (o->op_private & OPpTRANS_COMPLEMENT) &&
1132 !(o->op_private & OPpTRANS_DELETE))
1134 const short* const tbl = (short*)o->op_pv;
1135 const short entries = 257 + tbl[256];
1136 ST(0) = newSVpvn_flags(o->op_pv, entries * sizeof(short), SVs_TEMP);
1138 else if (o->op_type == OP_TRANS || o->op_type == OP_TRANSR) {
1139 ST(0) = newSVpvn_flags(o->op_pv, 256 * sizeof(short), SVs_TEMP);
1142 ST(0) = newSVpvn_flags(o->op_pv, strlen(o->op_pv), SVs_TEMP);
1144 #define COP_label(o) CopLABEL(o)
1146 MODULE = B PACKAGE = B::COP PREFIX = COP_
1152 # Both pairs of accessors are provided for both ithreads and not, but for each,
1153 # one pair is direct structure access, and 1 pair "faked up" with a more complex
1154 # macro. We implement the direct structure access pair using the common code
1155 # above (B::OP::next)
1165 PUSHs(make_sv_object(aTHX_
1166 ix ? (SV *)CopFILEGV(o) : (SV *)CopSTASH(o)));
1174 RETVAL = CopFILE(o);
1180 #if PERL_VERSION >= 17
1186 RETVAL = CopSTASH(o) && SvTYPE(CopSTASH(o)) == SVt_PVHV
1187 ? newSVhek(HvNAME_HEK(CopSTASH(o)))
1193 # ifndef USE_ITHREADS
1199 RETVAL = CopSTASHPV(o);
1220 ST(0) = ix ? make_cop_io_object(aTHX_ o) : make_warnings_object(aTHX_ o);
1228 RETVAL = CopHINTHASH_get(o);
1233 MODULE = B PACKAGE = B::SV
1235 #define MAGICAL_FLAG_BITS (SVs_GMG|SVs_SMG|SVs_RMG)
1245 MAGICAL = MAGICAL_FLAG_BITS
1247 RETVAL = ix ? (SvFLAGS(sv) & (U32)ix) : SvREFCNT(sv);
1255 ST(0) = sv_2mortal(newRV(sv));
1258 MODULE = B PACKAGE = B::IV PREFIX = Sv
1264 MODULE = B PACKAGE = B::IV
1266 #define sv_SVp 0x00000
1267 #define sv_IVp 0x10000
1268 #define sv_UVp 0x20000
1269 #define sv_STRLENp 0x30000
1270 #define sv_U32p 0x40000
1271 #define sv_U8p 0x50000
1272 #define sv_char_pp 0x60000
1273 #define sv_NVp 0x70000
1274 #define sv_char_p 0x80000
1275 #define sv_SSize_tp 0x90000
1276 #define sv_I32p 0xA0000
1277 #define sv_U16p 0xB0000
1279 #define IV_ivx_ix sv_IVp | offsetof(struct xpviv, xiv_iv)
1280 #define IV_uvx_ix sv_UVp | offsetof(struct xpvuv, xuv_uv)
1281 #define NV_nvx_ix sv_NVp | offsetof(struct xpvnv, xnv_u.xnv_nv)
1283 #define NV_cop_seq_range_low_ix \
1284 sv_U32p | offsetof(struct xpvnv, xnv_u.xpad_cop_seq.xlow)
1285 #define NV_cop_seq_range_high_ix \
1286 sv_U32p | offsetof(struct xpvnv, xnv_u.xpad_cop_seq.xhigh)
1287 #define NV_parent_pad_index_ix \
1288 sv_U32p | offsetof(struct xpvnv, xnv_u.xpad_cop_seq.xlow)
1289 #define NV_parent_fakelex_flags_ix \
1290 sv_U32p | offsetof(struct xpvnv, xnv_u.xpad_cop_seq.xhigh)
1292 #define PV_cur_ix sv_STRLENp | offsetof(struct xpv, xpv_cur)
1293 #define PV_len_ix sv_STRLENp | offsetof(struct xpv, xpv_len)
1295 #define PVMG_stash_ix sv_SVp | offsetof(struct xpvmg, xmg_stash)
1297 #if PERL_VERSION > 14
1298 # define PVBM_useful_ix sv_I32p | offsetof(struct xpvgv, xnv_u.xbm_s.xbm_useful)
1299 # define PVBM_previous_ix sv_UVp | offsetof(struct xpvuv, xuv_uv)
1301 #define PVBM_useful_ix sv_I32p | offsetof(struct xpvgv, xiv_u.xivu_i32)
1302 #define PVBM_previous_ix sv_U32p | offsetof(struct xpvgv, xnv_u.xbm_s.xbm_previous)
1305 #define PVBM_rare_ix sv_U8p | offsetof(struct xpvgv, xnv_u.xbm_s.xbm_rare)
1307 #define PVLV_targoff_ix sv_U32p | offsetof(struct xpvlv, xlv_targoff)
1308 #define PVLV_targlen_ix sv_U32p | offsetof(struct xpvlv, xlv_targlen)
1309 #define PVLV_targ_ix sv_SVp | offsetof(struct xpvlv, xlv_targ)
1310 #define PVLV_type_ix sv_char_p | offsetof(struct xpvlv, xlv_type)
1312 #define PVGV_stash_ix sv_SVp | offsetof(struct xpvgv, xnv_u.xgv_stash)
1313 #define PVGV_flags_ix sv_STRLENp | offsetof(struct xpvgv, xpv_cur)
1314 #define PVIO_lines_ix sv_IVp | offsetof(struct xpvio, xiv_iv)
1316 #define PVIO_page_ix sv_IVp | offsetof(struct xpvio, xio_page)
1317 #define PVIO_page_len_ix sv_IVp | offsetof(struct xpvio, xio_page_len)
1318 #define PVIO_lines_left_ix sv_IVp | offsetof(struct xpvio, xio_lines_left)
1319 #define PVIO_top_name_ix sv_char_pp | offsetof(struct xpvio, xio_top_name)
1320 #define PVIO_top_gv_ix sv_SVp | offsetof(struct xpvio, xio_top_gv)
1321 #define PVIO_fmt_name_ix sv_char_pp | offsetof(struct xpvio, xio_fmt_name)
1322 #define PVIO_fmt_gv_ix sv_SVp | offsetof(struct xpvio, xio_fmt_gv)
1323 #define PVIO_bottom_name_ix sv_char_pp | offsetof(struct xpvio, xio_bottom_name)
1324 #define PVIO_bottom_gv_ix sv_SVp | offsetof(struct xpvio, xio_bottom_gv)
1325 #define PVIO_type_ix sv_char_p | offsetof(struct xpvio, xio_type)
1326 #define PVIO_flags_ix sv_U8p | offsetof(struct xpvio, xio_flags)
1328 #define PVAV_max_ix sv_SSize_tp | offsetof(struct xpvav, xav_max)
1330 #define PVCV_stash_ix sv_SVp | offsetof(struct xpvcv, xcv_stash)
1331 #if PERL_VERSION > 17 || (PERL_VERSION == 17 && PERL_SUBVERSION >= 3)
1332 # define PVCV_gv_ix sv_SVp | offsetof(struct xpvcv, xcv_gv_u.xcv_gv)
1334 # define PVCV_gv_ix sv_SVp | offsetof(struct xpvcv, xcv_gv)
1336 #define PVCV_file_ix sv_char_pp | offsetof(struct xpvcv, xcv_file)
1337 #define PVCV_outside_ix sv_SVp | offsetof(struct xpvcv, xcv_outside)
1338 #define PVCV_outside_seq_ix sv_U32p | offsetof(struct xpvcv, xcv_outside_seq)
1339 #define PVCV_flags_ix sv_U16p | offsetof(struct xpvcv, xcv_flags)
1341 #define PVHV_max_ix sv_STRLENp | offsetof(struct xpvhv, xhv_max)
1343 #if PERL_VERSION > 12
1344 #define PVHV_keys_ix sv_STRLENp | offsetof(struct xpvhv, xhv_keys)
1346 #define PVHV_keys_ix sv_IVp | offsetof(struct xpvhv, xhv_keys)
1349 # The type checking code in B has always been identical for all SV types,
1350 # irrespective of whether the action is actually defined on that SV.
1351 # We should fix this
1356 B::IV::IVX = IV_ivx_ix
1357 B::IV::UVX = IV_uvx_ix
1358 B::NV::NVX = NV_nvx_ix
1359 B::NV::COP_SEQ_RANGE_LOW = NV_cop_seq_range_low_ix
1360 B::NV::COP_SEQ_RANGE_HIGH = NV_cop_seq_range_high_ix
1361 B::NV::PARENT_PAD_INDEX = NV_parent_pad_index_ix
1362 B::NV::PARENT_FAKELEX_FLAGS = NV_parent_fakelex_flags_ix
1363 B::PV::CUR = PV_cur_ix
1364 B::PV::LEN = PV_len_ix
1365 B::PVMG::SvSTASH = PVMG_stash_ix
1366 B::PVLV::TARGOFF = PVLV_targoff_ix
1367 B::PVLV::TARGLEN = PVLV_targlen_ix
1368 B::PVLV::TARG = PVLV_targ_ix
1369 B::PVLV::TYPE = PVLV_type_ix
1370 B::GV::STASH = PVGV_stash_ix
1371 B::GV::GvFLAGS = PVGV_flags_ix
1372 B::BM::USEFUL = PVBM_useful_ix
1373 B::BM::PREVIOUS = PVBM_previous_ix
1374 B::BM::RARE = PVBM_rare_ix
1375 B::IO::LINES = PVIO_lines_ix
1376 B::IO::PAGE = PVIO_page_ix
1377 B::IO::PAGE_LEN = PVIO_page_len_ix
1378 B::IO::LINES_LEFT = PVIO_lines_left_ix
1379 B::IO::TOP_NAME = PVIO_top_name_ix
1380 B::IO::TOP_GV = PVIO_top_gv_ix
1381 B::IO::FMT_NAME = PVIO_fmt_name_ix
1382 B::IO::FMT_GV = PVIO_fmt_gv_ix
1383 B::IO::BOTTOM_NAME = PVIO_bottom_name_ix
1384 B::IO::BOTTOM_GV = PVIO_bottom_gv_ix
1385 B::IO::IoTYPE = PVIO_type_ix
1386 B::IO::IoFLAGS = PVIO_flags_ix
1387 B::AV::MAX = PVAV_max_ix
1388 B::CV::STASH = PVCV_stash_ix
1389 B::CV::GV = PVCV_gv_ix
1390 B::CV::FILE = PVCV_file_ix
1391 B::CV::OUTSIDE = PVCV_outside_ix
1392 B::CV::OUTSIDE_SEQ = PVCV_outside_seq_ix
1393 B::CV::CvFLAGS = PVCV_flags_ix
1394 B::HV::MAX = PVHV_max_ix
1395 B::HV::KEYS = PVHV_keys_ix
1400 ptr = (ix & 0xFFFF) + (char *)SvANY(sv);
1401 switch ((U8)(ix >> 16)) {
1402 case (U8)(sv_SVp >> 16):
1403 ret = make_sv_object(aTHX_ *((SV **)ptr));
1405 case (U8)(sv_IVp >> 16):
1406 ret = sv_2mortal(newSViv(*((IV *)ptr)));
1408 case (U8)(sv_UVp >> 16):
1409 ret = sv_2mortal(newSVuv(*((UV *)ptr)));
1411 case (U8)(sv_STRLENp >> 16):
1412 ret = sv_2mortal(newSVuv(*((STRLEN *)ptr)));
1414 case (U8)(sv_U32p >> 16):
1415 ret = sv_2mortal(newSVuv(*((U32 *)ptr)));
1417 case (U8)(sv_U8p >> 16):
1418 ret = sv_2mortal(newSVuv(*((U8 *)ptr)));
1420 case (U8)(sv_char_pp >> 16):
1421 ret = sv_2mortal(newSVpv(*((char **)ptr), 0));
1423 case (U8)(sv_NVp >> 16):
1424 ret = sv_2mortal(newSVnv(*((NV *)ptr)));
1426 case (U8)(sv_char_p >> 16):
1427 ret = newSVpvn_flags((char *)ptr, 1, SVs_TEMP);
1429 case (U8)(sv_SSize_tp >> 16):
1430 ret = sv_2mortal(newSViv(*((SSize_t *)ptr)));
1432 case (U8)(sv_I32p >> 16):
1433 ret = sv_2mortal(newSVuv(*((I32 *)ptr)));
1435 case (U8)(sv_U16p >> 16):
1436 ret = sv_2mortal(newSVuv(*((U16 *)ptr)));
1439 croak("Illegal alias 0x%08x for B::*IVX", (unsigned)ix);
1451 ST(0) = boolSV((I32)SvIVX(sv) != SvIVX(sv));
1452 } else if (sizeof(IV) == 8) {
1454 const IV iv = SvIVX(sv);
1456 * The following way of spelling 32 is to stop compilers on
1457 * 32-bit architectures from moaning about the shift count
1458 * being >= the width of the type. Such architectures don't
1459 * reach this code anyway (unless sizeof(IV) > 8 but then
1460 * everything else breaks too so I'm not fussed at the moment).
1463 wp[0] = htonl(((UV)iv) >> (sizeof(UV)*4));
1465 wp[0] = htonl(((U32)iv) >> (sizeof(UV)*4));
1467 wp[1] = htonl(iv & 0xffffffff);
1468 ST(0) = newSVpvn_flags((char *)wp, 8, SVs_TEMP);
1470 U32 w = htonl((U32)SvIVX(sv));
1471 ST(0) = newSVpvn_flags((char *)&w, 4, SVs_TEMP);
1474 MODULE = B PACKAGE = B::NV PREFIX = Sv
1480 #if PERL_VERSION < 11
1482 MODULE = B PACKAGE = B::RV PREFIX = Sv
1488 PUSHs(make_sv_object(aTHX_ SvRV(sv)));
1492 MODULE = B PACKAGE = B::REGEXP
1501 PUSHs(newSVpvn_flags(RX_PRECOMP(sv), RX_PRELEN(sv), SVs_TEMP));
1504 /* FIXME - can we code this method more efficiently? */
1510 MODULE = B PACKAGE = B::PV
1517 croak( "argument is not SvROK" );
1518 PUSHs(make_sv_object(aTHX_ SvRV(sv)));
1533 #ifndef PERL_FBM_TABLE_OFFSET
1534 const MAGIC *const mg = mg_find(sv, PERL_MAGIC_bm);
1537 croak("argument to B::BM::TABLE is not a PVBM");
1542 /* Boyer-Moore table is just after string and its safety-margin \0 */
1543 p += len + PERL_FBM_TABLE_OFFSET;
1546 } else if (ix == 2) {
1547 /* This used to read 257. I think that that was buggy - should have
1548 been 258. (The "\0", the flags byte, and 256 for the table.)
1549 The only user of this method is B::Bytecode in B::PV::bsave.
1550 I'm guessing that nothing tested the runtime correctness of
1551 output of bytecompiled string constant arguments to index (etc).
1553 Note the start pointer is and has always been SvPVX(sv), not
1554 SvPVX(sv) + SvCUR(sv) PVBM was added in 651aa52ea1faa806, and
1555 first used by the compiler in 651aa52ea1faa806. It's used to
1556 get a "complete" dump of the buffer at SvPVX(), not just the
1557 PVBM table. This permits the generated bytecode to "load"
1560 5.15 and later store the BM table via MAGIC, so the compiler
1561 should handle this just fine without changes if PVBM now
1562 always returns the SvPVX() buffer. */
1563 p = SvPVX_const(sv);
1564 #ifdef PERL_FBM_TABLE_OFFSET
1565 len = SvCUR(sv) + (SvVALID(sv) ? 256 + PERL_FBM_TABLE_OFFSET : 0);
1572 } else if (SvPOK(sv)) {
1574 p = SvPVX_const(sv);
1578 /* XXX for backward compatibility, but should fail */
1579 /* croak( "argument is not SvPOK" ); */
1582 ST(0) = newSVpvn_flags(p, len, SVs_TEMP | utf8);
1584 MODULE = B PACKAGE = B::PVMG
1589 MAGIC * mg = NO_INIT
1591 for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic)
1592 XPUSHs(make_mg_object(aTHX_ mg));
1594 MODULE = B PACKAGE = B::MAGIC
1611 XPUSHs(mg->mg_moremagic ? make_mg_object(aTHX_ mg->mg_moremagic)
1615 mPUSHu(mg->mg_private);
1618 PUSHs(newSVpvn_flags(&(mg->mg_type), 1, SVs_TEMP));
1621 mPUSHu(mg->mg_flags);
1627 PUSHs(make_sv_object(aTHX_ mg->mg_obj));
1631 if (mg->mg_len >= 0) {
1632 PUSHs(newSVpvn_flags(mg->mg_ptr, mg->mg_len, SVs_TEMP));
1633 } else if (mg->mg_len == HEf_SVKEY) {
1634 PUSHs(make_sv_object(aTHX_ (SV*)mg->mg_ptr));
1636 PUSHs(sv_newmortal());
1638 PUSHs(sv_newmortal());
1641 if(mg->mg_type == PERL_MAGIC_qr) {
1642 mPUSHi(PTR2IV(mg->mg_obj));
1644 croak("REGEX is only meaningful on r-magic");
1648 if (mg->mg_type == PERL_MAGIC_qr) {
1649 REGEXP *rx = (REGEXP *)mg->mg_obj;
1650 PUSHs(newSVpvn_flags(rx ? RX_PRECOMP(rx) : NULL,
1651 rx ? RX_PRELEN(rx) : 0, SVs_TEMP));
1653 croak( "precomp is only meaningful on r-magic" );
1658 MODULE = B PACKAGE = B::GV PREFIX = Gv
1667 ST(0) = sv_2mortal(newSVhek(!ix ? GvNAME_HEK(gv)
1668 : (ix == 1 ? GvFILE_HEK(gv)
1669 : HvNAME_HEK((HV *)gv))));
1678 RETVAL = isGV_with_GP(gv) ? TRUE : FALSE;
1680 RETVAL = GvGP(gv) == Null(GP*);
1689 #define GP_sv_ix SVp | offsetof(struct gp, gp_sv)
1690 #define GP_io_ix SVp | offsetof(struct gp, gp_io)
1691 #define GP_cv_ix SVp | offsetof(struct gp, gp_cv)
1692 #define GP_cvgen_ix U32p | offsetof(struct gp, gp_cvgen)
1693 #define GP_refcnt_ix U32p | offsetof(struct gp, gp_refcnt)
1694 #define GP_hv_ix SVp | offsetof(struct gp, gp_hv)
1695 #define GP_av_ix SVp | offsetof(struct gp, gp_av)
1696 #define GP_form_ix SVp | offsetof(struct gp, gp_form)
1697 #define GP_egv_ix SVp | offsetof(struct gp, gp_egv)
1698 #define GP_line_ix line_tp | offsetof(struct gp, gp_line)
1708 GvREFCNT = GP_refcnt_ix
1721 const GV *const gv = CvGV(cv);
1722 Perl_croak(aTHX_ "NULL gp in B::GV::%s", gv ? GvNAME(gv) : "???");
1724 ptr = (ix & 0xFFFF) + (char *)gp;
1725 switch ((U8)(ix >> 16)) {
1726 case (U8)(SVp >> 16):
1727 ret = make_sv_object(aTHX_ *((SV **)ptr));
1729 case (U8)(U32p >> 16):
1730 ret = sv_2mortal(newSVuv(*((U32*)ptr)));
1732 case (U8)(line_tp >> 16):
1733 ret = sv_2mortal(newSVuv(*((line_t *)ptr)));
1736 croak("Illegal alias 0x%08x for B::*SV", (unsigned)ix);
1745 PUSHs(make_sv_object(aTHX_ (SV *)GvFILEGV(gv)));
1747 MODULE = B PACKAGE = B::IO PREFIX = Io
1757 if( strEQ( name, "stdin" ) ) {
1758 handle = PerlIO_stdin();
1760 else if( strEQ( name, "stdout" ) ) {
1761 handle = PerlIO_stdout();
1763 else if( strEQ( name, "stderr" ) ) {
1764 handle = PerlIO_stderr();
1767 croak( "Invalid value '%s'", name );
1769 RETVAL = handle == IoIFP(io);
1773 MODULE = B PACKAGE = B::AV PREFIX = Av
1783 if (AvFILL(av) >= 0) {
1784 SV **svp = AvARRAY(av);
1786 for (i = 0; i <= AvFILL(av); i++)
1787 XPUSHs(make_sv_object(aTHX_ svp[i]));
1795 if (idx >= 0 && AvFILL(av) >= 0 && idx <= AvFILL(av))
1796 XPUSHs(make_sv_object(aTHX_ (AvARRAY(av)[idx])));
1798 XPUSHs(make_sv_object(aTHX_ NULL));
1801 MODULE = B PACKAGE = B::FM PREFIX = Fm
1804 #define FmLINES(sv) 0
1810 MODULE = B PACKAGE = B::CV PREFIX = Cv
1822 PUSHs(make_op_object(aTHX_ CvISXSUB(cv) ? NULL
1823 : ix ? CvROOT(cv) : CvSTART(cv)));
1841 PUSHs(make_sv_object(aTHX_ (SV *)CvPADLIST(cv)));
1852 ST(0) = ix && CvCONST(cv)
1853 ? make_sv_object(aTHX_ (SV *)CvXSUBANY(cv).any_ptr)
1854 : sv_2mortal(newSViv(CvISXSUB(cv)
1855 ? (ix ? CvXSUBANY(cv).any_iv
1856 : PTR2IV(CvXSUB(cv)))
1863 PUSHs(make_sv_object(aTHX_ (SV *)cv_const_sv(cv)));
1865 MODULE = B PACKAGE = B::HV PREFIX = Hv
1879 if (HvUSEDKEYS(hv) > 0) {
1883 (void)hv_iterinit(hv);
1884 EXTEND(sp, HvUSEDKEYS(hv) * 2);
1885 while ((sv = hv_iternextsv(hv, &key, &len))) {
1887 PUSHs(make_sv_object(aTHX_ sv));
1891 MODULE = B PACKAGE = B::HE PREFIX = He
1899 PUSHs(make_sv_object(aTHX_ ix ? HeSVKEY_force(he) : HeVAL(he)));
1905 MODULE = B PACKAGE = B::RHE
1911 RETVAL = newRV( (SV*)cophh_2hv(h, 0) );
1918 MODULE = B PACKAGE = B::PADLIST PREFIX = Padlist
1925 PadlistARRAY(padlist)
1928 if (PadlistMAX(padlist) >= 0) {
1929 PAD **padp = PadlistARRAY(padlist);
1931 for (i = 0; i <= PadlistMAX(padlist); i++)
1932 XPUSHs(make_sv_object(aTHX_ (SV *)padp[i]));
1936 PadlistARRAYelt(padlist, idx)
1940 if (idx >= 0 && PadlistMAX(padlist) >= 0
1941 && idx <= PadlistMAX(padlist))
1942 XPUSHs(make_sv_object(aTHX_
1943 (SV *)PadlistARRAY(padlist)[idx]));
1945 XPUSHs(make_sv_object(aTHX_ NULL));
1948 PadlistREFCNT(padlist)
1951 RETVAL = PadlistREFCNT(padlist);