summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-10-12 15:33:56 +0100
committerDavid Mitchell <davem@iabyn.com>2016-02-03 08:59:42 +0000
commitdd748f4511ead9174b04b875630d7947834c9ed1 (patch)
tree0ad9da5987bff2285c9a4765ee6e21ac64332af5
parent4df352a81ba92beb6467d6dafdf988d8aba963c4 (diff)
downloadperl-dd748f4511ead9174b04b875630d7947834c9ed1.tar.gz
remove newpm param from POPBLOCK() macro.
Since all core usage of POPBLOCK now immediately restores PL_curpm, there's no need to copy the old value to a temp var specified by the caller; just make POPBLOCK itself restore PL_curpm in the same way that it restores all the other PL_ vars.
-rw-r--r--cop.h6
-rw-r--r--pp_ctl.c42
-rw-r--r--pp_hot.c4
-rw-r--r--pp_sort.c2
-rw-r--r--pp_sys.c2
5 files changed, 17 insertions, 39 deletions
diff --git a/cop.h b/cop.h
index 7078a7a0c9..5cce43fb80 100644
--- a/cop.h
+++ b/cop.h
@@ -937,12 +937,12 @@ struct block {
DEBUG_CX("PUSH");
/* Exit a block (RETURN and LAST). */
-#define POPBLOCK(cx,pm) \
+#define POPBLOCK(cx) \
DEBUG_CX("POP"); \
PL_curcop = cx->blk_oldcop, \
PL_markstack_ptr = PL_markstack + cx->blk_oldmarksp, \
PL_scopestack_ix = cx->blk_oldscopesp, \
- pm = cx->blk_oldpm;
+ PL_curpm = cx->blk_oldpm;
/* Continue a block elsewhere (NEXT and REDO). */
#define TOPBLOCK(cx) \
@@ -1318,7 +1318,7 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
/* these two set for backcompat by callers */ \
newsp = PL_stack_base + cx->blk_oldsp; \
gimme = cx->blk_gimme; \
- POPBLOCK(cx,PL_curpm); \
+ POPBLOCK(cx); \
cxstack_ix--; \
POPSTACK; \
CATCH_SET(multicall_oldcatch); \
diff --git a/pp_ctl.c b/pp_ctl.c
index 5e9907cb9e..f8127f3f24 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1657,7 +1657,7 @@ Perl_die_unwind(pTHX_ SV *msv)
}
POPEVAL(cx);
- POPBLOCK(cx,PL_curpm);
+ POPBLOCK(cx);
cxstack_ix--;
namesv = cx->blk_eval.old_namesv;
#ifdef DEBUGGING
@@ -2074,7 +2074,6 @@ PP(pp_leave)
{
PERL_CONTEXT *cx;
SV **newsp;
- PMOP *newpm;
I32 gimme;
cx = &cxstack[cxstack_ix];
@@ -2093,8 +2092,7 @@ PP(pp_leave)
PL_op->op_private & OPpLVALUE);
POPBASICBLK(cx);
- POPBLOCK(cx,newpm);
- PL_curpm = newpm; /* Don't pop $1 et al till now */
+ POPBLOCK(cx);
cxstack_ix--;
return NORMAL;
@@ -2255,7 +2253,6 @@ PP(pp_leaveloop)
PERL_CONTEXT *cx;
I32 gimme;
SV **newsp;
- PMOP *newpm;
SV **mark;
cx = &cxstack[cxstack_ix];
@@ -2271,8 +2268,7 @@ PP(pp_leaveloop)
PL_op->op_private & OPpLVALUE);
POPLOOP(cx); /* Stack values are safe: release loop vars ... */
- POPBLOCK(cx,newpm);
- PL_curpm = newpm; /* ... and pop $1 et al */
+ POPBLOCK(cx);
cxstack_ix--;
return NORMAL;
@@ -2292,7 +2288,6 @@ PP(pp_leavesublv)
dSP;
SV **newsp;
SV **mark;
- PMOP *newpm;
I32 gimme;
PERL_CONTEXT *cx;
bool ref;
@@ -2401,8 +2396,7 @@ PP(pp_leavesublv)
PUTBACK;
POPSUB(cx); /* Stack values are safe: release CV and @_ ... */
- POPBLOCK(cx,newpm);
- PL_curpm = newpm; /* ... and pop $1 et al */
+ POPBLOCK(cx);
cxstack_ix--;
return cx->blk_sub.retop;
@@ -2551,7 +2545,6 @@ S_unwind_loop(pTHX_ const char * const opname)
PP(pp_last)
{
PERL_CONTEXT *cx;
- PMOP *newpm;
S_unwind_loop(aTHX_ "last");
@@ -2569,8 +2562,7 @@ PP(pp_last)
/* Stack values are safe: */
POPLOOP(cx); /* release loop vars ... */
- POPBLOCK(cx,newpm);
- PL_curpm = newpm; /* ... and pop $1 et al */
+ POPBLOCK(cx);
cxstack_ix--;
return cx->blk_loop.my_op->op_lastop->op_next;
@@ -3432,7 +3424,7 @@ S_doeval(pTHX_ int gimme, CV* outside, U32 seq, HV *hh)
SP = PL_stack_base + POPMARK; /* pop original mark */
cx = &cxstack[cxstack_ix];
POPEVAL(cx);
- POPBLOCK(cx,PL_curpm);
+ POPBLOCK(cx);
cxstack_ix--;
namesv = cx->blk_eval.old_namesv;
}
@@ -4249,7 +4241,6 @@ PP(pp_leaveeval)
{
dSP;
SV **newsp;
- PMOP *newpm;
I32 gimme;
PERL_CONTEXT *cx;
OP *retop;
@@ -4279,8 +4270,7 @@ PP(pp_leaveeval)
*/
PL_curcop = cx->blk_oldcop;
POPEVAL(cx);
- POPBLOCK(cx,newpm);
- PL_curpm = newpm; /* Don't pop $1 et al till now */
+ POPBLOCK(cx);
cxstack_ix--;
namesv = cx->blk_eval.old_namesv;
retop = cx->blk_eval.retop;
@@ -4317,14 +4307,12 @@ PP(pp_leaveeval)
void
Perl_delete_eval_scope(pTHX)
{
- PMOP *newpm;
PERL_CONTEXT *cx;
I32 optype;
cx = &cxstack[cxstack_ix];
POPEVAL(cx);
- POPBLOCK(cx,newpm);
- PL_curpm = newpm;
+ POPBLOCK(cx);
cxstack_ix--;
PERL_UNUSED_VAR(optype);
}
@@ -4362,7 +4350,6 @@ PP(pp_entertry)
PP(pp_leavetry)
{
SV **newsp;
- PMOP *newpm;
I32 gimme;
PERL_CONTEXT *cx;
I32 optype;
@@ -4380,13 +4367,11 @@ PP(pp_leavetry)
else
leave_common(newsp, newsp, gimme, SVs_PADTMP|SVs_TEMP, FALSE);
POPEVAL(cx);
- POPBLOCK(cx,newpm);
+ POPBLOCK(cx);
cxstack_ix--;
retop = cx->blk_eval.retop;
PERL_UNUSED_VAR(optype);
- PL_curpm = newpm; /* Don't pop $1 et al till now */
-
CLEAR_ERRSV();
return retop;
}
@@ -4413,7 +4398,6 @@ PP(pp_leavegiven)
PERL_CONTEXT *cx;
I32 gimme;
SV **newsp;
- PMOP *newpm;
PERL_UNUSED_CONTEXT;
cx = &cxstack[cxstack_ix];
@@ -4426,8 +4410,7 @@ PP(pp_leavegiven)
else
leave_common(newsp, newsp, gimme, SVs_PADTMP|SVs_TEMP, FALSE);
POPGIVEN(cx);
- POPBLOCK(cx,newpm);
- PL_curpm = newpm; /* Don't pop $1 et al till now */
+ POPBLOCK(cx);
cxstack_ix--;
return NORMAL;
@@ -5034,8 +5017,6 @@ PP(pp_continue)
{
I32 cxix;
PERL_CONTEXT *cx;
- PMOP *newpm;
-
cxix = dopoptowhen(cxstack_ix);
if (cxix < 0)
@@ -5048,8 +5029,7 @@ PP(pp_continue)
assert(CxTYPE(cx) == CXt_WHEN);
PL_stack_sp = PL_stack_base + cx->blk_oldsp;
POPWHEN(cx);
- POPBLOCK(cx,newpm);
- PL_curpm = newpm; /* pop $1 et al */
+ POPBLOCK(cx);
cxstack_ix--;
return cx->blk_givwhen.leave_op->op_next;
diff --git a/pp_hot.c b/pp_hot.c
index d686221b45..22b9dd4461 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -3271,7 +3271,6 @@ PP(pp_leavesub)
dSP;
SV **mark;
SV **newsp;
- PMOP *newpm;
I32 gimme;
PERL_CONTEXT *cx;
@@ -3338,8 +3337,7 @@ PP(pp_leavesub)
PUTBACK;
POPSUB(cx); /* Stack values are safe: release CV and @_ ... */
- POPBLOCK(cx,newpm);
- PL_curpm = newpm; /* ... and pop $1 et al */
+ POPBLOCK(cx);
cxstack_ix--;
return cx->blk_sub.retop;
diff --git a/pp_sort.c b/pp_sort.c
index 3bd9f2aabf..47d4a064a2 100644
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1720,7 +1720,7 @@ PP(pp_sort)
/* mimic POPSUB */
PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;
- POPBLOCK(cx,PL_curpm);
+ POPBLOCK(cx);
cxstack_ix--;
POPSTACK;
CATCH_SET(oldcatch);
diff --git a/pp_sys.c b/pp_sys.c
index 50c7433787..6c978eb257 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1524,7 +1524,7 @@ PP(pp_leavewrite)
assert(CxTYPE(cx) == CXt_FORMAT);
SP = PL_stack_base + cx->blk_oldsp; /* ignore retval of formline */
POPFORMAT(cx);
- POPBLOCK(cx,PL_curpm);
+ POPBLOCK(cx);
retop = cx->blk_sub.retop;
cxstack_ix--;