3 * Copyright (c) 1991-2003, Larry Wall
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.
11 * "For the fashion of Minas Tirith was such that it was built on seven
16 #define PERL_IN_SCOPE_C
19 #if defined(PERL_FLEXIBLE_EXCEPTIONS)
21 Perl_default_protect(pTHX_ volatile JMPENV *pcur_env, int *excpt,
22 protect_body_t body, ...)
27 ret = vdefault_protect(pcur_env, excpt, body, &args);
33 Perl_vdefault_protect(pTHX_ volatile JMPENV *pcur_env, int *excpt,
34 protect_body_t body, va_list *args)
43 ret = CALL_FPTR(body)(aTHX_ *args);
51 Perl_stack_grow(pTHX_ SV **sp, SV **p, int n)
54 #ifndef STRESS_REALLOC
55 av_extend(PL_curstack, (p - PL_stack_base) + (n) + 128);
57 av_extend(PL_curstack, (p - PL_stack_base) + (n) + 1);
62 #ifndef STRESS_REALLOC
63 #define GROW(old) ((old) * 3 / 2)
65 #define GROW(old) ((old) + 1)
69 Perl_new_stackinfo(pTHX_ I32 stitems, I32 cxitems)
72 New(56, si, 1, PERL_SI);
73 si->si_stack = newAV();
74 AvREAL_off(si->si_stack);
75 av_extend(si->si_stack, stitems > 0 ? stitems-1 : 0);
76 AvALLOC(si->si_stack)[0] = &PL_sv_undef;
77 AvFILLp(si->si_stack) = 0;
80 si->si_cxmax = cxitems - 1;
82 si->si_type = PERLSI_UNDEF;
83 New(56, si->si_cxstack, cxitems, PERL_CONTEXT);
84 /* Without any kind of initialising PUSHSUBST()
85 * in pp_subst() will read uninitialised heap. */
86 Poison(si->si_cxstack, cxitems, PERL_CONTEXT);
93 IV old_max = cxstack_max;
94 cxstack_max = GROW(cxstack_max);
95 Renew(cxstack, cxstack_max + 1, PERL_CONTEXT); /* XXX should fix CXINC macro */
96 /* Without any kind of initialising deep enough recursion
97 * will end up reading uninitialised PERL_CONTEXTs. */
98 Poison(cxstack + old_max + 1, cxstack_max - old_max, PERL_CONTEXT);
99 return cxstack_ix + 1;
103 Perl_push_return(pTHX_ OP *retop)
105 if (PL_retstack_ix == PL_retstack_max) {
106 PL_retstack_max = GROW(PL_retstack_max);
107 Renew(PL_retstack, PL_retstack_max, OP*);
109 PL_retstack[PL_retstack_ix++] = retop;
113 Perl_pop_return(pTHX)
115 if (PL_retstack_ix > 0)
116 return PL_retstack[--PL_retstack_ix];
122 Perl_push_scope(pTHX)
124 if (PL_scopestack_ix == PL_scopestack_max) {
125 PL_scopestack_max = GROW(PL_scopestack_max);
126 Renew(PL_scopestack, PL_scopestack_max, I32);
128 PL_scopestack[PL_scopestack_ix++] = PL_savestack_ix;
135 I32 oldsave = PL_scopestack[--PL_scopestack_ix];
136 LEAVE_SCOPE(oldsave);
140 Perl_markstack_grow(pTHX)
142 I32 oldmax = PL_markstack_max - PL_markstack;
143 I32 newmax = GROW(oldmax);
145 Renew(PL_markstack, newmax, I32);
146 PL_markstack_ptr = PL_markstack + oldmax;
147 PL_markstack_max = PL_markstack + newmax;
151 Perl_savestack_grow(pTHX)
153 PL_savestack_max = GROW(PL_savestack_max) + 4;
154 Renew(PL_savestack, PL_savestack_max, ANY);
160 Perl_tmps_grow(pTHX_ I32 n)
162 #ifndef STRESS_REALLOC
164 n = (PL_tmps_max < 512) ? 128 : 512;
166 PL_tmps_max = PL_tmps_ix + n + 1;
167 Renew(PL_tmps_stack, PL_tmps_max, SV*);
174 /* XXX should tmps_floor live in cxstack? */
175 I32 myfloor = PL_tmps_floor;
176 while (PL_tmps_ix > myfloor) { /* clean up after last statement */
177 SV* sv = PL_tmps_stack[PL_tmps_ix];
178 PL_tmps_stack[PL_tmps_ix--] = Nullsv;
179 if (sv && sv != &PL_sv_undef) {
181 SvREFCNT_dec(sv); /* note, can modify tmps_ix!!! */
187 S_save_scalar_at(pTHX_ SV **sptr)
192 sv = *sptr = NEWSV(0,0);
193 if (SvTYPE(osv) >= SVt_PVMG && SvMAGIC(osv) && SvTYPE(osv) != SVt_PVGV) {
194 sv_upgrade(sv, SvTYPE(osv));
195 if (SvGMAGICAL(osv)) {
197 bool oldtainted = PL_tainted;
198 mg_get(osv); /* note, can croak! */
199 if (PL_tainting && PL_tainted &&
200 (mg = mg_find(osv, PERL_MAGIC_taint))) {
201 SAVESPTR(mg->mg_obj);
204 SvFLAGS(osv) |= (SvFLAGS(osv) &
205 (SVp_NOK|SVp_POK)) >> PRIVSHIFT;
206 PL_tainted = oldtainted;
208 SvMAGIC(sv) = SvMAGIC(osv);
209 SvFLAGS(sv) |= SvMAGICAL(osv);
210 /* XXX SvMAGIC() is *shared* between osv and sv. This can
211 * lead to coredumps when both SVs are destroyed without one
212 * of their SvMAGIC() slots being NULLed. */
221 Perl_save_scalar(pTHX_ GV *gv)
223 SV **sptr = &GvSV(gv);
225 SSPUSHPTR(SvREFCNT_inc(gv));
226 SSPUSHPTR(SvREFCNT_inc(*sptr));
228 return save_scalar_at(sptr);
232 Perl_save_svref(pTHX_ SV **sptr)
236 SSPUSHPTR(SvREFCNT_inc(*sptr));
237 SSPUSHINT(SAVEt_SVREF);
238 return save_scalar_at(sptr);
241 /* Like save_sptr(), but also SvREFCNT_dec()s the new value. Can be used to
242 * restore a global SV to its prior contents, freeing new value. */
244 Perl_save_generic_svref(pTHX_ SV **sptr)
248 SSPUSHPTR(SvREFCNT_inc(*sptr));
249 SSPUSHINT(SAVEt_GENERIC_SVREF);
252 /* Like save_pptr(), but also Safefree()s the new value if it is different
253 * from the old one. Can be used to restore a global char* to its prior
254 * contents, freeing new value. */
256 Perl_save_generic_pvref(pTHX_ char **str)
261 SSPUSHINT(SAVEt_GENERIC_PVREF);
264 /* Like save_generic_pvref(), but uses PerlMemShared_free() rather than Safefree().
265 * Can be used to restore a shared global char* to its prior
266 * contents, freeing new value. */
268 Perl_save_shared_pvref(pTHX_ char **str)
273 SSPUSHINT(SAVEt_SHARED_PVREF);
277 Perl_save_gp(pTHX_ GV *gv, I32 empty)
280 SSPUSHIV((IV)SvLEN(gv));
281 SvLEN(gv) = 0; /* forget that anything was allocated here */
282 SSPUSHIV((IV)SvCUR(gv));
283 SSPUSHPTR(SvPVX(gv));
285 SSPUSHPTR(SvREFCNT_inc(gv));
292 Newz(602, gp, 1, GP);
295 PL_sub_generation++; /* taking a method out of circulation */
296 if (GvIOp(gv) && (IoFLAGS(GvIOp(gv)) & IOf_ARGV)) {
298 IoFLAGS(gp->gp_io) |= IOf_ARGV|IOf_START;
300 GvGP(gv) = gp_ref(gp);
301 GvSV(gv) = NEWSV(72,0);
302 GvLINE(gv) = CopLINE(PL_curcop);
303 GvFILE(gv) = CopFILE(PL_curcop) ? CopFILE(PL_curcop) : "";
313 Perl_save_ary(pTHX_ GV *gv)
318 if (!AvREAL(oav) && AvREIFY(oav))
325 GvAV(gv) = Null(AV*);
328 SvMAGIC(av) = SvMAGIC(oav);
329 SvFLAGS((SV*)av) |= SvMAGICAL(oav);
340 Perl_save_hash(pTHX_ GV *gv)
346 SSPUSHPTR(ohv = GvHVn(gv));
349 GvHV(gv) = Null(HV*);
352 SvMAGIC(hv) = SvMAGIC(ohv);
353 SvFLAGS((SV*)hv) |= SvMAGICAL(ohv);
364 Perl_save_item(pTHX_ register SV *item)
366 register SV *sv = NEWSV(0,0);
370 SSPUSHPTR(item); /* remember the pointer */
371 SSPUSHPTR(sv); /* remember the value */
372 SSPUSHINT(SAVEt_ITEM);
376 Perl_save_int(pTHX_ int *intp)
381 SSPUSHINT(SAVEt_INT);
385 Perl_save_long(pTHX_ long int *longp)
390 SSPUSHINT(SAVEt_LONG);
394 Perl_save_bool(pTHX_ bool *boolp)
399 SSPUSHINT(SAVEt_BOOL);
403 Perl_save_I32(pTHX_ I32 *intp)
408 SSPUSHINT(SAVEt_I32);
412 Perl_save_I16(pTHX_ I16 *intp)
417 SSPUSHINT(SAVEt_I16);
421 Perl_save_I8(pTHX_ I8 *bytep)
430 Perl_save_iv(pTHX_ IV *ivp)
438 /* Cannot use save_sptr() to store a char* since the SV** cast will
439 * force word-alignment and we'll miss the pointer.
442 Perl_save_pptr(pTHX_ char **pptr)
447 SSPUSHINT(SAVEt_PPTR);
451 Perl_save_vptr(pTHX_ void *ptr)
454 SSPUSHPTR(*(char**)ptr);
456 SSPUSHINT(SAVEt_VPTR);
460 Perl_save_sptr(pTHX_ SV **sptr)
465 SSPUSHINT(SAVEt_SPTR);
469 Perl_save_padsv(pTHX_ PADOFFSET off)
472 ASSERT_CURPAD_ACTIVE("save_padsv");
473 SSPUSHPTR(PL_curpad[off]);
474 SSPUSHPTR(PL_comppad);
475 SSPUSHLONG((long)off);
476 SSPUSHINT(SAVEt_PADSV);
480 Perl_save_threadsv(pTHX_ PADOFFSET i)
482 Perl_croak(aTHX_ "panic: save_threadsv called in non-threaded perl");
487 Perl_save_nogv(pTHX_ GV *gv)
491 SSPUSHINT(SAVEt_NSTAB);
495 Perl_save_hptr(pTHX_ HV **hptr)
500 SSPUSHINT(SAVEt_HPTR);
504 Perl_save_aptr(pTHX_ AV **aptr)
509 SSPUSHINT(SAVEt_APTR);
513 Perl_save_freesv(pTHX_ SV *sv)
517 SSPUSHINT(SAVEt_FREESV);
521 Perl_save_mortalizesv(pTHX_ SV *sv)
525 SSPUSHINT(SAVEt_MORTALIZESV);
529 Perl_save_freeop(pTHX_ OP *o)
533 SSPUSHINT(SAVEt_FREEOP);
537 Perl_save_freepv(pTHX_ char *pv)
541 SSPUSHINT(SAVEt_FREEPV);
545 Perl_save_clearsv(pTHX_ SV **svp)
547 ASSERT_CURPAD_ACTIVE("save_clearsv");
549 SSPUSHLONG((long)(svp-PL_curpad));
550 SSPUSHINT(SAVEt_CLEARSV);
551 SvPADSTALE_off(*svp); /* mark lexical as active */
555 Perl_save_delete(pTHX_ HV *hv, char *key, I32 klen)
560 SSPUSHPTR(SvREFCNT_inc(hv));
561 SSPUSHINT(SAVEt_DELETE);
565 Perl_save_list(pTHX_ register SV **sarg, I32 maxsarg)
570 for (i = 1; i <= maxsarg; i++) {
572 sv_setsv(sv,sarg[i]);
574 SSPUSHPTR(sarg[i]); /* remember the pointer */
575 SSPUSHPTR(sv); /* remember the value */
576 SSPUSHINT(SAVEt_ITEM);
581 Perl_save_destructor(pTHX_ DESTRUCTORFUNC_NOCONTEXT_t f, void* p)
586 SSPUSHINT(SAVEt_DESTRUCTOR);
590 Perl_save_destructor_x(pTHX_ DESTRUCTORFUNC_t f, void* p)
595 SSPUSHINT(SAVEt_DESTRUCTOR_X);
599 Perl_save_aelem(pTHX_ AV *av, I32 idx, SV **sptr)
603 SSPUSHPTR(SvREFCNT_inc(av));
605 SSPUSHPTR(SvREFCNT_inc(*sptr));
606 SSPUSHINT(SAVEt_AELEM);
607 /* if it gets reified later, the restore will have the wrong refcnt */
608 if (!AvREAL(av) && AvREIFY(av))
610 save_scalar_at(sptr);
612 /* If we're localizing a tied array element, this new sv
613 * won't actually be stored in the array - so it won't get
614 * reaped when the localize ends. Ensure it gets reaped by
615 * mortifying it instead. DAPM */
616 if (SvTIED_mg(sv, PERL_MAGIC_tiedelem))
621 Perl_save_helem(pTHX_ HV *hv, SV *key, SV **sptr)
625 SSPUSHPTR(SvREFCNT_inc(hv));
626 SSPUSHPTR(SvREFCNT_inc(key));
627 SSPUSHPTR(SvREFCNT_inc(*sptr));
628 SSPUSHINT(SAVEt_HELEM);
629 save_scalar_at(sptr);
631 /* If we're localizing a tied hash element, this new sv
632 * won't actually be stored in the hash - so it won't get
633 * reaped when the localize ends. Ensure it gets reaped by
634 * mortifying it instead. DAPM */
635 if (SvTIED_mg(sv, PERL_MAGIC_tiedelem))
648 Perl_save_alloc(pTHX_ I32 size, I32 pad)
650 register I32 start = pad + ((char*)&PL_savestack[PL_savestack_ix]
651 - (char*)PL_savestack);
652 register I32 elems = 1 + ((size + pad - 1) / sizeof(*PL_savestack));
654 /* SSCHECK may not be good enough */
655 while (PL_savestack_ix + elems + 2 > PL_savestack_max)
658 PL_savestack_ix += elems;
660 SSPUSHINT(SAVEt_ALLOC);
665 Perl_leave_scope(pTHX_ I32 base)
677 Perl_croak(aTHX_ "panic: corrupt saved stack index");
678 while (PL_savestack_ix > base) {
680 case SAVEt_ITEM: /* normal string */
681 value = (SV*)SSPOPPTR;
683 sv_replace(sv,value);
688 case SAVEt_SV: /* scalar reference */
689 value = (SV*)SSPOPPTR;
692 av = (AV*)gv; /* what to refcnt_dec */
694 case SAVEt_GENERIC_PVREF: /* generic pv */
695 str = (char*)SSPOPPTR;
697 if (*(char**)ptr != str) {
698 Safefree(*(char**)ptr);
702 case SAVEt_SHARED_PVREF: /* shared pv */
703 str = (char*)SSPOPPTR;
705 if (*(char**)ptr != str) {
707 PerlMem_free(*(char**)ptr);
709 PerlMemShared_free(*(char**)ptr);
714 case SAVEt_GENERIC_SVREF: /* generic sv */
715 value = (SV*)SSPOPPTR;
722 case SAVEt_SVREF: /* scalar reference */
723 value = (SV*)SSPOPPTR;
725 av = Nullav; /* what to refcnt_dec */
728 DEBUG_S(PerlIO_printf(Perl_debug_log,
729 "restore svref: %p %p:%s -> %p:%s\n",
730 ptr, sv, SvPEEK(sv), value, SvPEEK(value)));
731 if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv) &&
732 SvTYPE(sv) != SVt_PVGV)
734 (void)SvUPGRADE(value, SvTYPE(sv));
735 SvMAGIC(value) = SvMAGIC(sv);
736 SvFLAGS(value) |= SvMAGICAL(sv);
740 /* XXX This branch is pretty bogus. This code irretrievably
741 * clears(!) the magic on the SV (either to avoid further
742 * croaking that might ensue when the SvSETMAGIC() below is
743 * called, or to avoid two different SVs pointing at the same
744 * SvMAGIC()). This needs a total rethink. --GSAR */
745 else if (SvTYPE(value) >= SVt_PVMG && SvMAGIC(value) &&
746 SvTYPE(value) != SVt_PVGV)
748 SvFLAGS(value) |= (SvFLAGS(value) &
749 (SVp_NOK|SVp_POK)) >> PRIVSHIFT;
750 SvMAGICAL_off(value);
751 /* XXX this is a leak when we get here because the
752 * mg_get() in save_scalar_at() croaked */
761 if (av) /* actually an av, hv or gv */
764 case SAVEt_AV: /* array reference */
768 AV *goner = GvAV(gv);
769 SvMAGIC(av) = SvMAGIC(goner);
770 SvFLAGS((SV*)av) |= SvMAGICAL(goner);
771 SvMAGICAL_off(goner);
782 case SAVEt_HV: /* hash reference */
786 HV *goner = GvHV(gv);
787 SvMAGIC(hv) = SvMAGIC(goner);
788 SvFLAGS(hv) |= SvMAGICAL(goner);
789 SvMAGICAL_off(goner);
800 case SAVEt_INT: /* int reference */
802 *(int*)ptr = (int)SSPOPINT;
804 case SAVEt_LONG: /* long reference */
806 *(long*)ptr = (long)SSPOPLONG;
808 case SAVEt_BOOL: /* bool reference */
810 *(bool*)ptr = (bool)SSPOPBOOL;
812 case SAVEt_I32: /* I32 reference */
814 *(I32*)ptr = (I32)SSPOPINT;
816 case SAVEt_I16: /* I16 reference */
818 *(I16*)ptr = (I16)SSPOPINT;
820 case SAVEt_I8: /* I8 reference */
822 *(I8*)ptr = (I8)SSPOPINT;
824 case SAVEt_IV: /* IV reference */
826 *(IV*)ptr = (IV)SSPOPIV;
828 case SAVEt_SPTR: /* SV* reference */
830 *(SV**)ptr = (SV*)SSPOPPTR;
832 case SAVEt_VPTR: /* random* reference */
833 case SAVEt_PPTR: /* char* reference */
835 *(char**)ptr = (char*)SSPOPPTR;
837 case SAVEt_HPTR: /* HV* reference */
839 *(HV**)ptr = (HV*)SSPOPPTR;
841 case SAVEt_APTR: /* AV* reference */
843 *(AV**)ptr = (AV*)SSPOPPTR;
847 (void)sv_clear((SV*)gv);
849 case SAVEt_GP: /* scalar reference */
852 if (SvPVX(gv) && SvLEN(gv) > 0) {
855 SvPVX(gv) = (char *)SSPOPPTR;
856 SvCUR(gv) = (STRLEN)SSPOPIV;
857 SvLEN(gv) = (STRLEN)SSPOPIV;
861 PL_sub_generation++; /* putting a method back into circulation */
866 SvREFCNT_dec((SV*)ptr);
868 case SAVEt_MORTALIZESV:
870 sv_2mortal((SV*)ptr);
874 ASSERT_CURPAD_LEGAL("SAVEt_FREEOP"); /* XXX DAPM tmp */
879 Safefree((char*)ptr);
882 ptr = (void*)&PL_curpad[SSPOPLONG];
885 DEBUG_Xv(PerlIO_printf(Perl_debug_log,
886 "Pad 0x%"UVxf"[0x%"UVxf"] clearsv: %ld sv=0x%"UVxf"<%"IVdf"> %s\n",
887 PTR2UV(PL_comppad), PTR2UV(PL_curpad),
888 (long)((SV **)ptr-PL_curpad), PTR2UV(sv), (IV)SvREFCNT(sv),
889 (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) ? "clear" : "abandon"
892 /* Can clear pad variable in place? */
893 if (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) {
895 * if a my variable that was made readonly is going out of
896 * scope, we want to remove the readonlyness so that it can
897 * go out of scope quietly
899 if (SvPADMY(sv) && !SvFAKE(sv))
902 if (SvTHINKFIRST(sv))
903 sv_force_normal_flags(sv, SV_IMMEDIATE_UNREF);
907 switch (SvTYPE(sv)) {
917 Perl_croak(aTHX_ "panic: leave_scope pad code");
928 SvPADSTALE_on(sv); /* mark as no longer live */
930 else { /* Someone has a claim on this, so abandon it. */
931 U32 padflags = SvFLAGS(sv) & (SVs_PADMY|SVs_PADTMP);
932 switch (SvTYPE(sv)) { /* Console ourselves with a new value */
933 case SVt_PVAV: *(SV**)ptr = (SV*)newAV(); break;
934 case SVt_PVHV: *(SV**)ptr = (SV*)newHV(); break;
935 default: *(SV**)ptr = NEWSV(0,0); break;
937 SvREFCNT_dec(sv); /* Cast current value to the winds. */
938 /* preserve pad nature, but also mark as not live
939 * for any closure capturing */
940 SvFLAGS(*(SV**)ptr) |= padflags & SVs_PADSTALE;
947 (void)hv_delete(hv, (char*)ptr, (U32)SSPOPINT, G_DISCARD);
951 case SAVEt_DESTRUCTOR:
955 case SAVEt_DESTRUCTOR_X:
957 (*SSPOPDXPTR)(aTHX_ ptr);
959 case SAVEt_REGCONTEXT:
962 PL_savestack_ix -= i; /* regexp must have croaked */
964 case SAVEt_STACK_POS: /* Position on Perl stack */
966 PL_stack_sp = PL_stack_base + i;
968 case SAVEt_AELEM: /* array element */
969 value = (SV*)SSPOPPTR;
972 if (!AvREAL(av) && AvREIFY(av)) /* undo reify guard */
974 ptr = av_fetch(av,i,1);
977 if (sv && sv != &PL_sv_undef) {
978 if (SvTIED_mg((SV*)av, PERL_MAGIC_tied))
979 (void)SvREFCNT_inc(sv);
986 case SAVEt_HELEM: /* hash element */
987 value = (SV*)SSPOPPTR;
990 ptr = hv_fetch_ent(hv, sv, 1, 0);
992 SV *oval = HeVAL((HE*)ptr);
993 if (oval && oval != &PL_sv_undef) {
994 ptr = &HeVAL((HE*)ptr);
995 if (SvTIED_mg((SV*)hv, PERL_MAGIC_tied))
996 (void)SvREFCNT_inc(*(SV**)ptr);
998 av = (AV*)hv; /* what to refcnt_dec */
1004 SvREFCNT_dec(value);
1007 PL_op = (OP*)SSPOPPTR;
1010 if ((PL_hints & HINT_LOCALIZE_HH) && GvHV(PL_hintgv)) {
1011 SvREFCNT_dec((SV*)GvHV(PL_hintgv));
1012 GvHV(PL_hintgv) = NULL;
1014 *(I32*)&PL_hints = (I32)SSPOPINT;
1017 PL_comppad = (PAD*)SSPOPPTR;
1019 PL_curpad = AvARRAY(PL_comppad);
1021 PL_curpad = Null(SV**);
1025 PADOFFSET off = (PADOFFSET)SSPOPLONG;
1028 AvARRAY((PAD*)ptr)[off] = (SV*)SSPOPPTR;
1032 Perl_croak(aTHX_ "panic: leave_scope inconsistency");
1038 Perl_cx_dump(pTHX_ PERL_CONTEXT *cx)
1041 PerlIO_printf(Perl_debug_log, "CX %ld = %s\n", (long)(cx - cxstack), PL_block_type[CxTYPE(cx)]);
1042 if (CxTYPE(cx) != CXt_SUBST) {
1043 PerlIO_printf(Perl_debug_log, "BLK_OLDSP = %ld\n", (long)cx->blk_oldsp);
1044 PerlIO_printf(Perl_debug_log, "BLK_OLDCOP = 0x%"UVxf"\n",
1045 PTR2UV(cx->blk_oldcop));
1046 PerlIO_printf(Perl_debug_log, "BLK_OLDMARKSP = %ld\n", (long)cx->blk_oldmarksp);
1047 PerlIO_printf(Perl_debug_log, "BLK_OLDSCOPESP = %ld\n", (long)cx->blk_oldscopesp);
1048 PerlIO_printf(Perl_debug_log, "BLK_OLDRETSP = %ld\n", (long)cx->blk_oldretsp);
1049 PerlIO_printf(Perl_debug_log, "BLK_OLDPM = 0x%"UVxf"\n",
1050 PTR2UV(cx->blk_oldpm));
1051 PerlIO_printf(Perl_debug_log, "BLK_GIMME = %s\n", cx->blk_gimme ? "LIST" : "SCALAR");
1053 switch (CxTYPE(cx)) {
1058 PerlIO_printf(Perl_debug_log, "BLK_SUB.CV = 0x%"UVxf"\n",
1059 PTR2UV(cx->blk_sub.cv));
1060 PerlIO_printf(Perl_debug_log, "BLK_SUB.GV = 0x%"UVxf"\n",
1061 PTR2UV(cx->blk_sub.gv));
1062 PerlIO_printf(Perl_debug_log, "BLK_SUB.DFOUTGV = 0x%"UVxf"\n",
1063 PTR2UV(cx->blk_sub.dfoutgv));
1064 PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n",
1065 (int)cx->blk_sub.hasargs);
1068 PerlIO_printf(Perl_debug_log, "BLK_SUB.CV = 0x%"UVxf"\n",
1069 PTR2UV(cx->blk_sub.cv));
1070 PerlIO_printf(Perl_debug_log, "BLK_SUB.OLDDEPTH = %ld\n",
1071 (long)cx->blk_sub.olddepth);
1072 PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n",
1073 (int)cx->blk_sub.hasargs);
1074 PerlIO_printf(Perl_debug_log, "BLK_SUB.LVAL = %d\n",
1075 (int)cx->blk_sub.lval);
1078 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_IN_EVAL = %ld\n",
1079 (long)cx->blk_eval.old_in_eval);
1080 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_OP_TYPE = %s (%s)\n",
1081 PL_op_name[cx->blk_eval.old_op_type],
1082 PL_op_desc[cx->blk_eval.old_op_type]);
1083 if (cx->blk_eval.old_namesv)
1084 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_NAME = %s\n",
1085 SvPVX(cx->blk_eval.old_namesv));
1086 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_EVAL_ROOT = 0x%"UVxf"\n",
1087 PTR2UV(cx->blk_eval.old_eval_root));
1091 PerlIO_printf(Perl_debug_log, "BLK_LOOP.LABEL = %s\n",
1092 cx->blk_loop.label);
1093 PerlIO_printf(Perl_debug_log, "BLK_LOOP.RESETSP = %ld\n",
1094 (long)cx->blk_loop.resetsp);
1095 PerlIO_printf(Perl_debug_log, "BLK_LOOP.REDO_OP = 0x%"UVxf"\n",
1096 PTR2UV(cx->blk_loop.redo_op));
1097 PerlIO_printf(Perl_debug_log, "BLK_LOOP.NEXT_OP = 0x%"UVxf"\n",
1098 PTR2UV(cx->blk_loop.next_op));
1099 PerlIO_printf(Perl_debug_log, "BLK_LOOP.LAST_OP = 0x%"UVxf"\n",
1100 PTR2UV(cx->blk_loop.last_op));
1101 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERIX = %ld\n",
1102 (long)cx->blk_loop.iterix);
1103 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERARY = 0x%"UVxf"\n",
1104 PTR2UV(cx->blk_loop.iterary));
1105 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERVAR = 0x%"UVxf"\n",
1106 PTR2UV(CxITERVAR(cx)));
1108 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERSAVE = 0x%"UVxf"\n",
1109 PTR2UV(cx->blk_loop.itersave));
1110 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERLVAL = 0x%"UVxf"\n",
1111 PTR2UV(cx->blk_loop.iterlval));
1115 PerlIO_printf(Perl_debug_log, "SB_ITERS = %ld\n",
1116 (long)cx->sb_iters);
1117 PerlIO_printf(Perl_debug_log, "SB_MAXITERS = %ld\n",
1118 (long)cx->sb_maxiters);
1119 PerlIO_printf(Perl_debug_log, "SB_RFLAGS = %ld\n",
1120 (long)cx->sb_rflags);
1121 PerlIO_printf(Perl_debug_log, "SB_ONCE = %ld\n",
1123 PerlIO_printf(Perl_debug_log, "SB_ORIG = %s\n",
1125 PerlIO_printf(Perl_debug_log, "SB_DSTR = 0x%"UVxf"\n",
1126 PTR2UV(cx->sb_dstr));
1127 PerlIO_printf(Perl_debug_log, "SB_TARG = 0x%"UVxf"\n",
1128 PTR2UV(cx->sb_targ));
1129 PerlIO_printf(Perl_debug_log, "SB_S = 0x%"UVxf"\n",
1131 PerlIO_printf(Perl_debug_log, "SB_M = 0x%"UVxf"\n",
1133 PerlIO_printf(Perl_debug_log, "SB_STREND = 0x%"UVxf"\n",
1134 PTR2UV(cx->sb_strend));
1135 PerlIO_printf(Perl_debug_log, "SB_RXRES = 0x%"UVxf"\n",
1136 PTR2UV(cx->sb_rxres));
1139 #endif /* DEBUGGING */