This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make PL_tmps_floor restore consistent
authorDavid Mitchell <davem@iabyn.com>
Mon, 12 Oct 2015 11:02:05 +0000 (12:02 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:42 +0000 (08:59 +0000)
On scope exit this is done:

    PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;

This is mostly contained within the POPFOO macros; for those,
make it consistently the last entry in the macro. POPEVAL
didn't include this line; move it into the macro and out of the
various places where it's done explicitly.

This will allow us to move it into a revamped POPBLOCK macro shortly.

cop.h
pp_ctl.c

diff --git a/cop.h b/cop.h
index 51782eb..8fe3a9d 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -678,11 +678,11 @@ 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;    \
         CvDEPTH((const CV*)cx->blk_sub.cv) = cx->blk_sub.olddepth;      \
        SvREFCNT_dec_NN(cx->blk_sub.cv);                                \
+        PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;             \
     } STMT_END
 
 #define POPFORMAT(cx)                                                  \
@@ -692,7 +692,6 @@ struct block_format {
        CV * const cv = cx->blk_format.cv;                              \
        GV * const dfuot = cx->blk_format.dfoutgv;                      \
         cx->blk_u16 |= CxPOPSUB_DONE;                                   \
-        PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;             \
        setdefout(dfuot);                                               \
         PL_comppad = cx->blk_format.prevcomppad;                        \
         PL_curpad = LIKELY(PL_comppad) ? AvARRAY(PL_comppad) : NULL;    \
@@ -700,6 +699,7 @@ struct block_format {
        SvREFCNT_dec_NN(cx->blk_format.cv);                             \
        SvREFCNT_dec_NN(dfuot);                                         \
         }                                                               \
+        PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;             \
     } STMT_END
 
 /* eval context */
@@ -745,6 +745,7 @@ struct block_eval {
            SvREFCNT_dec_NN(cx->blk_eval.cur_text);                     \
        if (cx->blk_eval.old_namesv)                                    \
            sv_2mortal(cx->blk_eval.old_namesv);                        \
+        PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;             \
     } STMT_END
 
 /* loop context */
index 2cc669d..db7ceb5 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1519,7 +1519,6 @@ Perl_dounwind(pTHX_ I32 cxix)
            break;
        case CXt_EVAL:
            POPEVAL(cx);
-            PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;
            break;
        case CXt_BLOCK:
             POPBASICBLK(cx);
@@ -1666,8 +1665,6 @@ Perl_die_unwind(pTHX_ SV *msv)
            restartjmpenv = cx->blk_eval.cur_top_env;
            restartop = cx->blk_eval.retop;
 
-            PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;
-
            if (optype == OP_REQUIRE) {
                 assert (PL_curcop == oldcop);
                 (void)hv_store(GvHVn(PL_incgv),
@@ -3437,8 +3434,6 @@ S_doeval(pTHX_ int gimme, CV* outside, U32 seq, HV *hh)
            POPBLOCK(cx,PL_curpm);
            POPEVAL(cx);
            namesv = cx->blk_eval.old_namesv;
-           /* POPBLOCK has rendered LEAVE_with_name("evalcomp") unnecessary */
-            PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;
        }
 
        errsv = ERRSV;
@@ -4296,13 +4291,11 @@ PP(pp_leaveeval)
                        SvPVX_const(namesv),
                         SvUTF8(namesv) ? -(I32)SvCUR(namesv) : (I32)SvCUR(namesv),
                        G_DISCARD);
-        PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;
        Perl_die(aTHX_ "%"SVf" did not return a true value", SVfARG(namesv));
         NOT_REACHED; /* NOTREACHED */
        /* die_unwind() did LEAVE, or we won't be here */
     }
     else {
-        PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;
         if (!keep)
            CLEAR_ERRSV();
     }
@@ -4322,7 +4315,6 @@ Perl_delete_eval_scope(pTHX)
     POPBLOCK(cx,newpm);
     POPEVAL(cx);
     PL_curpm = newpm;
-    PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;
     PERL_UNUSED_VAR(optype);
 }
 
@@ -4383,8 +4375,6 @@ PP(pp_leavetry)
 
     PL_curpm = newpm;  /* Don't pop $1 et al till now */
 
-    PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;
-
     CLEAR_ERRSV();
     return retop;
 }