3 * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 * 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by Larry Wall and others
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Artistic License, as specified in the README file.
12 * "For the fashion of Minas Tirith was such that it was built on seven
16 /* This file contains functions to manipulate several of Perl's stacks;
17 * in particular it contains code to push various types of things onto
18 * the savestack, then to pop them off and perform the correct restorative
19 * action for each one. This corresponds to the cleanup Perl does at
24 #define PERL_IN_SCOPE_C
28 Perl_stack_grow(pTHX_ SV **sp, SV **p, int n)
32 #ifndef STRESS_REALLOC
33 av_extend(PL_curstack, (p - PL_stack_base) + (n) + 128);
35 av_extend(PL_curstack, (p - PL_stack_base) + (n) + 1);
40 #ifndef STRESS_REALLOC
41 #define GROW(old) ((old) * 3 / 2)
43 #define GROW(old) ((old) + 1)
47 Perl_new_stackinfo(pTHX_ I32 stitems, I32 cxitems)
52 si->si_stack = newAV();
53 AvREAL_off(si->si_stack);
54 av_extend(si->si_stack, stitems > 0 ? stitems-1 : 0);
55 AvALLOC(si->si_stack)[0] = &PL_sv_undef;
56 AvFILLp(si->si_stack) = 0;
59 si->si_cxmax = cxitems - 1;
61 si->si_type = PERLSI_UNDEF;
62 Newx(si->si_cxstack, cxitems, PERL_CONTEXT);
63 /* Without any kind of initialising PUSHSUBST()
64 * in pp_subst() will read uninitialised heap. */
65 PoisonNew(si->si_cxstack, cxitems, PERL_CONTEXT);
73 const IV old_max = cxstack_max;
74 cxstack_max = GROW(cxstack_max);
75 Renew(cxstack, cxstack_max + 1, PERL_CONTEXT); /* XXX should fix CXINC macro */
76 /* Without any kind of initialising deep enough recursion
77 * will end up reading uninitialised PERL_CONTEXTs. */
78 PoisonNew(cxstack + old_max + 1, cxstack_max - old_max, PERL_CONTEXT);
79 return cxstack_ix + 1;
86 if (PL_scopestack_ix == PL_scopestack_max) {
87 PL_scopestack_max = GROW(PL_scopestack_max);
88 Renew(PL_scopestack, PL_scopestack_max, I32);
90 PL_scopestack[PL_scopestack_ix++] = PL_savestack_ix;
98 const I32 oldsave = PL_scopestack[--PL_scopestack_ix];
103 Perl_markstack_grow(pTHX)
106 const I32 oldmax = PL_markstack_max - PL_markstack;
107 const I32 newmax = GROW(oldmax);
109 Renew(PL_markstack, newmax, I32);
110 PL_markstack_ptr = PL_markstack + oldmax;
111 PL_markstack_max = PL_markstack + newmax;
115 Perl_savestack_grow(pTHX)
118 PL_savestack_max = GROW(PL_savestack_max) + 4;
119 Renew(PL_savestack, PL_savestack_max, ANY);
123 Perl_savestack_grow_cnt(pTHX_ I32 need)
126 PL_savestack_max = PL_savestack_ix + need;
127 Renew(PL_savestack, PL_savestack_max, ANY);
133 Perl_tmps_grow(pTHX_ I32 n)
136 #ifndef STRESS_REALLOC
138 n = (PL_tmps_max < 512) ? 128 : 512;
140 PL_tmps_max = PL_tmps_ix + n + 1;
141 Renew(PL_tmps_stack, PL_tmps_max, SV*);
149 /* XXX should tmps_floor live in cxstack? */
150 const I32 myfloor = PL_tmps_floor;
151 while (PL_tmps_ix > myfloor) { /* clean up after last statement */
152 SV* const sv = PL_tmps_stack[PL_tmps_ix];
153 PL_tmps_stack[PL_tmps_ix--] = NULL;
154 if (sv && sv != &PL_sv_undef) {
156 SvREFCNT_dec(sv); /* note, can modify tmps_ix!!! */
162 S_save_scalar_at(pTHX_ SV **sptr)
165 SV * const osv = *sptr;
166 register SV * const sv = *sptr = newSV(0);
168 if (SvTYPE(osv) >= SVt_PVMG && SvMAGIC(osv) && SvTYPE(osv) != SVt_PVGV) {
169 if (SvGMAGICAL(osv)) {
170 const bool oldtainted = PL_tainted;
171 SvFLAGS(osv) |= (SvFLAGS(osv) &
172 (SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT;
173 PL_tainted = oldtainted;
175 mg_localize(osv, sv);
181 Perl_save_scalar(pTHX_ GV *gv)
184 SV ** const sptr = &GvSVn(gv);
189 SSPUSHPTR(SvREFCNT_inc_simple(gv));
190 SSPUSHPTR(SvREFCNT_inc(*sptr));
192 return save_scalar_at(sptr);
195 /* Like save_sptr(), but also SvREFCNT_dec()s the new value. Can be used to
196 * restore a global SV to its prior contents, freeing new value. */
198 Perl_save_generic_svref(pTHX_ SV **sptr)
203 SSPUSHPTR(SvREFCNT_inc(*sptr));
204 SSPUSHINT(SAVEt_GENERIC_SVREF);
207 /* Like save_pptr(), but also Safefree()s the new value if it is different
208 * from the old one. Can be used to restore a global char* to its prior
209 * contents, freeing new value. */
211 Perl_save_generic_pvref(pTHX_ char **str)
217 SSPUSHINT(SAVEt_GENERIC_PVREF);
220 /* Like save_generic_pvref(), but uses PerlMemShared_free() rather than Safefree().
221 * Can be used to restore a shared global char* to its prior
222 * contents, freeing new value. */
224 Perl_save_shared_pvref(pTHX_ char **str)
230 SSPUSHINT(SAVEt_SHARED_PVREF);
233 /* set the SvFLAGS specified by mask to the values in val */
236 Perl_save_set_svflags(pTHX_ SV* sv, U32 mask, U32 val)
243 SSPUSHINT(SAVEt_SET_SVFLAGS);
247 Perl_save_gp(pTHX_ GV *gv, I32 empty)
251 SSPUSHPTR(SvREFCNT_inc(gv));
256 GP *gp = Perl_newGP(aTHX_ gv);
259 mro_method_changed_in(GvSTASH(gv)); /* taking a method out of circulation ("local")*/
260 if (GvIOp(gv) && (IoFLAGS(GvIOp(gv)) & IOf_ARGV)) {
262 IoFLAGS(gp->gp_io) |= IOf_ARGV|IOf_START;
264 #ifdef PERL_DONT_CREATE_GVSV
265 if (gv == PL_errgv) {
266 /* We could scatter this logic everywhere by changing the
267 definition of ERRSV from GvSV() to GvSVn(), but it seems more
268 efficient to do this check once here. */
269 gp->gp_sv = newSV(0);
281 Perl_save_ary(pTHX_ GV *gv)
284 AV * const oav = GvAVn(gv);
287 if (!AvREAL(oav) && AvREIFY(oav))
297 mg_localize((SV*)oav, (SV*)av);
302 Perl_save_hash(pTHX_ GV *gv)
309 SSPUSHPTR(ohv = GvHVn(gv));
315 mg_localize((SV*)ohv, (SV*)hv);
320 Perl_save_item(pTHX_ register SV *item)
323 register SV * const sv = newSVsv(item);
326 SSPUSHPTR(item); /* remember the pointer */
327 SSPUSHPTR(sv); /* remember the value */
328 SSPUSHINT(SAVEt_ITEM);
332 Perl_save_int(pTHX_ int *intp)
338 SSPUSHINT(SAVEt_INT);
342 Perl_save_bool(pTHX_ bool *boolp)
348 SSPUSHINT(SAVEt_BOOL);
352 Perl_save_I8(pTHX_ I8 *bytep)
362 Perl_save_I16(pTHX_ I16 *intp)
368 SSPUSHINT(SAVEt_I16);
372 Perl_save_I32(pTHX_ I32 *intp)
378 SSPUSHINT(SAVEt_I32);
381 /* Cannot use save_sptr() to store a char* since the SV** cast will
382 * force word-alignment and we'll miss the pointer.
385 Perl_save_pptr(pTHX_ char **pptr)
391 SSPUSHINT(SAVEt_PPTR);
395 Perl_save_vptr(pTHX_ void *ptr)
399 SSPUSHPTR(*(char**)ptr);
401 SSPUSHINT(SAVEt_VPTR);
405 Perl_save_sptr(pTHX_ SV **sptr)
411 SSPUSHINT(SAVEt_SPTR);
415 Perl_save_padsv(pTHX_ PADOFFSET off)
419 ASSERT_CURPAD_ACTIVE("save_padsv");
420 SSPUSHPTR(PL_curpad[off]);
421 SSPUSHPTR(PL_comppad);
422 SSPUSHLONG((long)off);
423 SSPUSHINT(SAVEt_PADSV);
427 Perl_save_hptr(pTHX_ HV **hptr)
433 SSPUSHINT(SAVEt_HPTR);
437 Perl_save_aptr(pTHX_ AV **aptr)
443 SSPUSHINT(SAVEt_APTR);
447 Perl_save_freesv(pTHX_ SV *sv)
452 SSPUSHINT(SAVEt_FREESV);
456 Perl_save_mortalizesv(pTHX_ SV *sv)
461 SSPUSHINT(SAVEt_MORTALIZESV);
465 Perl_save_freeop(pTHX_ OP *o)
470 SSPUSHINT(SAVEt_FREEOP);
474 Perl_save_freepv(pTHX_ char *pv)
479 SSPUSHINT(SAVEt_FREEPV);
483 Perl_save_clearsv(pTHX_ SV **svp)
486 ASSERT_CURPAD_ACTIVE("save_clearsv");
488 SSPUSHLONG((long)(svp-PL_curpad));
489 SSPUSHINT(SAVEt_CLEARSV);
490 SvPADSTALE_off(*svp); /* mark lexical as active */
494 Perl_save_delete(pTHX_ HV *hv, char *key, I32 klen)
500 SSPUSHPTR(SvREFCNT_inc_simple(hv));
501 SSPUSHINT(SAVEt_DELETE);
505 Perl_save_destructor(pTHX_ DESTRUCTORFUNC_NOCONTEXT_t f, void* p)
511 SSPUSHINT(SAVEt_DESTRUCTOR);
515 Perl_save_destructor_x(pTHX_ DESTRUCTORFUNC_t f, void* p)
521 SSPUSHINT(SAVEt_DESTRUCTOR_X);
525 Perl_save_aelem(pTHX_ AV *av, I32 idx, SV **sptr)
531 SSPUSHPTR(SvREFCNT_inc_simple(av));
533 SSPUSHPTR(SvREFCNT_inc(*sptr));
534 SSPUSHINT(SAVEt_AELEM);
535 /* if it gets reified later, the restore will have the wrong refcnt */
536 if (!AvREAL(av) && AvREIFY(av))
537 SvREFCNT_inc_void(*sptr);
538 save_scalar_at(sptr);
540 /* If we're localizing a tied array element, this new sv
541 * won't actually be stored in the array - so it won't get
542 * reaped when the localize ends. Ensure it gets reaped by
543 * mortifying it instead. DAPM */
544 if (SvTIED_mg(sv, PERL_MAGIC_tiedelem))
549 Perl_save_helem(pTHX_ HV *hv, SV *key, SV **sptr)
555 SSPUSHPTR(SvREFCNT_inc_simple(hv));
556 SSPUSHPTR(newSVsv(key));
557 SSPUSHPTR(SvREFCNT_inc(*sptr));
558 SSPUSHINT(SAVEt_HELEM);
559 save_scalar_at(sptr);
561 /* If we're localizing a tied hash element, this new sv
562 * won't actually be stored in the hash - so it won't get
563 * reaped when the localize ends. Ensure it gets reaped by
564 * mortifying it instead. DAPM */
565 if (SvTIED_mg(sv, PERL_MAGIC_tiedelem))
570 Perl_save_svref(pTHX_ SV **sptr)
576 SSPUSHPTR(SvREFCNT_inc(*sptr));
577 SSPUSHINT(SAVEt_SVREF);
578 return save_scalar_at(sptr);
591 Perl_save_alloc(pTHX_ I32 size, I32 pad)
594 register const I32 start = pad + ((char*)&PL_savestack[PL_savestack_ix]
595 - (char*)PL_savestack);
596 register const I32 elems = 1 + ((size + pad - 1) / sizeof(*PL_savestack));
600 PL_savestack_ix += elems;
602 SSPUSHINT(SAVEt_ALLOC);
607 Perl_leave_scope(pTHX_ I32 base)
620 Perl_croak(aTHX_ "panic: corrupt saved stack index");
621 while (PL_savestack_ix > base) {
623 case SAVEt_ITEM: /* normal string */
624 value = (SV*)SSPOPPTR;
626 sv_replace(sv,value);
631 case SAVEt_SV: /* scalar reference */
632 value = (SV*)SSPOPPTR;
635 av = (AV*)gv; /* what to refcnt_dec */
638 DEBUG_S(PerlIO_printf(Perl_debug_log,
639 "restore svref: %p %p:%s -> %p:%s\n",
640 (void*)ptr, (void*)sv, SvPEEK(sv),
641 (void*)value, SvPEEK(value)));
648 if (av) /* actually an av, hv or gv */
651 case SAVEt_GENERIC_PVREF: /* generic pv */
653 str = (char*)SSPOPPTR;
654 if (*(char**)ptr != str) {
655 Safefree(*(char**)ptr);
659 case SAVEt_SHARED_PVREF: /* shared pv */
660 str = (char*)SSPOPPTR;
662 if (*(char**)ptr != str) {
664 PerlMem_free(*(char**)ptr);
666 PerlMemShared_free(*(char**)ptr);
671 case SAVEt_GENERIC_SVREF: /* generic sv */
672 value = (SV*)SSPOPPTR;
679 case SAVEt_AV: /* array reference */
683 AV * const goner = GvAV(gv);
684 /* FIXME - this is a temporary hack until we work out what
685 the correct behaviour for magic should be. */
686 sv_unmagic((SV*)goner, PERL_MAGIC_arylen_p);
687 SvMAGIC_set(av, SvMAGIC(goner));
688 SvFLAGS((SV*)av) |= SvMAGICAL(goner);
689 SvMAGICAL_off(goner);
690 SvMAGIC_set(goner, NULL);
700 case SAVEt_HV: /* hash reference */
704 HV * const goner = GvHV(gv);
705 SvMAGIC_set(hv, SvMAGIC(goner));
706 SvFLAGS(hv) |= SvMAGICAL(goner);
707 SvMAGICAL_off(goner);
708 SvMAGIC_set(goner, NULL);
718 case SAVEt_INT: /* int reference */
720 *(int*)ptr = (int)SSPOPINT;
722 case SAVEt_BOOL: /* bool reference */
724 *(bool*)ptr = (bool)SSPOPBOOL;
726 case SAVEt_I32: /* I32 reference */
728 #ifdef PERL_DEBUG_READONLY_OPS
730 const I32 val = SSPOPINT;
731 if (*(I32*)ptr != val)
735 *(I32*)ptr = (I32)SSPOPINT;
738 case SAVEt_SPTR: /* SV* reference */
740 *(SV**)ptr = (SV*)SSPOPPTR;
742 case SAVEt_VPTR: /* random* reference */
743 case SAVEt_PPTR: /* char* reference */
745 *(char**)ptr = (char*)SSPOPPTR;
747 case SAVEt_HPTR: /* HV* reference */
749 *(HV**)ptr = (HV*)SSPOPPTR;
751 case SAVEt_APTR: /* AV* reference */
753 *(AV**)ptr = (AV*)SSPOPPTR;
755 case SAVEt_GP: /* scalar reference */
760 /* putting a method back into circulation ("local")*/
761 if (GvCVu(gv) && (hv=GvSTASH(gv)) && HvNAME_get(hv))
762 mro_method_changed_in(hv);
767 SvREFCNT_dec((SV*)ptr);
769 case SAVEt_MORTALIZESV:
771 sv_2mortal((SV*)ptr);
775 ASSERT_CURPAD_LEGAL("SAVEt_FREEOP"); /* XXX DAPM tmp */
783 ptr = (void*)&PL_curpad[SSPOPLONG];
786 DEBUG_Xv(PerlIO_printf(Perl_debug_log,
787 "Pad 0x%"UVxf"[0x%"UVxf"] clearsv: %ld sv=0x%"UVxf"<%"IVdf"> %s\n",
788 PTR2UV(PL_comppad), PTR2UV(PL_curpad),
789 (long)((SV **)ptr-PL_curpad), PTR2UV(sv), (IV)SvREFCNT(sv),
790 (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) ? "clear" : "abandon"
793 /* Can clear pad variable in place? */
794 if (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) {
796 * if a my variable that was made readonly is going out of
797 * scope, we want to remove the readonlyness so that it can
798 * go out of scope quietly
800 if (SvPADMY(sv) && !SvFAKE(sv))
803 if (SvTHINKFIRST(sv))
804 sv_force_normal_flags(sv, SV_IMMEDIATE_UNREF);
808 switch (SvTYPE(sv)) {
818 Perl_croak(aTHX_ "panic: leave_scope pad code");
823 SvPADSTALE_on(sv); /* mark as no longer live */
825 else { /* Someone has a claim on this, so abandon it. */
826 const U32 padflags = SvFLAGS(sv) & (SVs_PADMY|SVs_PADTMP);
827 switch (SvTYPE(sv)) { /* Console ourselves with a new value */
828 case SVt_PVAV: *(SV**)ptr = (SV*)newAV(); break;
829 case SVt_PVHV: *(SV**)ptr = (SV*)newHV(); break;
830 default: *(SV**)ptr = newSV(0); break;
832 SvREFCNT_dec(sv); /* Cast current value to the winds. */
833 /* preserve pad nature, but also mark as not live
834 * for any closure capturing */
835 SvFLAGS(*(SV**)ptr) |= padflags | SVs_PADSTALE;
842 (void)hv_delete(hv, (char*)ptr, (I32)SSPOPINT, G_DISCARD);
846 case SAVEt_DESTRUCTOR_X:
848 (*SSPOPDXPTR)(aTHX_ ptr);
850 case SAVEt_REGCONTEXT:
853 PL_savestack_ix -= i; /* regexp must have croaked */
855 case SAVEt_STACK_POS: /* Position on Perl stack */
857 PL_stack_sp = PL_stack_base + i;
859 case SAVEt_STACK_CXPOS: /* blk_oldsp on context stack */
861 cxstack[i].blk_oldsp = SSPOPINT;
863 case SAVEt_AELEM: /* array element */
864 value = (SV*)SSPOPPTR;
867 ptr = av_fetch(av,i,1);
868 if (!AvREAL(av) && AvREIFY(av)) /* undo reify guard */
872 if (sv && sv != &PL_sv_undef) {
873 if (SvTIED_mg((SV*)av, PERL_MAGIC_tied))
874 SvREFCNT_inc_void_NN(sv);
881 case SAVEt_HELEM: /* hash element */
882 value = (SV*)SSPOPPTR;
885 ptr = hv_fetch_ent(hv, sv, 1, 0);
887 const SV * const oval = HeVAL((HE*)ptr);
888 if (oval && oval != &PL_sv_undef) {
889 ptr = &HeVAL((HE*)ptr);
890 if (SvTIED_mg((SV*)hv, PERL_MAGIC_tied))
891 SvREFCNT_inc_void(*(SV**)ptr);
893 av = (AV*)hv; /* what to refcnt_dec */
902 PL_op = (OP*)SSPOPPTR;
905 if ((PL_hints & HINT_LOCALIZE_HH) && GvHV(PL_hintgv)) {
906 SvREFCNT_dec((SV*)GvHV(PL_hintgv));
907 GvHV(PL_hintgv) = NULL;
909 *(I32*)&PL_hints = (I32)SSPOPINT;
910 Perl_refcounted_he_free(aTHX_ PL_compiling.cop_hints_hash);
911 PL_compiling.cop_hints_hash = (struct refcounted_he *) SSPOPPTR;
912 if (PL_hints & HINT_LOCALIZE_HH) {
913 SvREFCNT_dec((SV*)GvHV(PL_hintgv));
914 GvHV(PL_hintgv) = (HV*)SSPOPPTR;
915 assert(GvHV(PL_hintgv));
916 } else if (!GvHV(PL_hintgv)) {
917 /* Need to add a new one manually, else gv_fetchpv() can
918 add one in this code:
920 if (SvTYPE(gv) == SVt_PVGV) {
923 gv_init_sv(gv, sv_type);
924 if (*name=='!' && sv_type == SVt_PVHV && len==1)
930 and it won't have the magic set. */
932 HV *const hv = newHV();
933 hv_magic(hv, NULL, PERL_MAGIC_hints);
934 GvHV(PL_hintgv) = hv;
936 assert(GvHV(PL_hintgv));
939 PL_comppad = (PAD*)SSPOPPTR;
941 PL_curpad = AvARRAY(PL_comppad);
947 const PADOFFSET off = (PADOFFSET)SSPOPLONG;
950 AvARRAY((PAD*)ptr)[off] = (SV*)SSPOPPTR;
953 case SAVEt_SAVESWITCHSTACK:
956 AV* const t = (AV*)SSPOPPTR;
957 AV* const f = (AV*)SSPOPPTR;
959 PL_curstackinfo->si_stack = f;
962 case SAVEt_SET_SVFLAGS:
964 const U32 val = (U32)SSPOPINT;
965 const U32 mask = (U32)SSPOPINT;
967 SvFLAGS(sv) &= ~mask;
971 /* These are only saved in mathoms.c */
972 case SAVEt_SVREF: /* scalar reference */
973 value = (SV*)SSPOPPTR;
975 av = NULL; /* what to refcnt_dec */
977 case SAVEt_LONG: /* long reference */
979 *(long*)ptr = (long)SSPOPLONG;
981 case SAVEt_I16: /* I16 reference */
983 *(I16*)ptr = (I16)SSPOPINT;
985 case SAVEt_I8: /* I8 reference */
987 *(I8*)ptr = (I8)SSPOPINT;
989 case SAVEt_IV: /* IV reference */
991 *(IV*)ptr = (IV)SSPOPIV;
995 (void)sv_clear((SV*)gv);
997 case SAVEt_DESTRUCTOR:
1001 case SAVEt_COP_ARYBASE:
1004 CopARYBASE_set((COP *)ptr, i);
1006 case SAVEt_COMPILE_WARNINGS:
1009 if (!specialWARN(PL_compiling.cop_warnings))
1010 PerlMemShared_free(PL_compiling.cop_warnings);
1012 PL_compiling.cop_warnings = (STRLEN*)ptr;
1014 case SAVEt_RE_STATE:
1016 const struct re_save_state *const state
1017 = (struct re_save_state *)
1018 (PL_savestack + PL_savestack_ix
1019 - SAVESTACK_ALLOC_FOR_RE_SAVE_STATE);
1020 PL_savestack_ix -= SAVESTACK_ALLOC_FOR_RE_SAVE_STATE;
1022 if (PL_reg_start_tmp != state->re_state_reg_start_tmp) {
1023 Safefree(PL_reg_start_tmp);
1025 if (PL_reg_poscache != state->re_state_reg_poscache) {
1026 Safefree(PL_reg_poscache);
1028 Copy(state, &PL_reg_state, 1, struct re_save_state);
1033 parser_free((yy_parser *) ptr);
1036 Perl_croak(aTHX_ "panic: leave_scope inconsistency");
1042 Perl_cx_dump(pTHX_ PERL_CONTEXT *cx)
1046 PerlIO_printf(Perl_debug_log, "CX %ld = %s\n", (long)(cx - cxstack), PL_block_type[CxTYPE(cx)]);
1047 if (CxTYPE(cx) != CXt_SUBST) {
1048 PerlIO_printf(Perl_debug_log, "BLK_OLDSP = %ld\n", (long)cx->blk_oldsp);
1049 PerlIO_printf(Perl_debug_log, "BLK_OLDCOP = 0x%"UVxf"\n",
1050 PTR2UV(cx->blk_oldcop));
1051 PerlIO_printf(Perl_debug_log, "BLK_OLDMARKSP = %ld\n", (long)cx->blk_oldmarksp);
1052 PerlIO_printf(Perl_debug_log, "BLK_OLDSCOPESP = %ld\n", (long)cx->blk_oldscopesp);
1053 PerlIO_printf(Perl_debug_log, "BLK_OLDPM = 0x%"UVxf"\n",
1054 PTR2UV(cx->blk_oldpm));
1055 PerlIO_printf(Perl_debug_log, "BLK_GIMME = %s\n", cx->blk_gimme ? "LIST" : "SCALAR");
1057 switch (CxTYPE(cx)) {
1062 PerlIO_printf(Perl_debug_log, "BLK_SUB.CV = 0x%"UVxf"\n",
1063 PTR2UV(cx->blk_sub.cv));
1064 PerlIO_printf(Perl_debug_log, "BLK_SUB.GV = 0x%"UVxf"\n",
1065 PTR2UV(cx->blk_sub.gv));
1066 PerlIO_printf(Perl_debug_log, "BLK_SUB.DFOUTGV = 0x%"UVxf"\n",
1067 PTR2UV(cx->blk_sub.dfoutgv));
1068 PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n",
1069 (int)cx->blk_sub.hasargs);
1070 PerlIO_printf(Perl_debug_log, "BLK_SUB.RETOP = 0x%"UVxf"\n",
1071 PTR2UV(cx->blk_sub.retop));
1074 PerlIO_printf(Perl_debug_log, "BLK_SUB.CV = 0x%"UVxf"\n",
1075 PTR2UV(cx->blk_sub.cv));
1076 PerlIO_printf(Perl_debug_log, "BLK_SUB.OLDDEPTH = %ld\n",
1077 (long)cx->blk_sub.olddepth);
1078 PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n",
1079 (int)cx->blk_sub.hasargs);
1080 PerlIO_printf(Perl_debug_log, "BLK_SUB.LVAL = %d\n",
1081 (int)cx->blk_sub.lval);
1082 PerlIO_printf(Perl_debug_log, "BLK_SUB.RETOP = 0x%"UVxf"\n",
1083 PTR2UV(cx->blk_sub.retop));
1086 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_IN_EVAL = %ld\n",
1087 (long)cx->blk_eval.old_in_eval);
1088 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_OP_TYPE = %s (%s)\n",
1089 PL_op_name[cx->blk_eval.old_op_type],
1090 PL_op_desc[cx->blk_eval.old_op_type]);
1091 if (cx->blk_eval.old_namesv)
1092 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_NAME = %s\n",
1093 SvPVX_const(cx->blk_eval.old_namesv));
1094 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_EVAL_ROOT = 0x%"UVxf"\n",
1095 PTR2UV(cx->blk_eval.old_eval_root));
1096 PerlIO_printf(Perl_debug_log, "BLK_EVAL.RETOP = 0x%"UVxf"\n",
1097 PTR2UV(cx->blk_eval.retop));
1101 PerlIO_printf(Perl_debug_log, "BLK_LOOP.LABEL = %s\n",
1102 cx->blk_loop.label);
1103 PerlIO_printf(Perl_debug_log, "BLK_LOOP.RESETSP = %ld\n",
1104 (long)cx->blk_loop.resetsp);
1105 PerlIO_printf(Perl_debug_log, "BLK_LOOP.MY_OP = 0x%"UVxf"\n",
1106 PTR2UV(cx->blk_loop.my_op));
1107 PerlIO_printf(Perl_debug_log, "BLK_LOOP.NEXT_OP = 0x%"UVxf"\n",
1108 PTR2UV(CX_LOOP_NEXTOP_GET(cx)));
1109 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERIX = %ld\n",
1110 (long)cx->blk_loop.iterix);
1111 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERARY = 0x%"UVxf"\n",
1112 PTR2UV(cx->blk_loop.iterary));
1113 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERVAR = 0x%"UVxf"\n",
1114 PTR2UV(CxITERVAR(cx)));
1116 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERSAVE = 0x%"UVxf"\n",
1117 PTR2UV(cx->blk_loop.itersave));
1118 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERLVAL = 0x%"UVxf"\n",
1119 PTR2UV(cx->blk_loop.iterlval));
1123 PerlIO_printf(Perl_debug_log, "SB_ITERS = %ld\n",
1124 (long)cx->sb_iters);
1125 PerlIO_printf(Perl_debug_log, "SB_MAXITERS = %ld\n",
1126 (long)cx->sb_maxiters);
1127 PerlIO_printf(Perl_debug_log, "SB_RFLAGS = %ld\n",
1128 (long)cx->sb_rflags);
1129 PerlIO_printf(Perl_debug_log, "SB_ONCE = %ld\n",
1131 PerlIO_printf(Perl_debug_log, "SB_ORIG = %s\n",
1133 PerlIO_printf(Perl_debug_log, "SB_DSTR = 0x%"UVxf"\n",
1134 PTR2UV(cx->sb_dstr));
1135 PerlIO_printf(Perl_debug_log, "SB_TARG = 0x%"UVxf"\n",
1136 PTR2UV(cx->sb_targ));
1137 PerlIO_printf(Perl_debug_log, "SB_S = 0x%"UVxf"\n",
1139 PerlIO_printf(Perl_debug_log, "SB_M = 0x%"UVxf"\n",
1141 PerlIO_printf(Perl_debug_log, "SB_STREND = 0x%"UVxf"\n",
1142 PTR2UV(cx->sb_strend));
1143 PerlIO_printf(Perl_debug_log, "SB_RXRES = 0x%"UVxf"\n",
1144 PTR2UV(cx->sb_rxres));
1148 PERL_UNUSED_CONTEXT;
1149 PERL_UNUSED_ARG(cx);
1150 #endif /* DEBUGGING */
1155 * c-indentation-style: bsd
1157 * indent-tabs-mode: t
1160 * ex: set ts=8 sts=4 sw=4 noet: