This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
move CX_LEAVE_SCOPE into POPEVAL
authorDavid Mitchell <davem@iabyn.com>
Sat, 10 Oct 2015 22:01:55 +0000 (23:01 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:41 +0000 (08:59 +0000)
All the other POPFOO types have CX_LEAVE_SCOPE as their first action.
Add it as the first action of POPEVAL too, and remove all the explicit
calls to CX_LEAVE_SCOPE dotted around near POPEVALs.

Note that this causes a slight change in behaviour in dounwind:
the CX_LEAVE_SCOPE is now done as the first action of POPEVAL there
rather than being done afterwards. This is now consistence will all other
uses of POPEVAL.

cop.h
pp_ctl.c

diff --git a/cop.h b/cop.h
index f7e6f68..25ea120 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -742,6 +742,7 @@ struct block_eval {
 
 #define POPEVAL(cx)                                                    \
     STMT_START {                                                       \
+        CX_LEAVE_SCOPE(cx);                                             \
        PL_in_eval = CxOLD_IN_EVAL(cx);                                 \
        optype = CxOLD_OP_TYPE(cx);                                     \
        PL_eval_root = cx->blk_eval.old_eval_root;                      \
index 47b61b9..111d139 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1521,7 +1521,8 @@ Perl_dounwind(pTHX_ I32 cxix)
            break;
        case CXt_EVAL:
            POPEVAL(cx);
-            /* FALLTHROUGH */
+            PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;
+           break;
        case CXt_BLOCK:
             POPBASICBLK(cx);
            break;
@@ -1659,7 +1660,6 @@ Perl_die_unwind(pTHX_ SV *msv)
            }
 
            POPBLOCK(cx,PL_curpm);
-            CX_LEAVE_SCOPE(cx);
            POPEVAL(cx);
            namesv = cx->blk_eval.old_namesv;
 #ifdef DEBUGGING
@@ -3444,7 +3444,6 @@ S_doeval(pTHX_ int gimme, CV* outside, U32 seq, HV *hh)
            }
            SP = PL_stack_base + POPMARK;       /* pop original mark */
            POPBLOCK(cx,PL_curpm);
-            CX_LEAVE_SCOPE(cx);
            POPEVAL(cx);
            namesv = cx->blk_eval.old_namesv;
            /* POPBLOCK has rendered LEAVE_with_name("evalcomp") unnecessary */
@@ -4283,7 +4282,6 @@ PP(pp_leaveeval)
     if (gimme != G_VOID)
         SP = leave_common(newsp, SP, newsp, gimme, SVs_TEMP, FALSE);
     POPBLOCK(cx,newpm);
-    CX_LEAVE_SCOPE(cx);
     POPEVAL(cx);
     namesv = cx->blk_eval.old_namesv;
     retop = cx->blk_eval.retop;
@@ -4328,7 +4326,6 @@ Perl_delete_eval_scope(pTHX)
     I32 optype;
        
     POPBLOCK(cx,newpm);
-    CX_LEAVE_SCOPE(cx);
     POPEVAL(cx);
     PL_curpm = newpm;
     PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;
@@ -4388,7 +4385,6 @@ PP(pp_leavetry)
                               SVs_PADTMP|SVs_TEMP, FALSE);
     POPBLOCK(cx,newpm);
     retop = cx->blk_eval.retop;
-    CX_LEAVE_SCOPE(cx);
     POPEVAL(cx);
     PERL_UNUSED_VAR(optype);