3 * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 * 2000, 2001, 2002, 2003, 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
17 #define PERL_IN_SCOPE_C
20 #if defined(PERL_FLEXIBLE_EXCEPTIONS)
22 Perl_default_protect(pTHX_ volatile JMPENV *pcur_env, int *excpt,
23 protect_body_t body, ...)
28 ret = vdefault_protect(pcur_env, excpt, body, &args);
34 Perl_vdefault_protect(pTHX_ volatile JMPENV *pcur_env, int *excpt,
35 protect_body_t body, va_list *args)
44 ret = CALL_FPTR(body)(aTHX_ *args);
52 Perl_stack_grow(pTHX_ SV **sp, SV **p, int n)
55 #ifndef STRESS_REALLOC
56 av_extend(PL_curstack, (p - PL_stack_base) + (n) + 128);
58 av_extend(PL_curstack, (p - PL_stack_base) + (n) + 1);
63 #ifndef STRESS_REALLOC
64 #define GROW(old) ((old) * 3 / 2)
66 #define GROW(old) ((old) + 1)
70 Perl_new_stackinfo(pTHX_ I32 stitems, I32 cxitems)
73 New(56, si, 1, PERL_SI);
74 si->si_stack = newAV();
75 AvREAL_off(si->si_stack);
76 av_extend(si->si_stack, stitems > 0 ? stitems-1 : 0);
77 AvALLOC(si->si_stack)[0] = &PL_sv_undef;
78 AvFILLp(si->si_stack) = 0;
81 si->si_cxmax = cxitems - 1;
83 si->si_type = PERLSI_UNDEF;
84 New(56, si->si_cxstack, cxitems, PERL_CONTEXT);
85 /* Without any kind of initialising PUSHSUBST()
86 * in pp_subst() will read uninitialised heap. */
87 Poison(si->si_cxstack, cxitems, PERL_CONTEXT);
94 IV old_max = cxstack_max;
95 cxstack_max = GROW(cxstack_max);
96 Renew(cxstack, cxstack_max + 1, PERL_CONTEXT); /* XXX should fix CXINC macro */
97 /* Without any kind of initialising deep enough recursion
98 * will end up reading uninitialised PERL_CONTEXTs. */
99 Poison(cxstack + old_max + 1, cxstack_max - old_max, PERL_CONTEXT);
100 return cxstack_ix + 1;
104 Perl_push_return(pTHX_ OP *retop)
106 if (PL_retstack_ix == PL_retstack_max) {
107 PL_retstack_max = GROW(PL_retstack_max);
108 Renew(PL_retstack, PL_retstack_max, OP*);
110 PL_retstack[PL_retstack_ix++] = retop;
114 Perl_pop_return(pTHX)
116 if (PL_retstack_ix > 0)
117 return PL_retstack[--PL_retstack_ix];
123 Perl_push_scope(pTHX)
125 if (PL_scopestack_ix == PL_scopestack_max) {
126 PL_scopestack_max = GROW(PL_scopestack_max);
127 Renew(PL_scopestack, PL_scopestack_max, I32);
129 PL_scopestack[PL_scopestack_ix++] = PL_savestack_ix;
136 I32 oldsave = PL_scopestack[--PL_scopestack_ix];
137 LEAVE_SCOPE(oldsave);
141 Perl_markstack_grow(pTHX)
143 I32 oldmax = PL_markstack_max - PL_markstack;
144 I32 newmax = GROW(oldmax);
146 Renew(PL_markstack, newmax, I32);
147 PL_markstack_ptr = PL_markstack + oldmax;
148 PL_markstack_max = PL_markstack + newmax;
152 Perl_savestack_grow(pTHX)
154 PL_savestack_max = GROW(PL_savestack_max) + 4;
155 Renew(PL_savestack, PL_savestack_max, ANY);
159 Perl_savestack_grow_cnt(pTHX_ I32 need)
161 PL_savestack_max = PL_savestack_ix + need;
162 Renew(PL_savestack, PL_savestack_max, ANY);
168 Perl_tmps_grow(pTHX_ I32 n)
170 #ifndef STRESS_REALLOC
172 n = (PL_tmps_max < 512) ? 128 : 512;
174 PL_tmps_max = PL_tmps_ix + n + 1;
175 Renew(PL_tmps_stack, PL_tmps_max, SV*);
182 /* XXX should tmps_floor live in cxstack? */
183 I32 myfloor = PL_tmps_floor;
184 while (PL_tmps_ix > myfloor) { /* clean up after last statement */
185 SV* sv = PL_tmps_stack[PL_tmps_ix];
186 PL_tmps_stack[PL_tmps_ix--] = Nullsv;
187 if (sv && sv != &PL_sv_undef) {
189 SvREFCNT_dec(sv); /* note, can modify tmps_ix!!! */
195 S_save_scalar_at(pTHX_ SV **sptr)
200 sv = *sptr = NEWSV(0,0);
201 if (SvTYPE(osv) >= SVt_PVMG && SvMAGIC(osv) && SvTYPE(osv) != SVt_PVGV) {
202 sv_upgrade(sv, SvTYPE(osv));
203 if (SvGMAGICAL(osv)) {
205 bool oldtainted = PL_tainted;
206 mg_get(osv); /* note, can croak! */
207 if (PL_tainting && PL_tainted &&
208 (mg = mg_find(osv, PERL_MAGIC_taint))) {
209 SAVESPTR(mg->mg_obj);
212 SvFLAGS(osv) |= (SvFLAGS(osv) &
213 (SVp_NOK|SVp_POK)) >> PRIVSHIFT;
214 PL_tainted = oldtainted;
216 SvMAGIC(sv) = SvMAGIC(osv);
217 SvFLAGS(sv) |= SvMAGICAL(osv);
218 /* XXX SvMAGIC() is *shared* between osv and sv. This can
219 * lead to coredumps when both SVs are destroyed without one
220 * of their SvMAGIC() slots being NULLed. */
229 Perl_save_scalar(pTHX_ GV *gv)
231 SV **sptr = &GvSV(gv);
233 SSPUSHPTR(SvREFCNT_inc(gv));
234 SSPUSHPTR(SvREFCNT_inc(*sptr));
236 return save_scalar_at(sptr);
240 Perl_save_svref(pTHX_ SV **sptr)
244 SSPUSHPTR(SvREFCNT_inc(*sptr));
245 SSPUSHINT(SAVEt_SVREF);
246 return save_scalar_at(sptr);
249 /* Like save_sptr(), but also SvREFCNT_dec()s the new value. Can be used to
250 * restore a global SV to its prior contents, freeing new value. */
252 Perl_save_generic_svref(pTHX_ SV **sptr)
256 SSPUSHPTR(SvREFCNT_inc(*sptr));
257 SSPUSHINT(SAVEt_GENERIC_SVREF);
260 /* Like save_pptr(), but also Safefree()s the new value if it is different
261 * from the old one. Can be used to restore a global char* to its prior
262 * contents, freeing new value. */
264 Perl_save_generic_pvref(pTHX_ char **str)
269 SSPUSHINT(SAVEt_GENERIC_PVREF);
272 /* Like save_generic_pvref(), but uses PerlMemShared_free() rather than Safefree().
273 * Can be used to restore a shared global char* to its prior
274 * contents, freeing new value. */
276 Perl_save_shared_pvref(pTHX_ char **str)
281 SSPUSHINT(SAVEt_SHARED_PVREF);
285 Perl_save_gp(pTHX_ GV *gv, I32 empty)
288 SSPUSHIV((IV)SvLEN(gv));
289 SvLEN(gv) = 0; /* forget that anything was allocated here */
290 SSPUSHIV((IV)SvCUR(gv));
291 SSPUSHPTR(SvPVX(gv));
293 SSPUSHPTR(SvREFCNT_inc(gv));
300 Newz(602, gp, 1, GP);
303 PL_sub_generation++; /* taking a method out of circulation */
304 if (GvIOp(gv) && (IoFLAGS(GvIOp(gv)) & IOf_ARGV)) {
306 IoFLAGS(gp->gp_io) |= IOf_ARGV|IOf_START;
308 GvGP(gv) = gp_ref(gp);
309 GvSV(gv) = NEWSV(72,0);
310 GvLINE(gv) = CopLINE(PL_curcop);
311 GvFILE(gv) = CopFILE(PL_curcop) ? CopFILE(PL_curcop) : "";
321 Perl_save_ary(pTHX_ GV *gv)
326 if (!AvREAL(oav) && AvREIFY(oav))
333 GvAV(gv) = Null(AV*);
336 SvMAGIC(av) = SvMAGIC(oav);
337 SvFLAGS((SV*)av) |= SvMAGICAL(oav);
348 Perl_save_hash(pTHX_ GV *gv)
354 SSPUSHPTR(ohv = GvHVn(gv));
357 GvHV(gv) = Null(HV*);
360 SvMAGIC(hv) = SvMAGIC(ohv);
361 SvFLAGS((SV*)hv) |= SvMAGICAL(ohv);
372 Perl_save_item(pTHX_ register SV *item)
374 register SV *sv = NEWSV(0,0);
378 SSPUSHPTR(item); /* remember the pointer */
379 SSPUSHPTR(sv); /* remember the value */
380 SSPUSHINT(SAVEt_ITEM);
384 Perl_save_int(pTHX_ int *intp)
389 SSPUSHINT(SAVEt_INT);
393 Perl_save_long(pTHX_ long int *longp)
398 SSPUSHINT(SAVEt_LONG);
402 Perl_save_bool(pTHX_ bool *boolp)
407 SSPUSHINT(SAVEt_BOOL);
411 Perl_save_I32(pTHX_ I32 *intp)
416 SSPUSHINT(SAVEt_I32);
420 Perl_save_I16(pTHX_ I16 *intp)
425 SSPUSHINT(SAVEt_I16);
429 Perl_save_I8(pTHX_ I8 *bytep)
438 Perl_save_iv(pTHX_ IV *ivp)
446 /* Cannot use save_sptr() to store a char* since the SV** cast will
447 * force word-alignment and we'll miss the pointer.
450 Perl_save_pptr(pTHX_ char **pptr)
455 SSPUSHINT(SAVEt_PPTR);
459 Perl_save_vptr(pTHX_ void *ptr)
462 SSPUSHPTR(*(char**)ptr);
464 SSPUSHINT(SAVEt_VPTR);
468 Perl_save_sptr(pTHX_ SV **sptr)
473 SSPUSHINT(SAVEt_SPTR);
477 Perl_save_padsv(pTHX_ PADOFFSET off)
480 ASSERT_CURPAD_ACTIVE("save_padsv");
481 SSPUSHPTR(PL_curpad[off]);
482 SSPUSHPTR(PL_comppad);
483 SSPUSHLONG((long)off);
484 SSPUSHINT(SAVEt_PADSV);
488 Perl_save_threadsv(pTHX_ PADOFFSET i)
490 Perl_croak(aTHX_ "panic: save_threadsv called in non-threaded perl");
495 Perl_save_nogv(pTHX_ GV *gv)
499 SSPUSHINT(SAVEt_NSTAB);
503 Perl_save_hptr(pTHX_ HV **hptr)
508 SSPUSHINT(SAVEt_HPTR);
512 Perl_save_aptr(pTHX_ AV **aptr)
517 SSPUSHINT(SAVEt_APTR);
521 Perl_save_freesv(pTHX_ SV *sv)
525 SSPUSHINT(SAVEt_FREESV);
529 Perl_save_mortalizesv(pTHX_ SV *sv)
533 SSPUSHINT(SAVEt_MORTALIZESV);
537 Perl_save_freeop(pTHX_ OP *o)
541 SSPUSHINT(SAVEt_FREEOP);
545 Perl_save_freepv(pTHX_ char *pv)
549 SSPUSHINT(SAVEt_FREEPV);
553 Perl_save_clearsv(pTHX_ SV **svp)
555 ASSERT_CURPAD_ACTIVE("save_clearsv");
557 SSPUSHLONG((long)(svp-PL_curpad));
558 SSPUSHINT(SAVEt_CLEARSV);
559 SvPADSTALE_off(*svp); /* mark lexical as active */
563 Perl_save_delete(pTHX_ HV *hv, char *key, I32 klen)
568 SSPUSHPTR(SvREFCNT_inc(hv));
569 SSPUSHINT(SAVEt_DELETE);
573 Perl_save_list(pTHX_ register SV **sarg, I32 maxsarg)
578 for (i = 1; i <= maxsarg; i++) {
580 sv_setsv(sv,sarg[i]);
582 SSPUSHPTR(sarg[i]); /* remember the pointer */
583 SSPUSHPTR(sv); /* remember the value */
584 SSPUSHINT(SAVEt_ITEM);
589 Perl_save_destructor(pTHX_ DESTRUCTORFUNC_NOCONTEXT_t f, void* p)
594 SSPUSHINT(SAVEt_DESTRUCTOR);
598 Perl_save_destructor_x(pTHX_ DESTRUCTORFUNC_t f, void* p)
603 SSPUSHINT(SAVEt_DESTRUCTOR_X);
607 Perl_save_aelem(pTHX_ AV *av, I32 idx, SV **sptr)
611 SSPUSHPTR(SvREFCNT_inc(av));
613 SSPUSHPTR(SvREFCNT_inc(*sptr));
614 SSPUSHINT(SAVEt_AELEM);
615 /* if it gets reified later, the restore will have the wrong refcnt */
616 if (!AvREAL(av) && AvREIFY(av))
618 save_scalar_at(sptr);
620 /* If we're localizing a tied array element, this new sv
621 * won't actually be stored in the array - so it won't get
622 * reaped when the localize ends. Ensure it gets reaped by
623 * mortifying it instead. DAPM */
624 if (SvTIED_mg(sv, PERL_MAGIC_tiedelem))
629 Perl_save_helem(pTHX_ HV *hv, SV *key, SV **sptr)
633 SSPUSHPTR(SvREFCNT_inc(hv));
634 SSPUSHPTR(SvREFCNT_inc(key));
635 SSPUSHPTR(SvREFCNT_inc(*sptr));
636 SSPUSHINT(SAVEt_HELEM);
637 save_scalar_at(sptr);
639 /* If we're localizing a tied hash element, this new sv
640 * won't actually be stored in the hash - so it won't get
641 * reaped when the localize ends. Ensure it gets reaped by
642 * mortifying it instead. DAPM */
643 if (SvTIED_mg(sv, PERL_MAGIC_tiedelem))
656 Perl_save_alloc(pTHX_ I32 size, I32 pad)
658 register I32 start = pad + ((char*)&PL_savestack[PL_savestack_ix]
659 - (char*)PL_savestack);
660 register I32 elems = 1 + ((size + pad - 1) / sizeof(*PL_savestack));
662 /* SSCHECK may not be good enough */
663 while (PL_savestack_ix + elems + 2 > PL_savestack_max)
666 PL_savestack_ix += elems;
668 SSPUSHINT(SAVEt_ALLOC);
673 Perl_leave_scope(pTHX_ I32 base)
685 Perl_croak(aTHX_ "panic: corrupt saved stack index");
686 while (PL_savestack_ix > base) {
688 case SAVEt_ITEM: /* normal string */
689 value = (SV*)SSPOPPTR;
691 sv_replace(sv,value);
696 case SAVEt_SV: /* scalar reference */
697 value = (SV*)SSPOPPTR;
700 av = (AV*)gv; /* what to refcnt_dec */
702 case SAVEt_GENERIC_PVREF: /* generic pv */
703 str = (char*)SSPOPPTR;
705 if (*(char**)ptr != str) {
706 Safefree(*(char**)ptr);
710 case SAVEt_SHARED_PVREF: /* shared pv */
711 str = (char*)SSPOPPTR;
713 if (*(char**)ptr != str) {
715 PerlMem_free(*(char**)ptr);
717 PerlMemShared_free(*(char**)ptr);
722 case SAVEt_GENERIC_SVREF: /* generic sv */
723 value = (SV*)SSPOPPTR;
730 case SAVEt_SVREF: /* scalar reference */
731 value = (SV*)SSPOPPTR;
733 av = Nullav; /* what to refcnt_dec */
736 DEBUG_S(PerlIO_printf(Perl_debug_log,
737 "restore svref: %p %p:%s -> %p:%s\n",
738 ptr, sv, SvPEEK(sv), value, SvPEEK(value)));
739 if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv) &&
740 SvTYPE(sv) != SVt_PVGV)
742 (void)SvUPGRADE(value, SvTYPE(sv));
743 SvMAGIC(value) = SvMAGIC(sv);
744 SvFLAGS(value) |= SvMAGICAL(sv);
748 /* XXX This branch is pretty bogus. This code irretrievably
749 * clears(!) the magic on the SV (either to avoid further
750 * croaking that might ensue when the SvSETMAGIC() below is
751 * called, or to avoid two different SVs pointing at the same
752 * SvMAGIC()). This needs a total rethink. --GSAR */
753 else if (SvTYPE(value) >= SVt_PVMG && SvMAGIC(value) &&
754 SvTYPE(value) != SVt_PVGV)
756 SvFLAGS(value) |= (SvFLAGS(value) &
757 (SVp_NOK|SVp_POK)) >> PRIVSHIFT;
758 SvMAGICAL_off(value);
759 /* XXX this is a leak when we get here because the
760 * mg_get() in save_scalar_at() croaked */
769 if (av) /* actually an av, hv or gv */
772 case SAVEt_AV: /* array reference */
776 AV *goner = GvAV(gv);
777 SvMAGIC(av) = SvMAGIC(goner);
778 SvFLAGS((SV*)av) |= SvMAGICAL(goner);
779 SvMAGICAL_off(goner);
790 case SAVEt_HV: /* hash reference */
794 HV *goner = GvHV(gv);
795 SvMAGIC(hv) = SvMAGIC(goner);
796 SvFLAGS(hv) |= SvMAGICAL(goner);
797 SvMAGICAL_off(goner);
808 case SAVEt_INT: /* int reference */
810 *(int*)ptr = (int)SSPOPINT;
812 case SAVEt_LONG: /* long reference */
814 *(long*)ptr = (long)SSPOPLONG;
816 case SAVEt_BOOL: /* bool reference */
818 *(bool*)ptr = (bool)SSPOPBOOL;
820 case SAVEt_I32: /* I32 reference */
822 *(I32*)ptr = (I32)SSPOPINT;
824 case SAVEt_I16: /* I16 reference */
826 *(I16*)ptr = (I16)SSPOPINT;
828 case SAVEt_I8: /* I8 reference */
830 *(I8*)ptr = (I8)SSPOPINT;
832 case SAVEt_IV: /* IV reference */
834 *(IV*)ptr = (IV)SSPOPIV;
836 case SAVEt_SPTR: /* SV* reference */
838 *(SV**)ptr = (SV*)SSPOPPTR;
840 case SAVEt_VPTR: /* random* reference */
841 case SAVEt_PPTR: /* char* reference */
843 *(char**)ptr = (char*)SSPOPPTR;
845 case SAVEt_HPTR: /* HV* reference */
847 *(HV**)ptr = (HV*)SSPOPPTR;
849 case SAVEt_APTR: /* AV* reference */
851 *(AV**)ptr = (AV*)SSPOPPTR;
855 (void)sv_clear((SV*)gv);
857 case SAVEt_GP: /* scalar reference */
860 if (SvPVX(gv) && SvLEN(gv) > 0) {
863 SvPVX(gv) = (char *)SSPOPPTR;
864 SvCUR(gv) = (STRLEN)SSPOPIV;
865 SvLEN(gv) = (STRLEN)SSPOPIV;
869 PL_sub_generation++; /* putting a method back into circulation */
874 SvREFCNT_dec((SV*)ptr);
876 case SAVEt_MORTALIZESV:
878 sv_2mortal((SV*)ptr);
882 ASSERT_CURPAD_LEGAL("SAVEt_FREEOP"); /* XXX DAPM tmp */
887 Safefree((char*)ptr);
890 ptr = (void*)&PL_curpad[SSPOPLONG];
893 DEBUG_Xv(PerlIO_printf(Perl_debug_log,
894 "Pad 0x%"UVxf"[0x%"UVxf"] clearsv: %ld sv=0x%"UVxf"<%"IVdf"> %s\n",
895 PTR2UV(PL_comppad), PTR2UV(PL_curpad),
896 (long)((SV **)ptr-PL_curpad), PTR2UV(sv), (IV)SvREFCNT(sv),
897 (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) ? "clear" : "abandon"
900 /* Can clear pad variable in place? */
901 if (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) {
903 * if a my variable that was made readonly is going out of
904 * scope, we want to remove the readonlyness so that it can
905 * go out of scope quietly
907 if (SvPADMY(sv) && !SvFAKE(sv))
910 if (SvTHINKFIRST(sv))
911 sv_force_normal_flags(sv, SV_IMMEDIATE_UNREF);
915 switch (SvTYPE(sv)) {
925 Perl_croak(aTHX_ "panic: leave_scope pad code");
936 SvPADSTALE_on(sv); /* mark as no longer live */
938 else { /* Someone has a claim on this, so abandon it. */
939 U32 padflags = SvFLAGS(sv) & (SVs_PADMY|SVs_PADTMP);
940 switch (SvTYPE(sv)) { /* Console ourselves with a new value */
941 case SVt_PVAV: *(SV**)ptr = (SV*)newAV(); break;
942 case SVt_PVHV: *(SV**)ptr = (SV*)newHV(); break;
943 default: *(SV**)ptr = NEWSV(0,0); break;
945 SvREFCNT_dec(sv); /* Cast current value to the winds. */
946 /* preserve pad nature, but also mark as not live
947 * for any closure capturing */
948 SvFLAGS(*(SV**)ptr) |= padflags & SVs_PADSTALE;
955 (void)hv_delete(hv, (char*)ptr, (U32)SSPOPINT, G_DISCARD);
959 case SAVEt_DESTRUCTOR:
963 case SAVEt_DESTRUCTOR_X:
965 (*SSPOPDXPTR)(aTHX_ ptr);
967 case SAVEt_REGCONTEXT:
970 PL_savestack_ix -= i; /* regexp must have croaked */
972 case SAVEt_STACK_POS: /* Position on Perl stack */
974 PL_stack_sp = PL_stack_base + i;
976 case SAVEt_AELEM: /* array element */
977 value = (SV*)SSPOPPTR;
980 if (!AvREAL(av) && AvREIFY(av)) /* undo reify guard */
982 ptr = av_fetch(av,i,1);
985 if (sv && sv != &PL_sv_undef) {
986 if (SvTIED_mg((SV*)av, PERL_MAGIC_tied))
987 (void)SvREFCNT_inc(sv);
994 case SAVEt_HELEM: /* hash element */
995 value = (SV*)SSPOPPTR;
998 ptr = hv_fetch_ent(hv, sv, 1, 0);
1000 SV *oval = HeVAL((HE*)ptr);
1001 if (oval && oval != &PL_sv_undef) {
1002 ptr = &HeVAL((HE*)ptr);
1003 if (SvTIED_mg((SV*)hv, PERL_MAGIC_tied))
1004 (void)SvREFCNT_inc(*(SV**)ptr);
1006 av = (AV*)hv; /* what to refcnt_dec */
1012 SvREFCNT_dec(value);
1015 PL_op = (OP*)SSPOPPTR;
1018 if ((PL_hints & HINT_LOCALIZE_HH) && GvHV(PL_hintgv)) {
1019 SvREFCNT_dec((SV*)GvHV(PL_hintgv));
1020 GvHV(PL_hintgv) = NULL;
1022 *(I32*)&PL_hints = (I32)SSPOPINT;
1025 PL_comppad = (PAD*)SSPOPPTR;
1027 PL_curpad = AvARRAY(PL_comppad);
1029 PL_curpad = Null(SV**);
1033 PADOFFSET off = (PADOFFSET)SSPOPLONG;
1036 AvARRAY((PAD*)ptr)[off] = (SV*)SSPOPPTR;
1040 Perl_croak(aTHX_ "panic: leave_scope inconsistency");
1046 Perl_cx_dump(pTHX_ PERL_CONTEXT *cx)
1049 PerlIO_printf(Perl_debug_log, "CX %ld = %s\n", (long)(cx - cxstack), PL_block_type[CxTYPE(cx)]);
1050 if (CxTYPE(cx) != CXt_SUBST) {
1051 PerlIO_printf(Perl_debug_log, "BLK_OLDSP = %ld\n", (long)cx->blk_oldsp);
1052 PerlIO_printf(Perl_debug_log, "BLK_OLDCOP = 0x%"UVxf"\n",
1053 PTR2UV(cx->blk_oldcop));
1054 PerlIO_printf(Perl_debug_log, "BLK_OLDMARKSP = %ld\n", (long)cx->blk_oldmarksp);
1055 PerlIO_printf(Perl_debug_log, "BLK_OLDSCOPESP = %ld\n", (long)cx->blk_oldscopesp);
1056 PerlIO_printf(Perl_debug_log, "BLK_OLDRETSP = %ld\n", (long)cx->blk_oldretsp);
1057 PerlIO_printf(Perl_debug_log, "BLK_OLDPM = 0x%"UVxf"\n",
1058 PTR2UV(cx->blk_oldpm));
1059 PerlIO_printf(Perl_debug_log, "BLK_GIMME = %s\n", cx->blk_gimme ? "LIST" : "SCALAR");
1061 switch (CxTYPE(cx)) {
1066 PerlIO_printf(Perl_debug_log, "BLK_SUB.CV = 0x%"UVxf"\n",
1067 PTR2UV(cx->blk_sub.cv));
1068 PerlIO_printf(Perl_debug_log, "BLK_SUB.GV = 0x%"UVxf"\n",
1069 PTR2UV(cx->blk_sub.gv));
1070 PerlIO_printf(Perl_debug_log, "BLK_SUB.DFOUTGV = 0x%"UVxf"\n",
1071 PTR2UV(cx->blk_sub.dfoutgv));
1072 PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n",
1073 (int)cx->blk_sub.hasargs);
1076 PerlIO_printf(Perl_debug_log, "BLK_SUB.CV = 0x%"UVxf"\n",
1077 PTR2UV(cx->blk_sub.cv));
1078 PerlIO_printf(Perl_debug_log, "BLK_SUB.OLDDEPTH = %ld\n",
1079 (long)cx->blk_sub.olddepth);
1080 PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n",
1081 (int)cx->blk_sub.hasargs);
1082 PerlIO_printf(Perl_debug_log, "BLK_SUB.LVAL = %d\n",
1083 (int)cx->blk_sub.lval);
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(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));
1099 PerlIO_printf(Perl_debug_log, "BLK_LOOP.LABEL = %s\n",
1100 cx->blk_loop.label);
1101 PerlIO_printf(Perl_debug_log, "BLK_LOOP.RESETSP = %ld\n",
1102 (long)cx->blk_loop.resetsp);
1103 PerlIO_printf(Perl_debug_log, "BLK_LOOP.REDO_OP = 0x%"UVxf"\n",
1104 PTR2UV(cx->blk_loop.redo_op));
1105 PerlIO_printf(Perl_debug_log, "BLK_LOOP.NEXT_OP = 0x%"UVxf"\n",
1106 PTR2UV(cx->blk_loop.next_op));
1107 PerlIO_printf(Perl_debug_log, "BLK_LOOP.LAST_OP = 0x%"UVxf"\n",
1108 PTR2UV(cx->blk_loop.last_op));
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));
1147 #endif /* DEBUGGING */