/* scope.c
*
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- * 2000, 2001, 2002, 2003, 2004, 2005, by Larry Wall and others
+ * 2000, 2001, 2002, 2003, 2004, 2005, 2006, by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
SV**
Perl_stack_grow(pTHX_ SV **sp, SV **p, int n)
{
+ dVAR;
PL_stack_sp = sp;
#ifndef STRESS_REALLOC
av_extend(PL_curstack, (p - PL_stack_base) + (n) + 128);
PERL_SI *
Perl_new_stackinfo(pTHX_ I32 stitems, I32 cxitems)
{
+ dVAR;
PERL_SI *si;
Newx(si, 1, PERL_SI);
si->si_stack = newAV();
Newx(si->si_cxstack, cxitems, PERL_CONTEXT);
/* Without any kind of initialising PUSHSUBST()
* in pp_subst() will read uninitialised heap. */
- Poison(si->si_cxstack, cxitems, PERL_CONTEXT);
+ PoisonNew(si->si_cxstack, cxitems, PERL_CONTEXT);
return si;
}
I32
Perl_cxinc(pTHX)
{
+ dVAR;
const IV old_max = cxstack_max;
cxstack_max = GROW(cxstack_max);
Renew(cxstack, cxstack_max + 1, PERL_CONTEXT); /* XXX should fix CXINC macro */
/* Without any kind of initialising deep enough recursion
* will end up reading uninitialised PERL_CONTEXTs. */
- Poison(cxstack + old_max + 1, cxstack_max - old_max, PERL_CONTEXT);
+ PoisonNew(cxstack + old_max + 1, cxstack_max - old_max, PERL_CONTEXT);
return cxstack_ix + 1;
}
void
Perl_push_scope(pTHX)
{
+ dVAR;
if (PL_scopestack_ix == PL_scopestack_max) {
PL_scopestack_max = GROW(PL_scopestack_max);
Renew(PL_scopestack, PL_scopestack_max, I32);
void
Perl_pop_scope(pTHX)
{
+ dVAR;
const I32 oldsave = PL_scopestack[--PL_scopestack_ix];
LEAVE_SCOPE(oldsave);
}
void
Perl_markstack_grow(pTHX)
{
+ dVAR;
const I32 oldmax = PL_markstack_max - PL_markstack;
const I32 newmax = GROW(oldmax);
void
Perl_savestack_grow(pTHX)
{
+ dVAR;
PL_savestack_max = GROW(PL_savestack_max) + 4;
Renew(PL_savestack, PL_savestack_max, ANY);
}
void
Perl_savestack_grow_cnt(pTHX_ I32 need)
{
+ dVAR;
PL_savestack_max = PL_savestack_ix + need;
Renew(PL_savestack, PL_savestack_max, ANY);
}
void
Perl_tmps_grow(pTHX_ I32 n)
{
+ dVAR;
#ifndef STRESS_REALLOC
if (n < 128)
n = (PL_tmps_max < 512) ? 128 : 512;
void
Perl_free_tmps(pTHX)
{
+ dVAR;
/* XXX should tmps_floor live in cxstack? */
const I32 myfloor = PL_tmps_floor;
while (PL_tmps_ix > myfloor) { /* clean up after last statement */
SV* const sv = PL_tmps_stack[PL_tmps_ix];
- PL_tmps_stack[PL_tmps_ix--] = Nullsv;
+ PL_tmps_stack[PL_tmps_ix--] = NULL;
if (sv && sv != &PL_sv_undef) {
SvTEMP_off(sv);
SvREFCNT_dec(sv); /* note, can modify tmps_ix!!! */
STATIC SV *
S_save_scalar_at(pTHX_ SV **sptr)
{
+ dVAR;
SV * const osv = *sptr;
- register SV * const sv = *sptr = NEWSV(0,0);
+ register SV * const sv = *sptr = newSV(0);
+
+#ifdef PERL_MAD
+ /* FIXME for MAD - this is causing ext/Safe/t/safeops.t to abort. */
+ if (PL_formfeed && sv == PL_formfeed)
+ abort();
+#endif
if (SvTYPE(osv) >= SVt_PVMG && SvMAGIC(osv) && SvTYPE(osv) != SVt_PVGV) {
if (SvGMAGICAL(osv)) {
const bool oldtainted = PL_tainted;
SvFLAGS(osv) |= (SvFLAGS(osv) &
- (SVp_NOK|SVp_POK)) >> PRIVSHIFT;
+ (SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT;
PL_tainted = oldtainted;
}
mg_localize(osv, sv);
SV *
Perl_save_scalar(pTHX_ GV *gv)
{
- SV ** const sptr = &GvSV(gv);
+ dVAR;
+ SV ** const sptr = &GvSVn(gv);
+#ifdef PERL_MAD
+ if (PL_formfeed && *sptr == PL_formfeed)
+ abort();
+#endif
PL_localizing = 1;
SvGETMAGIC(*sptr);
PL_localizing = 0;
SSCHECK(3);
- SSPUSHPTR(SvREFCNT_inc(gv));
+ SSPUSHPTR(SvREFCNT_inc_simple(gv));
SSPUSHPTR(SvREFCNT_inc(*sptr));
SSPUSHINT(SAVEt_SV);
return save_scalar_at(sptr);
}
-SV*
-Perl_save_svref(pTHX_ SV **sptr)
-{
- SvGETMAGIC(*sptr);
- SSCHECK(3);
- SSPUSHPTR(sptr);
- SSPUSHPTR(SvREFCNT_inc(*sptr));
- SSPUSHINT(SAVEt_SVREF);
- return save_scalar_at(sptr);
-}
-
/* Like save_sptr(), but also SvREFCNT_dec()s the new value. Can be used to
* restore a global SV to its prior contents, freeing new value. */
void
Perl_save_generic_svref(pTHX_ SV **sptr)
{
+ dVAR;
+#ifdef PERL_MAD
+ if (PL_formfeed && *sptr == PL_formfeed)
+ abort();
+#endif
SSCHECK(3);
SSPUSHPTR(sptr);
SSPUSHPTR(SvREFCNT_inc(*sptr));
void
Perl_save_generic_pvref(pTHX_ char **str)
{
+ dVAR;
SSCHECK(3);
- SSPUSHPTR(str);
SSPUSHPTR(*str);
+ SSPUSHPTR(str);
SSPUSHINT(SAVEt_GENERIC_PVREF);
}
void
Perl_save_shared_pvref(pTHX_ char **str)
{
+ dVAR;
SSCHECK(3);
SSPUSHPTR(str);
SSPUSHPTR(*str);
void
Perl_save_set_svflags(pTHX_ SV* sv, U32 mask, U32 val)
{
+ dVAR;
SSCHECK(4);
SSPUSHPTR(sv);
SSPUSHINT(mask);
void
Perl_save_gp(pTHX_ GV *gv, I32 empty)
{
- SSGROW(6);
- SSPUSHIV((IV)SvLEN(gv));
- SvLEN_set(gv, 0); /* forget that anything was allocated here */
- SSPUSHIV((IV)SvCUR(gv));
- SSPUSHPTR(SvPVX_const(gv));
- SvPOK_off(gv);
+ dVAR;
+ SSGROW(3);
SSPUSHPTR(SvREFCNT_inc(gv));
SSPUSHPTR(GvGP(gv));
SSPUSHINT(SAVEt_GP);
IoFLAGS(gp->gp_io) |= IOf_ARGV|IOf_START;
}
GvGP(gv) = gp_ref(gp);
- GvSV(gv) = NEWSV(72,0);
+#ifndef PERL_DONT_CREATE_GVSV
+ GvSV(gv) = newSV(0);
+#endif
GvLINE(gv) = CopLINE(PL_curcop);
/* XXX Ideally this cast would be replaced with a change to const char*
in the struct. */
AV *
Perl_save_ary(pTHX_ GV *gv)
{
+ dVAR;
AV * const oav = GvAVn(gv);
AV *av;
SSPUSHPTR(oav);
SSPUSHINT(SAVEt_AV);
- GvAV(gv) = Null(AV*);
+ GvAV(gv) = NULL;
av = GvAVn(gv);
if (SvMAGIC(oav))
mg_localize((SV*)oav, (SV*)av);
HV *
Perl_save_hash(pTHX_ GV *gv)
{
+ dVAR;
HV *ohv, *hv;
SSCHECK(3);
SSPUSHPTR(ohv = GvHVn(gv));
SSPUSHINT(SAVEt_HV);
- GvHV(gv) = Null(HV*);
+ GvHV(gv) = NULL;
hv = GvHVn(gv);
if (SvMAGIC(ohv))
mg_localize((SV*)ohv, (SV*)hv);
void
Perl_save_item(pTHX_ register SV *item)
{
+ dVAR;
register SV * const sv = newSVsv(item);
+#ifdef PERL_MAD
+ if (PL_formfeed && item == PL_formfeed)
+ abort();
+#endif
+
SSCHECK(3);
SSPUSHPTR(item); /* remember the pointer */
SSPUSHPTR(sv); /* remember the value */
void
Perl_save_int(pTHX_ int *intp)
{
+ dVAR;
SSCHECK(3);
SSPUSHINT(*intp);
SSPUSHPTR(intp);
}
void
-Perl_save_long(pTHX_ long int *longp)
-{
- SSCHECK(3);
- SSPUSHLONG(*longp);
- SSPUSHPTR(longp);
- SSPUSHINT(SAVEt_LONG);
-}
-
-void
Perl_save_bool(pTHX_ bool *boolp)
{
+ dVAR;
SSCHECK(3);
SSPUSHBOOL(*boolp);
SSPUSHPTR(boolp);
void
Perl_save_I32(pTHX_ I32 *intp)
{
+ dVAR;
SSCHECK(3);
SSPUSHINT(*intp);
SSPUSHPTR(intp);
SSPUSHINT(SAVEt_I32);
}
-void
-Perl_save_I16(pTHX_ I16 *intp)
-{
- SSCHECK(3);
- SSPUSHINT(*intp);
- SSPUSHPTR(intp);
- SSPUSHINT(SAVEt_I16);
-}
-
-void
-Perl_save_I8(pTHX_ I8 *bytep)
-{
- SSCHECK(3);
- SSPUSHINT(*bytep);
- SSPUSHPTR(bytep);
- SSPUSHINT(SAVEt_I8);
-}
-
-void
-Perl_save_iv(pTHX_ IV *ivp)
-{
- SSCHECK(3);
- SSPUSHIV(*ivp);
- SSPUSHPTR(ivp);
- SSPUSHINT(SAVEt_IV);
-}
-
/* Cannot use save_sptr() to store a char* since the SV** cast will
* force word-alignment and we'll miss the pointer.
*/
void
Perl_save_pptr(pTHX_ char **pptr)
{
+ dVAR;
SSCHECK(3);
SSPUSHPTR(*pptr);
SSPUSHPTR(pptr);
void
Perl_save_vptr(pTHX_ void *ptr)
{
+ dVAR;
SSCHECK(3);
SSPUSHPTR(*(char**)ptr);
SSPUSHPTR(ptr);
void
Perl_save_sptr(pTHX_ SV **sptr)
{
+ dVAR;
SSCHECK(3);
SSPUSHPTR(*sptr);
SSPUSHPTR(sptr);
void
Perl_save_padsv(pTHX_ PADOFFSET off)
{
+ dVAR;
SSCHECK(4);
ASSERT_CURPAD_ACTIVE("save_padsv");
SSPUSHPTR(PL_curpad[off]);
SSPUSHINT(SAVEt_PADSV);
}
-SV **
-Perl_save_threadsv(pTHX_ PADOFFSET i)
-{
- Perl_croak(aTHX_ "panic: save_threadsv called in non-threaded perl");
- PERL_UNUSED_ARG(i);
- NORETURN_FUNCTION_END;
-}
-
-void
-Perl_save_nogv(pTHX_ GV *gv)
-{
- SSCHECK(2);
- SSPUSHPTR(gv);
- SSPUSHINT(SAVEt_NSTAB);
-}
-
void
Perl_save_hptr(pTHX_ HV **hptr)
{
+ dVAR;
SSCHECK(3);
SSPUSHPTR(*hptr);
SSPUSHPTR(hptr);
void
Perl_save_aptr(pTHX_ AV **aptr)
{
+ dVAR;
SSCHECK(3);
SSPUSHPTR(*aptr);
SSPUSHPTR(aptr);
void
Perl_save_freesv(pTHX_ SV *sv)
{
+ dVAR;
SSCHECK(2);
SSPUSHPTR(sv);
SSPUSHINT(SAVEt_FREESV);
void
Perl_save_mortalizesv(pTHX_ SV *sv)
{
+ dVAR;
SSCHECK(2);
SSPUSHPTR(sv);
SSPUSHINT(SAVEt_MORTALIZESV);
void
Perl_save_freeop(pTHX_ OP *o)
{
+ dVAR;
SSCHECK(2);
SSPUSHPTR(o);
SSPUSHINT(SAVEt_FREEOP);
void
Perl_save_freepv(pTHX_ char *pv)
{
+ dVAR;
SSCHECK(2);
SSPUSHPTR(pv);
SSPUSHINT(SAVEt_FREEPV);
void
Perl_save_clearsv(pTHX_ SV **svp)
{
+ dVAR;
ASSERT_CURPAD_ACTIVE("save_clearsv");
SSCHECK(2);
SSPUSHLONG((long)(svp-PL_curpad));
void
Perl_save_delete(pTHX_ HV *hv, char *key, I32 klen)
{
+ dVAR;
SSCHECK(4);
SSPUSHINT(klen);
SSPUSHPTR(key);
- SSPUSHPTR(SvREFCNT_inc(hv));
+ SSPUSHPTR(SvREFCNT_inc_simple(hv));
SSPUSHINT(SAVEt_DELETE);
}
void
-Perl_save_list(pTHX_ register SV **sarg, I32 maxsarg)
-{
- register I32 i;
-
- for (i = 1; i <= maxsarg; i++) {
- register SV * const sv = NEWSV(0,0);
- sv_setsv(sv,sarg[i]);
- SSCHECK(3);
- SSPUSHPTR(sarg[i]); /* remember the pointer */
- SSPUSHPTR(sv); /* remember the value */
- SSPUSHINT(SAVEt_ITEM);
- }
-}
-
-void
-Perl_save_destructor(pTHX_ DESTRUCTORFUNC_NOCONTEXT_t f, void* p)
-{
- SSCHECK(3);
- SSPUSHDPTR(f);
- SSPUSHPTR(p);
- SSPUSHINT(SAVEt_DESTRUCTOR);
-}
-
-void
Perl_save_destructor_x(pTHX_ DESTRUCTORFUNC_t f, void* p)
{
+ dVAR;
SSCHECK(3);
SSPUSHDXPTR(f);
SSPUSHPTR(p);
}
void
-Perl_save_aelem(pTHX_ const AV *av, I32 idx, SV **sptr)
+Perl_save_aelem(pTHX_ AV *av, I32 idx, SV **sptr)
{
+ dVAR;
SV *sv;
SvGETMAGIC(*sptr);
SSCHECK(4);
- SSPUSHPTR(SvREFCNT_inc(av));
+ SSPUSHPTR(SvREFCNT_inc_simple(av));
SSPUSHINT(idx);
SSPUSHPTR(SvREFCNT_inc(*sptr));
SSPUSHINT(SAVEt_AELEM);
/* if it gets reified later, the restore will have the wrong refcnt */
if (!AvREAL(av) && AvREIFY(av))
- (void)SvREFCNT_inc(*sptr);
+ SvREFCNT_inc_void(*sptr);
save_scalar_at(sptr);
sv = *sptr;
/* If we're localizing a tied array element, this new sv
void
Perl_save_helem(pTHX_ HV *hv, SV *key, SV **sptr)
{
+ dVAR;
SV *sv;
SvGETMAGIC(*sptr);
SSCHECK(4);
- SSPUSHPTR(SvREFCNT_inc(hv));
- SSPUSHPTR(SvREFCNT_inc(key));
+ SSPUSHPTR(SvREFCNT_inc_simple(hv));
+ SSPUSHPTR(SvREFCNT_inc_simple(key));
SSPUSHPTR(SvREFCNT_inc(*sptr));
SSPUSHINT(SAVEt_HELEM);
save_scalar_at(sptr);
sv_2mortal(sv);
}
+SV*
+Perl_save_svref(pTHX_ SV **sptr)
+{
+ dVAR;
+#ifdef PERL_MAD
+ if (PL_formfeed && *sptr == PL_formfeed)
+ abort();
+#endif
+ SvGETMAGIC(*sptr);
+ SSCHECK(3);
+ SSPUSHPTR(sptr);
+ SSPUSHPTR(SvREFCNT_inc(*sptr));
+ SSPUSHINT(SAVEt_SVREF);
+ return save_scalar_at(sptr);
+}
+
void
Perl_save_op(pTHX)
{
+ dVAR;
SSCHECK(2);
SSPUSHPTR(PL_op);
SSPUSHINT(SAVEt_OP);
I32
Perl_save_alloc(pTHX_ I32 size, I32 pad)
{
+ dVAR;
register const I32 start = pad + ((char*)&PL_savestack[PL_savestack_ix]
- (char*)PL_savestack);
register const I32 elems = 1 + ((size + pad - 1) / sizeof(*PL_savestack));
- /* SSCHECK may not be good enough */
- while (PL_savestack_ix + elems + 2 > PL_savestack_max)
- savestack_grow();
+ SSGROW(elems + 2);
PL_savestack_ix += elems;
SSPUSHINT(elems);
void
Perl_leave_scope(pTHX_ I32 base)
{
+ dVAR;
register SV *sv;
register SV *value;
register GV *gv;
gv = (GV*)SSPOPPTR;
ptr = &GvSV(gv);
av = (AV*)gv; /* what to refcnt_dec */
- goto restore_sv;
+ restore_sv:
+ sv = *(SV**)ptr;
+ DEBUG_S(PerlIO_printf(Perl_debug_log,
+ "restore svref: %p %p:%s -> %p:%s\n",
+ ptr, sv, SvPEEK(sv), value, SvPEEK(value)));
+ *(SV**)ptr = value;
+ SvREFCNT_dec(sv);
+ PL_localizing = 2;
+ SvSETMAGIC(value);
+ PL_localizing = 0;
+ SvREFCNT_dec(value);
+ if (av) /* actually an av, hv or gv */
+ SvREFCNT_dec(av);
+ break;
case SAVEt_GENERIC_PVREF: /* generic pv */
- str = (char*)SSPOPPTR;
ptr = SSPOPPTR;
+ str = (char*)SSPOPPTR;
if (*(char**)ptr != str) {
Safefree(*(char**)ptr);
*(char**)ptr = str;
SvREFCNT_dec(sv);
SvREFCNT_dec(value);
break;
- case SAVEt_SVREF: /* scalar reference */
- value = (SV*)SSPOPPTR;
- ptr = SSPOPPTR;
- av = NULL; /* what to refcnt_dec */
- restore_sv:
- sv = *(SV**)ptr;
- DEBUG_S(PerlIO_printf(Perl_debug_log,
- "restore svref: %p %p:%s -> %p:%s\n",
- ptr, sv, SvPEEK(sv), value, SvPEEK(value)));
- *(SV**)ptr = value;
- SvREFCNT_dec(sv);
- PL_localizing = 2;
- SvSETMAGIC(value);
- PL_localizing = 0;
- SvREFCNT_dec(value);
- if (av) /* actually an av, hv or gv */
- SvREFCNT_dec(av);
- break;
case SAVEt_AV: /* array reference */
av = (AV*)SSPOPPTR;
gv = (GV*)SSPOPPTR;
ptr = SSPOPPTR;
*(int*)ptr = (int)SSPOPINT;
break;
- case SAVEt_LONG: /* long reference */
- ptr = SSPOPPTR;
- *(long*)ptr = (long)SSPOPLONG;
- break;
case SAVEt_BOOL: /* bool reference */
ptr = SSPOPPTR;
*(bool*)ptr = (bool)SSPOPBOOL;
ptr = SSPOPPTR;
*(I32*)ptr = (I32)SSPOPINT;
break;
- case SAVEt_I16: /* I16 reference */
- ptr = SSPOPPTR;
- *(I16*)ptr = (I16)SSPOPINT;
- break;
- case SAVEt_I8: /* I8 reference */
- ptr = SSPOPPTR;
- *(I8*)ptr = (I8)SSPOPINT;
- break;
- case SAVEt_IV: /* IV reference */
- ptr = SSPOPPTR;
- *(IV*)ptr = (IV)SSPOPIV;
- break;
case SAVEt_SPTR: /* SV* reference */
ptr = SSPOPPTR;
*(SV**)ptr = (SV*)SSPOPPTR;
ptr = SSPOPPTR;
*(AV**)ptr = (AV*)SSPOPPTR;
break;
- case SAVEt_NSTAB:
- gv = (GV*)SSPOPPTR;
- (void)sv_clear((SV*)gv);
- break;
case SAVEt_GP: /* scalar reference */
ptr = SSPOPPTR;
gv = (GV*)SSPOPPTR;
- if (SvPVX_const(gv) && SvLEN(gv) > 0) {
- Safefree(SvPVX_mutable(gv));
- }
- SvPV_set(gv, (char *)SSPOPPTR);
- SvCUR_set(gv, (STRLEN)SSPOPIV);
- SvLEN_set(gv, (STRLEN)SSPOPIV);
gp_free(gv);
GvGP(gv) = (GP*)ptr;
if (GvCVu(gv))
ptr = SSPOPPTR;
Safefree(ptr);
break;
+ case SAVEt_FREESHAREDPV:
+ ptr = SSPOPPTR;
+ PerlMemShared_free(ptr);
+ break;
case SAVEt_CLEARSV:
ptr = (void*)&PL_curpad[SSPOPLONG];
sv = *(SV**)ptr;
switch (SvTYPE(sv)) { /* Console ourselves with a new value */
case SVt_PVAV: *(SV**)ptr = (SV*)newAV(); break;
case SVt_PVHV: *(SV**)ptr = (SV*)newHV(); break;
- default: *(SV**)ptr = NEWSV(0,0); break;
+ default: *(SV**)ptr = newSV(0); break;
}
SvREFCNT_dec(sv); /* Cast current value to the winds. */
/* preserve pad nature, but also mark as not live
ptr = SSPOPPTR;
hv = (HV*)ptr;
ptr = SSPOPPTR;
- (void)hv_delete(hv, (char*)ptr, (U32)SSPOPINT, G_DISCARD);
+ (void)hv_delete(hv, (char*)ptr, (I32)SSPOPINT, G_DISCARD);
SvREFCNT_dec(hv);
Safefree(ptr);
break;
- case SAVEt_DESTRUCTOR:
- ptr = SSPOPPTR;
- (*SSPOPDPTR)(ptr);
- break;
case SAVEt_DESTRUCTOR_X:
ptr = SSPOPPTR;
(*SSPOPDXPTR)(aTHX_ ptr);
sv = *(SV**)ptr;
if (sv && sv != &PL_sv_undef) {
if (SvTIED_mg((SV*)av, PERL_MAGIC_tied))
- (void)SvREFCNT_inc(sv);
+ SvREFCNT_inc_void_NN(sv);
goto restore_sv;
}
}
if (oval && oval != &PL_sv_undef) {
ptr = &HeVAL((HE*)ptr);
if (SvTIED_mg((SV*)hv, PERL_MAGIC_tied))
- (void)SvREFCNT_inc(*(SV**)ptr);
+ SvREFCNT_inc_void(*(SV**)ptr);
SvREFCNT_dec(sv);
av = (AV*)hv; /* what to refcnt_dec */
goto restore_sv;
GvHV(PL_hintgv) = NULL;
}
*(I32*)&PL_hints = (I32)SSPOPINT;
+ Perl_refcounted_he_free(aTHX_ PL_compiling.cop_hints);
+ PL_compiling.cop_hints = (struct refcounted_he *) SSPOPPTR;
if (PL_hints & HINT_LOCALIZE_HH) {
SvREFCNT_dec((SV*)GvHV(PL_hintgv));
GvHV(PL_hintgv) = (HV*)SSPOPPTR;
+ assert(GvHV(PL_hintgv));
+ } else if (!GvHV(PL_hintgv)) {
+ /* Need to add a new one manually, else gv_fetchpv() can
+ add one in this code:
+
+ if (SvTYPE(gv) == SVt_PVGV) {
+ if (add) {
+ GvMULTI_on(gv);
+ gv_init_sv(gv, sv_type);
+ if (*name=='!' && sv_type == SVt_PVHV && len==1)
+ require_errno(gv);
+ }
+ return gv;
+ }
+
+ and it won't have the magic set. */
+
+ HV *const hv = newHV();
+ hv_magic(hv, NULL, PERL_MAGIC_hints);
+ GvHV(PL_hintgv) = hv;
}
-
+ assert(GvHV(PL_hintgv));
break;
case SAVEt_COMPPAD:
PL_comppad = (PAD*)SSPOPPTR;
if (PL_comppad)
PL_curpad = AvARRAY(PL_comppad);
else
- PL_curpad = Null(SV**);
+ PL_curpad = NULL;
break;
case SAVEt_PADSV:
{
SvFLAGS(sv) |= val;
}
break;
+ /* These are only saved in mathoms.c */
+ case SAVEt_SVREF: /* scalar reference */
+ value = (SV*)SSPOPPTR;
+ ptr = SSPOPPTR;
+ av = NULL; /* what to refcnt_dec */
+ goto restore_sv;
+ case SAVEt_LONG: /* long reference */
+ ptr = SSPOPPTR;
+ *(long*)ptr = (long)SSPOPLONG;
+ break;
+ case SAVEt_I16: /* I16 reference */
+ ptr = SSPOPPTR;
+ *(I16*)ptr = (I16)SSPOPINT;
+ break;
+ case SAVEt_I8: /* I8 reference */
+ ptr = SSPOPPTR;
+ *(I8*)ptr = (I8)SSPOPINT;
+ break;
+ case SAVEt_IV: /* IV reference */
+ ptr = SSPOPPTR;
+ *(IV*)ptr = (IV)SSPOPIV;
+ break;
+ case SAVEt_NSTAB:
+ gv = (GV*)SSPOPPTR;
+ (void)sv_clear((SV*)gv);
+ break;
+ case SAVEt_DESTRUCTOR:
+ ptr = SSPOPPTR;
+ (*SSPOPDPTR)(ptr);
+ break;
+ case SAVEt_COP_ARYBASE:
+ ptr = SSPOPPTR;
+ i = SSPOPINT;
+ CopARYBASE_set((COP *)ptr, i);
+ break;
+ case SAVEt_COP_WARNINGS:
+ {
+ COP *const cop = SSPOPPTR;
+ ptr = SSPOPPTR;
+
+ if (!specialWARN(cop->cop_warnings))
+ PerlMemShared_free(cop->cop_warnings);
+
+ cop->cop_warnings = ptr;
+ }
+ break;
+ case SAVEt_RE_STATE:
+ {
+ const struct re_save_state *const state
+ = (struct re_save_state *)
+ (PL_savestack + PL_savestack_ix
+ - SAVESTACK_ALLOC_FOR_RE_SAVE_STATE);
+ PL_savestack_ix -= SAVESTACK_ALLOC_FOR_RE_SAVE_STATE;
+
+ if (PL_reg_start_tmp != state->re_state_reg_start_tmp) {
+ Safefree(PL_reg_start_tmp);
+ }
+ if (PL_reg_poscache != state->re_state_reg_poscache) {
+ Safefree(PL_reg_poscache);
+ }
+ Copy(state, &PL_reg_state, 1, struct re_save_state);
+ }
+ break;
default:
Perl_croak(aTHX_ "panic: leave_scope inconsistency");
}
void
Perl_cx_dump(pTHX_ PERL_CONTEXT *cx)
{
+ dVAR;
#ifdef DEBUGGING
PerlIO_printf(Perl_debug_log, "CX %ld = %s\n", (long)(cx - cxstack), PL_block_type[CxTYPE(cx)]);
if (CxTYPE(cx) != CXt_SUBST) {
break;
}
#else
+ PERL_UNUSED_CONTEXT;
PERL_UNUSED_ARG(cx);
#endif /* DEBUGGING */
}