This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
remove newpm param from POPBLOCK() macro.
authorDavid Mitchell <davem@iabyn.com>
Mon, 12 Oct 2015 14:33:56 +0000 (15:33 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:42 +0000 (08:59 +0000)
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.

cop.h
pp_ctl.c
pp_hot.c
pp_sort.c
pp_sys.c

diff --git a/cop.h b/cop.h
index 7078a7a..5cce43f 100644 (file)
--- 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);                                  \
index 5e9907c..f8127f3 100644 (file)
--- 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;
index d686221..22b9dd4 100644 (file)
--- 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;
index 3bd9f2a..47d4a06 100644 (file)
--- 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);
index 50c7433..6c978eb 100644 (file)
--- 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--;