summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cop.h15
-rw-r--r--pp_ctl.c12
-rw-r--r--pp_hot.c6
-rw-r--r--pp_sort.c4
4 files changed, 11 insertions, 26 deletions
diff --git a/cop.h b/cop.h
index fbaa8a04e8..51782eb233 100644
--- a/cop.h
+++ b/cop.h
@@ -651,7 +651,7 @@ struct block_format {
AvFILLp(ary) = -1; \
} STMT_END
-#define POPSUB(cx,sv) \
+#define POPSUB(cx) \
STMT_START { \
CX_LEAVE_SCOPE(cx); \
if (!(cx->blk_u16 & CxPOPSUB_DONE)) { \
@@ -681,13 +681,8 @@ struct block_format {
PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor; \
PL_comppad = cx->blk_sub.prevcomppad; \
PL_curpad = LIKELY(PL_comppad) ? AvARRAY(PL_comppad) : NULL; \
- sv = MUTABLE_SV(cx->blk_sub.cv); \
- CvDEPTH((const CV*)sv) = cx->blk_sub.olddepth; \
- } STMT_END
-
-#define LEAVESUB(sv) \
- STMT_START { \
- SvREFCNT_dec(sv); \
+ CvDEPTH((const CV*)cx->blk_sub.cv) = cx->blk_sub.olddepth; \
+ SvREFCNT_dec_NN(cx->blk_sub.cv); \
} STMT_END
#define POPFORMAT(cx) \
@@ -1323,7 +1318,7 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
CX_LEAVE_SCOPE(cx); \
PL_comppad = cx->blk_sub.prevcomppad; \
PL_curpad = LIKELY(PL_comppad) ? AvARRAY(PL_comppad) : NULL; \
- LEAVESUB(multicall_cv); \
+ SvREFCNT_dec_NN(multicall_cv); \
POPSTACK; \
CATCH_SET(multicall_oldcatch); \
SPAGAIN; \
@@ -1340,7 +1335,7 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
cx = &cxstack[cxstack_ix]; \
assert(cx->cx_type & CXp_MULTICALL); \
CvDEPTH(multicall_cv) = cx->blk_sub.olddepth; \
- LEAVESUB(multicall_cv); \
+ SvREFCNT_dec_NN(multicall_cv); \
cx->cx_type = (CXt_SUB|CXp_MULTICALL|flags); \
{ \
/* save a few things that we don't want PUSHSUB to zap */ \
diff --git a/pp_ctl.c b/pp_ctl.c
index d30b520966..796ee4ca55 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1507,7 +1507,6 @@ Perl_dounwind(pTHX_ I32 cxix)
return;
while (cxstack_ix > cxix) {
- SV *sv;
PERL_CONTEXT *cx = &cxstack[cxstack_ix];
DEBUG_CX("UNWIND"); \
/* Note: we don't need to restore the base context info till the end. */
@@ -1516,8 +1515,7 @@ Perl_dounwind(pTHX_ I32 cxix)
POPSUBST(cx);
continue; /* not break */
case CXt_SUB:
- POPSUB(cx,sv);
- LEAVESUB(sv);
+ POPSUB(cx);
break;
case CXt_EVAL:
POPEVAL(cx);
@@ -2303,7 +2301,6 @@ PP(pp_leavesublv)
PMOP *newpm;
I32 gimme;
PERL_CONTEXT *cx;
- SV *sv;
bool ref;
const char *what = NULL;
@@ -2326,7 +2323,6 @@ PP(pp_leavesublv)
ref = !!(CxLVAL(cx) & OPpENTERSUB_INARGS);
if (gimme == G_SCALAR) {
if (CxLVAL(cx) && !ref) { /* Leave it as it is if we can. */
- SV *sv;
if (MARK <= SP) {
if ((SvPADTMP(TOPs) || SvREADONLY(TOPs)) &&
!SvSMAGICAL(TOPs)) {
@@ -2341,8 +2337,7 @@ PP(pp_leavesublv)
what = "undef";
}
croak:
- POPSUB(cx,sv);
- LEAVESUB(sv);
+ POPSUB(cx);
cxstack_ix--;
PL_curpm = cx->blk_oldpm;
Perl_croak(aTHX_
@@ -2413,8 +2408,7 @@ PP(pp_leavesublv)
POPBLOCK(cx,newpm);
cxstack_ix++; /* preserve cx entry on stack for use by POPSUB */
- POPSUB(cx,sv); /* Stack values are safe: release CV and @_ ... */
- LEAVESUB(sv);
+ POPSUB(cx); /* Stack values are safe: release CV and @_ ... */
cxstack_ix--;
PL_curpm = newpm; /* ... and pop $1 et al */
diff --git a/pp_hot.c b/pp_hot.c
index 081c163be1..b5971f30b5 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -3274,7 +3274,6 @@ PP(pp_leavesub)
PMOP *newpm;
I32 gimme;
PERL_CONTEXT *cx;
- SV *sv;
cx = &cxstack[cxstack_ix];
assert(CxTYPE(cx) == CXt_SUB);
@@ -3308,7 +3307,7 @@ PP(pp_leavesub)
sv_2mortal(*MARK);
}
else {
- sv = SvREFCNT_inc(TOPs); /* FREETMPS could clobber it */
+ SV *sv = SvREFCNT_inc(TOPs); /* FREETMPS could clobber it */
FREETMPS;
*MARK = sv_mortalcopy(sv);
SvREFCNT_dec_NN(sv);
@@ -3340,8 +3339,7 @@ PP(pp_leavesub)
POPBLOCK(cx,newpm);
cxstack_ix++; /* temporarily protect top context */
- POPSUB(cx,sv); /* Stack values are safe: release CV and @_ ... */
- LEAVESUB(sv);
+ POPSUB(cx); /* Stack values are safe: release CV and @_ ... */
cxstack_ix--;
PL_curpm = newpm; /* ... and pop $1 et al */
diff --git a/pp_sort.c b/pp_sort.c
index fbbf84811e..1de1ca94d3 100644
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1707,12 +1707,10 @@ PP(pp_sort)
sort_flags);
if (!(flags & OPf_SPECIAL)) {
- SV *sv;
/* Reset cx, in case the context stack has been
reallocated. */
cx = &cxstack[cxstack_ix];
- POPSUB(cx, sv);
- LEAVESUB(sv);
+ POPSUB(cx);
}
else
/* mimic POPSUB */