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 char *svclassnames[] = {
61 static char *opclassnames[] = {
76 static 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_ OP *o)
110 return (o->op_flags & OPf_KIDS) ? OPc_UNOP : OPc_BASEOP;
112 if (o->op_type == OP_SASSIGN)
113 return ((o->op_private & OPpASSIGN_BACKWARDS) ? OPc_UNOP : OPc_BINOP);
116 if (o->op_type == OP_GV || o->op_type == OP_GVSV ||
117 o->op_type == OP_AELEMFAST || o->op_type == OP_RCATLINE)
121 switch (PL_opargs[o->op_type] & OA_CLASS_MASK) {
146 case OA_PVOP_OR_SVOP:
148 * Character translations (tr///) are usually a PVOP, keeping a
149 * pointer to a table of shorts used to look up translations.
150 * Under utf8, however, a simple table isn't practical; instead,
151 * the OP is an SVOP, and the SV is a reference to a swash
152 * (i.e., an RV pointing to an HV).
154 return (o->op_private & (OPpTRANS_TO_UTF|OPpTRANS_FROM_UTF))
155 ? OPc_SVOP : OPc_PVOP;
163 case OA_BASEOP_OR_UNOP:
165 * UNI(OP_foo) in toke.c returns token UNI or FUNC1 depending on
166 * whether parens were seen. perly.y uses OPf_SPECIAL to
167 * signal whether a BASEOP had empty parens or none.
168 * Some other UNOPs are created later, though, so the best
169 * test is OPf_KIDS, which is set in newUNOP.
171 return (o->op_flags & OPf_KIDS) ? OPc_UNOP : OPc_BASEOP;
175 * The file stat OPs are created via UNI(OP_foo) in toke.c but use
176 * the OPf_REF flag to distinguish between OP types instead of the
177 * usual OPf_SPECIAL flag. As usual, if OPf_KIDS is set, then we
178 * return OPc_UNOP so that walkoptree can find our children. If
179 * OPf_KIDS is not set then we check OPf_REF. Without OPf_REF set
180 * (no argument to the operator) it's an OP; with OPf_REF set it's
181 * an SVOP (and op_sv is the GV for the filehandle argument).
183 return ((o->op_flags & OPf_KIDS) ? OPc_UNOP :
185 (o->op_flags & OPf_REF) ? OPc_PADOP : OPc_BASEOP);
187 (o->op_flags & OPf_REF) ? OPc_SVOP : OPc_BASEOP);
191 * next, last, redo, dump and goto use OPf_SPECIAL to indicate that a
192 * label was omitted (in which case it's a BASEOP) or else a term was
193 * seen. In this last case, all except goto are definitely PVOP but
194 * goto is either a PVOP (with an ordinary constant label), an UNOP
195 * with OPf_STACKED (with a non-constant non-sub) or an UNOP for
196 * OP_REFGEN (with goto &sub) in which case OPf_STACKED also seems to
199 if (o->op_flags & OPf_STACKED)
201 else if (o->op_flags & OPf_SPECIAL)
206 warn("can't determine class of operator %s, assuming BASEOP\n",
207 PL_op_name[o->op_type]);
212 cc_opclassname(pTHX_ OP *o)
214 return opclassnames[cc_opclass(aTHX_ o)];
218 make_sv_object(pTHX_ SV *arg, SV *sv)
224 for (iv = 0; iv < sizeof(specialsv_list)/sizeof(SV*); iv++) {
225 if (sv == specialsv_list[iv]) {
231 type = svclassnames[SvTYPE(sv)];
234 sv_setiv(newSVrv(arg, type), iv);
239 make_mg_object(pTHX_ SV *arg, MAGIC *mg)
241 sv_setiv(newSVrv(arg, "B::MAGIC"), PTR2IV(mg));
246 cstring(pTHX_ SV *sv, bool perlstyle)
248 SV *sstr = newSVpvn("", 0);
251 char escbuff[5]; /* to fit backslash, 3 octals + trailing \0 */
254 sv_setpvn(sstr, "0", 1);
255 else if (perlstyle && SvUTF8(sv))
257 SV *tmpsv = sv_newmortal(); /* Temporary SV to feed sv_uni_display */
259 s = sv_uni_display(tmpsv, sv, 8*len, UNI_DISPLAY_QQ);
264 sv_catpv(sstr, "\\\"");
266 sv_catpv(sstr, "\\$");
268 sv_catpv(sstr, "\\@");
271 if (strchr("nrftax\\",*(s+1)))
272 sv_catpvn(sstr, s++, 2);
274 sv_catpv(sstr, "\\\\");
276 else /* should always be printable */
277 sv_catpvn(sstr, s, 1);
280 sv_catpv(sstr, "\"");
287 sv_catpv(sstr, "\"");
288 for (; len; len--, s++)
290 /* At least try a little for readability */
292 sv_catpv(sstr, "\\\"");
294 sv_catpv(sstr, "\\\\");
295 /* trigraphs - bleagh */
296 else if (!perlstyle && *s == '?' && len>=3 && s[1] == '?')
298 sprintf(escbuff, "\\%03o", '?');
299 sv_catpv(sstr, escbuff);
301 else if (perlstyle && *s == '$')
302 sv_catpv(sstr, "\\$");
303 else if (perlstyle && *s == '@')
304 sv_catpv(sstr, "\\@");
306 else if (isPRINT(*s))
308 else if (*s >= ' ' && *s < 127)
310 sv_catpvn(sstr, s, 1);
312 sv_catpv(sstr, "\\n");
314 sv_catpv(sstr, "\\r");
316 sv_catpv(sstr, "\\t");
318 sv_catpv(sstr, "\\a");
320 sv_catpv(sstr, "\\b");
322 sv_catpv(sstr, "\\f");
323 else if (!perlstyle && *s == '\v')
324 sv_catpv(sstr, "\\v");
327 /* Don't want promotion of a signed -1 char in sprintf args */
328 unsigned char c = (unsigned char) *s;
329 sprintf(escbuff, "\\%03o", c);
330 sv_catpv(sstr, escbuff);
332 /* XXX Add line breaks if string is long */
334 sv_catpv(sstr, "\"");
342 SV *sstr = newSVpvn("'", 1);
344 char *s = SvPV(sv, n_a);
347 sv_catpv(sstr, "\\'");
349 sv_catpv(sstr, "\\\\");
351 else if (isPRINT(*s))
353 else if (*s >= ' ' && *s < 127)
355 sv_catpvn(sstr, s, 1);
357 sv_catpv(sstr, "\\n");
359 sv_catpv(sstr, "\\r");
361 sv_catpv(sstr, "\\t");
363 sv_catpv(sstr, "\\a");
365 sv_catpv(sstr, "\\b");
367 sv_catpv(sstr, "\\f");
369 sv_catpv(sstr, "\\v");
372 /* no trigraph support */
373 char escbuff[5]; /* to fit backslash, 3 octals + trailing \0 */
374 /* Don't want promotion of a signed -1 char in sprintf args */
375 unsigned char c = (unsigned char) *s;
376 sprintf(escbuff, "\\%03o", c);
377 sv_catpv(sstr, escbuff);
384 walkoptree(pTHX_ SV *opsv, char *method)
391 croak("opsv is not a reference");
392 opsv = sv_mortalcopy(opsv);
393 o = INT2PTR(OP*,SvIV((SV*)SvRV(opsv)));
394 if (walkoptree_debug) {
398 perl_call_method("walkoptree_debug", G_DISCARD);
403 perl_call_method(method, G_DISCARD);
404 if (o && (o->op_flags & OPf_KIDS)) {
405 for (kid = ((UNOP*)o)->op_first; kid; kid = kid->op_sibling) {
406 /* Use the same opsv. Rely on methods not to mess it up. */
407 sv_setiv(newSVrv(opsv, cc_opclassname(aTHX_ kid)), PTR2IV(kid));
408 walkoptree(aTHX_ opsv, method);
411 if (o && (cc_opclass(aTHX_ o) == OPc_PMOP)
412 && (kid = cPMOPo->op_pmreplroot))
414 sv_setiv(newSVrv(opsv, opclassnames[OPc_PMOP]), PTR2IV(kid));
415 walkoptree(aTHX_ opsv, method);
420 oplist(pTHX_ OP *o, SV **SP)
422 for(; o; o = o->op_next) {
424 #if PERL_VERSION >= 9
433 opsv = sv_newmortal();
434 sv_setiv(newSVrv(opsv, cc_opclassname(aTHX_ (OP*)o)), PTR2IV(o));
436 switch (o->op_type) {
438 SP = oplist(aTHX_ cPMOPo->op_pmreplstart, SP);
441 if (o->op_flags & OPf_STACKED && o->op_flags & OPf_SPECIAL) {
442 OP *kid = cLISTOPo->op_first->op_sibling; /* pass pushmark */
443 kid = kUNOP->op_first; /* pass rv2gv */
444 kid = kUNOP->op_first; /* pass leave */
445 SP = oplist(aTHX_ kid->op_next, SP);
449 switch (PL_opargs[o->op_type] & OA_CLASS_MASK) {
451 SP = oplist(aTHX_ cLOGOPo->op_other, SP);
454 SP = oplist(aTHX_ cLOOPo->op_lastop, SP);
455 SP = oplist(aTHX_ cLOOPo->op_nextop, SP);
456 SP = oplist(aTHX_ cLOOPo->op_redoop, SP);
464 typedef UNOP *B__UNOP;
465 typedef BINOP *B__BINOP;
466 typedef LOGOP *B__LOGOP;
467 typedef LISTOP *B__LISTOP;
468 typedef PMOP *B__PMOP;
469 typedef SVOP *B__SVOP;
470 typedef PADOP *B__PADOP;
471 typedef PVOP *B__PVOP;
472 typedef LOOP *B__LOOP;
490 typedef MAGIC *B__MAGIC;
492 MODULE = B PACKAGE = B PREFIX = B_
498 HV *stash = gv_stashpvn("B", 1, TRUE);
499 AV *export_ok = perl_get_av("B::EXPORT_OK",TRUE);
501 specialsv_list[0] = Nullsv;
502 specialsv_list[1] = &PL_sv_undef;
503 specialsv_list[2] = &PL_sv_yes;
504 specialsv_list[3] = &PL_sv_no;
505 specialsv_list[4] = pWARN_ALL;
506 specialsv_list[5] = pWARN_NONE;
507 specialsv_list[6] = pWARN_STD;
508 #if PERL_VERSION <= 9
509 # define CVf_ASSERTION 0
514 #define B_main_cv() PL_main_cv
515 #define B_init_av() PL_initav
516 #define B_inc_gv() PL_incgv
517 #define B_check_av() PL_checkav_save
518 #define B_begin_av() PL_beginav_save
519 #define B_end_av() PL_endav
520 #define B_main_root() PL_main_root
521 #define B_main_start() PL_main_start
522 #define B_amagic_generation() PL_amagic_generation
523 #define B_defstash() PL_defstash
524 #define B_curstash() PL_curstash
525 #define B_dowarn() PL_dowarn
526 #define B_comppadlist() (PL_main_cv ? CvPADLIST(PL_main_cv) : CvPADLIST(PL_compcv))
527 #define B_sv_undef() &PL_sv_undef
528 #define B_sv_yes() &PL_sv_yes
529 #define B_sv_no() &PL_sv_no
530 #define B_formfeed() PL_formfeed
532 #define B_regex_padav() PL_regex_padav
567 B_amagic_generation()
596 ST(0) = make_sv_object(aTHX_ sv_newmortal(), PL_warnhook);
601 ST(0) = make_sv_object(aTHX_ sv_newmortal(), PL_diehook);
603 MODULE = B PACKAGE = B
606 walkoptree(opsv, method)
610 walkoptree(aTHX_ opsv, method);
613 walkoptree_debug(...)
616 RETVAL = walkoptree_debug;
617 if (items > 0 && SvTRUE(ST(1)))
618 walkoptree_debug = 1;
622 #define address(sv) PTR2IV(sv)
633 croak("argument is not a reference");
634 RETVAL = (SV*)SvRV(sv);
645 ST(0) = sv_newmortal();
646 if (strncmp(name,"pp_",3) == 0)
648 for (i = 0; i < PL_maxo; i++)
650 if (strcmp(name, PL_op_name[i]) == 0)
656 sv_setiv(ST(0),result);
663 ST(0) = sv_newmortal();
664 if (opnum >= 0 && opnum < PL_maxo) {
665 sv_setpvn(ST(0), "pp_", 3);
666 sv_catpv(ST(0), PL_op_name[opnum]);
676 char hexhash[19]; /* must fit "0xffffffffffffffff" plus trailing \0 */
678 PERL_HASH(hash, s, len);
679 sprintf(hexhash, "0x%"UVxf, (UV)hash);
680 ST(0) = sv_2mortal(newSVpv(hexhash, 0));
682 #define cast_I32(foo) (I32)foo
701 RETVAL = cstring(aTHX_ sv, 0);
709 RETVAL = cstring(aTHX_ sv, 1);
717 RETVAL = cchar(aTHX_ sv);
726 #define OP_next(o) o->op_next
727 #define OP_sibling(o) o->op_sibling
728 #define OP_desc(o) PL_op_desc[o->op_type]
729 #define OP_targ(o) o->op_targ
730 #define OP_type(o) o->op_type
731 #if PERL_VERSION >= 9
732 # define OP_opt(o) o->op_opt
733 # define OP_static(o) o->op_static
735 # define OP_seq(o) o->op_seq
737 #define OP_flags(o) o->op_flags
738 #define OP_private(o) o->op_private
739 #define OP_spare(o) o->op_spare
741 MODULE = B PACKAGE = B::OP PREFIX = OP_
747 RETVAL = opsizes[cc_opclass(aTHX_ o)];
763 RETVAL = PL_op_name[o->op_type];
773 SV *sv = sv_newmortal();
775 sv_setpvn(sv, "PL_ppaddr[OP_", 13);
776 sv_catpv(sv, PL_op_name[o->op_type]);
777 for (i=13; (STRLEN)i < SvCUR(sv); ++i)
778 SvPVX(sv)[i] = toUPPER(SvPVX(sv)[i]);
794 #if PERL_VERSION >= 9
820 #if PERL_VERSION >= 9
832 SP = oplist(aTHX_ o, SP);
834 #define UNOP_first(o) o->op_first
836 MODULE = B PACKAGE = B::UNOP PREFIX = UNOP_
842 #define BINOP_last(o) o->op_last
844 MODULE = B PACKAGE = B::BINOP PREFIX = BINOP_
850 #define LOGOP_other(o) o->op_other
852 MODULE = B PACKAGE = B::LOGOP PREFIX = LOGOP_
858 MODULE = B PACKAGE = B::LISTOP PREFIX = LISTOP_
867 for (kid = o->op_first; kid; kid = kid->op_sibling)
873 #define PMOP_pmreplroot(o) o->op_pmreplroot
874 #define PMOP_pmreplstart(o) o->op_pmreplstart
875 #define PMOP_pmnext(o) o->op_pmnext
876 #define PMOP_pmregexp(o) PM_GETRE(o)
878 #define PMOP_pmoffset(o) o->op_pmoffset
879 #define PMOP_pmstashpv(o) o->op_pmstashpv
881 #define PMOP_pmstash(o) o->op_pmstash
883 #define PMOP_pmflags(o) o->op_pmflags
884 #define PMOP_pmpermflags(o) o->op_pmpermflags
885 #define PMOP_pmdynflags(o) o->op_pmdynflags
887 MODULE = B PACKAGE = B::PMOP PREFIX = PMOP_
894 ST(0) = sv_newmortal();
895 root = o->op_pmreplroot;
896 /* OP_PUSHRE stores an SV* instead of an OP* in op_pmreplroot */
897 if (o->op_type == OP_PUSHRE) {
899 sv_setiv(ST(0), INT2PTR(PADOFFSET,root) );
901 sv_setiv(newSVrv(ST(0), root ?
902 svclassnames[SvTYPE((SV*)root)] : "B::SV"),
907 sv_setiv(newSVrv(ST(0), cc_opclassname(aTHX_ root)), PTR2IV(root));
951 REGEXP * rx = NO_INIT
953 ST(0) = sv_newmortal();
956 sv_setpvn(ST(0), rx->precomp, rx->prelen);
958 #define SVOP_sv(o) cSVOPo->op_sv
959 #define SVOP_gv(o) ((GV*)cSVOPo->op_sv)
961 MODULE = B PACKAGE = B::SVOP PREFIX = SVOP_
971 #define PADOP_padix(o) o->op_padix
972 #define PADOP_sv(o) (o->op_padix ? PAD_SVl(o->op_padix) : Nullsv)
973 #define PADOP_gv(o) ((o->op_padix \
974 && SvTYPE(PAD_SVl(o->op_padix)) == SVt_PVGV) \
975 ? (GV*)PAD_SVl(o->op_padix) : Nullgv)
977 MODULE = B PACKAGE = B::PADOP PREFIX = PADOP_
991 MODULE = B PACKAGE = B::PVOP PREFIX = PVOP_
998 * OP_TRANS uses op_pv to point to a table of 256 or >=258 shorts
999 * whereas other PVOPs point to a null terminated string.
1001 if (o->op_type == OP_TRANS &&
1002 (o->op_private & OPpTRANS_COMPLEMENT) &&
1003 !(o->op_private & OPpTRANS_DELETE))
1005 short* tbl = (short*)o->op_pv;
1006 short entries = 257 + tbl[256];
1007 ST(0) = sv_2mortal(newSVpv(o->op_pv, entries * sizeof(short)));
1009 else if (o->op_type == OP_TRANS) {
1010 ST(0) = sv_2mortal(newSVpv(o->op_pv, 256 * sizeof(short)));
1013 ST(0) = sv_2mortal(newSVpv(o->op_pv, 0));
1015 #define LOOP_redoop(o) o->op_redoop
1016 #define LOOP_nextop(o) o->op_nextop
1017 #define LOOP_lastop(o) o->op_lastop
1019 MODULE = B PACKAGE = B::LOOP PREFIX = LOOP_
1034 #define COP_label(o) o->cop_label
1035 #define COP_stashpv(o) CopSTASHPV(o)
1036 #define COP_stash(o) CopSTASH(o)
1037 #define COP_file(o) CopFILE(o)
1038 #define COP_filegv(o) CopFILEGV(o)
1039 #define COP_cop_seq(o) o->cop_seq
1040 #define COP_arybase(o) o->cop_arybase
1041 #define COP_line(o) CopLINE(o)
1042 #define COP_warnings(o) o->cop_warnings
1043 #define COP_io(o) o->cop_io
1045 MODULE = B PACKAGE = B::COP PREFIX = COP_
1088 MODULE = B PACKAGE = B::SV
1094 #define object_2svref(sv) sv
1101 MODULE = B PACKAGE = B::SV PREFIX = Sv
1123 MODULE = B PACKAGE = B::IV PREFIX = Sv
1138 MODULE = B PACKAGE = B::IV
1140 #define needs64bits(sv) ((I32)SvIVX(sv) != SvIVX(sv))
1150 if (sizeof(IV) == 8) {
1154 * The following way of spelling 32 is to stop compilers on
1155 * 32-bit architectures from moaning about the shift count
1156 * being >= the width of the type. Such architectures don't
1157 * reach this code anyway (unless sizeof(IV) > 8 but then
1158 * everything else breaks too so I'm not fussed at the moment).
1161 wp[0] = htonl(((UV)iv) >> (sizeof(UV)*4));
1163 wp[0] = htonl(((U32)iv) >> (sizeof(UV)*4));
1165 wp[1] = htonl(iv & 0xffffffff);
1166 ST(0) = sv_2mortal(newSVpvn((char *)wp, 8));
1168 U32 w = htonl((U32)SvIVX(sv));
1169 ST(0) = sv_2mortal(newSVpvn((char *)&w, 4));
1172 MODULE = B PACKAGE = B::NV PREFIX = Sv
1182 MODULE = B PACKAGE = B::RV PREFIX = Sv
1188 MODULE = B PACKAGE = B::PV PREFIX = Sv
1202 croak( "argument is not SvROK" );
1211 ST(0) = sv_newmortal();
1213 sv_setpvn(ST(0), SvPVX(sv), SvCUR(sv));
1214 SvFLAGS(ST(0)) |= SvUTF8(sv);
1217 /* XXX for backward compatibility, but should fail */
1218 /* croak( "argument is not SvPOK" ); */
1219 sv_setpvn(ST(0), NULL, 0);
1226 ST(0) = sv_newmortal();
1227 sv_setpvn(ST(0), SvPVX(sv),
1228 SvCUR(sv) + (SvTYPE(sv) == SVt_PVBM ? 257 : 0));
1239 MODULE = B PACKAGE = B::PVMG PREFIX = Sv
1244 MAGIC * mg = NO_INIT
1246 for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic)
1247 XPUSHs(make_mg_object(aTHX_ sv_newmortal(), mg));
1249 MODULE = B PACKAGE = B::PVMG
1255 #define MgMOREMAGIC(mg) mg->mg_moremagic
1256 #define MgPRIVATE(mg) mg->mg_private
1257 #define MgTYPE(mg) mg->mg_type
1258 #define MgFLAGS(mg) mg->mg_flags
1259 #define MgOBJ(mg) mg->mg_obj
1260 #define MgLENGTH(mg) mg->mg_len
1261 #define MgREGEX(mg) PTR2IV(mg->mg_obj)
1263 MODULE = B PACKAGE = B::MAGIC PREFIX = Mg
1269 if( MgMOREMAGIC(mg) ) {
1270 RETVAL = MgMOREMAGIC(mg);
1298 if( mg->mg_type == 'r' ) {
1299 RETVAL = MgREGEX(mg);
1302 croak( "REGEX is only meaningful on r-magic" );
1311 if (mg->mg_type == 'r') {
1312 REGEXP* rx = (REGEXP*)mg->mg_obj;
1314 RETVAL = newSVpvn( rx->precomp, rx->prelen );
1317 croak( "precomp is only meaningful on r-magic" );
1330 ST(0) = sv_newmortal();
1332 if (mg->mg_len >= 0){
1333 sv_setpvn(ST(0), mg->mg_ptr, mg->mg_len);
1334 } else if (mg->mg_len == HEf_SVKEY) {
1335 ST(0) = make_sv_object(aTHX_
1336 sv_newmortal(), (SV*)mg->mg_ptr);
1340 MODULE = B PACKAGE = B::PVLV PREFIX = Lv
1358 MODULE = B PACKAGE = B::BM PREFIX = Bm
1375 STRLEN len = NO_INIT
1376 char * str = NO_INIT
1378 str = SvPV(sv, len);
1379 /* Boyer-Moore table is just after string and its safety-margin \0 */
1380 ST(0) = sv_2mortal(newSVpvn(str + len + 1, 256));
1382 MODULE = B PACKAGE = B::GV PREFIX = Gv
1388 ST(0) = sv_2mortal(newSVpvn(GvNAME(gv), GvNAMELEN(gv)));
1394 RETVAL = GvGP(gv) == Null(GP*);
1418 RETVAL = (SV*)GvFORM(gv);
1454 MODULE = B PACKAGE = B::GV
1464 MODULE = B PACKAGE = B::IO PREFIX = Io
1517 if( strEQ( name, "stdin" ) ) {
1518 handle = PerlIO_stdin();
1520 else if( strEQ( name, "stdout" ) ) {
1521 handle = PerlIO_stdout();
1523 else if( strEQ( name, "stderr" ) ) {
1524 handle = PerlIO_stderr();
1527 croak( "Invalid value '%s'", name );
1529 RETVAL = handle == IoIFP(io);
1533 MODULE = B PACKAGE = B::IO
1543 MODULE = B PACKAGE = B::AV PREFIX = Av
1553 #define AvOFF(av) ((XPVAV*)SvANY(av))->xof_off
1563 if (AvFILL(av) >= 0) {
1564 SV **svp = AvARRAY(av);
1566 for (i = 0; i <= AvFILL(av); i++)
1567 XPUSHs(make_sv_object(aTHX_ sv_newmortal(), svp[i]));
1575 if (idx >= 0 && AvFILL(av) >= 0 && idx <= AvFILL(av))
1576 XPUSHs(make_sv_object(aTHX_ sv_newmortal(), (AvARRAY(av)[idx])));
1578 XPUSHs(make_sv_object(aTHX_ sv_newmortal(), NULL));
1581 MODULE = B PACKAGE = B::AV
1587 MODULE = B PACKAGE = B::FM PREFIX = Fm
1593 MODULE = B PACKAGE = B::CV PREFIX = Cv
1639 ST(0) = sv_2mortal(newSViv(PTR2IV(CvXSUB(cv))));
1646 ST(0) = CvCONST(cv) ?
1647 make_sv_object(aTHX_ sv_newmortal(),CvXSUBANY(cv).any_ptr) :
1648 sv_2mortal(newSViv(CvXSUBANY(cv).any_iv));
1650 MODULE = B PACKAGE = B::CV
1656 MODULE = B PACKAGE = B::CV PREFIX = cv_
1663 MODULE = B PACKAGE = B::HV PREFIX = Hv
1693 if (HvKEYS(hv) > 0) {
1697 (void)hv_iterinit(hv);
1698 EXTEND(sp, HvKEYS(hv) * 2);
1699 while ((sv = hv_iternextsv(hv, &key, &len))) {
1700 PUSHs(newSVpvn(key, len));
1701 PUSHs(make_sv_object(aTHX_ sv_newmortal(), sv));