This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
move blku_old_savestack_ix to base of cxt struct
authorDavid Mitchell <davem@iabyn.com>
Thu, 15 Oct 2015 13:15:57 +0000 (14:15 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:43 +0000 (08:59 +0000)
The previous commit moved the "old savestack" field of substitution
contexts into the shared root of the context union. This commit does the
same for all other context types

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

diff --git a/cop.h b/cop.h
index 8a45b09..e1f429d 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -572,8 +572,7 @@ struct block_format {
 
 /* free all savestack items back to the watermark of the specified context */
 
-#define CX_LEAVE_SCOPE(cx) \
-    LEAVE_SCOPE(cx->cx_u.cx_blk.blku_old_savestack_ix)
+#define CX_LEAVE_SCOPE(cx) LEAVE_SCOPE(cx->cx_old_savestack_ix)
 
 /* base for the next two macros. Don't use directly.
  * The context frame holds a reference to the CV so that it can't be
@@ -625,7 +624,7 @@ struct block_format {
        cx->blk_format.dfoutgv = PL_defoutgv;                           \
        cx->blk_format.prevcomppad = PL_comppad;                        \
        cx->blk_u16 = 0;                                                \
-        cx->cx_u.cx_blk.blku_old_savestack_ix = PL_savestack_ix;        \
+        cx->cx_old_savestack_ix = PL_savestack_ix;                      \
        SvREFCNT_inc_simple_void_NN(cv);                                \
        CvDEPTH(cv)++;                                                  \
        SvREFCNT_inc_void(cx->blk_format.dfoutgv)
@@ -785,7 +784,7 @@ struct block_loop {
        cx->blk_loop.my_op = cLOOP;                                     \
        cx->blk_loop.state_u.ary.ary = NULL;                            \
        cx->blk_loop.state_u.ary.ix = 0;                                \
-        cx->cx_u.cx_blk.blku_old_savestack_ix = PL_savestack_ix;        \
+        cx->cx_old_savestack_ix = PL_savestack_ix;                      \
        cx->blk_loop.itervar_u.svp = NULL;                              \
        cx->blk_loop.itersave = NULL;
 
@@ -801,7 +800,7 @@ struct block_loop {
        cx->blk_loop.state_u.ary.ary = NULL;                            \
        cx->blk_loop.state_u.ary.ix = 0;                                \
        cx->blk_loop.itervar_u.svp = (SV**)(ivar);                      \
-        cx->cx_u.cx_blk.blku_old_savestack_ix = PL_savestack_ix;        \
+        cx->cx_old_savestack_ix = PL_savestack_ix;                      \
         cx->blk_loop.itersave = isave;                                  \
         PUSHLOOP_FOR_setpad(cx);
 
@@ -829,7 +828,7 @@ struct block_givwhen {
 };
 
 #define PUSHWHEN(cx)                                                   \
-        cx->cx_u.cx_blk.blku_old_savestack_ix = PL_savestack_ix;        \
+        cx->cx_old_savestack_ix = PL_savestack_ix;                      \
        cx->blk_givwhen.leave_op = cLOGOP->op_other;
 
 #define PUSHGIVEN(cx, orig_var)                                         \
@@ -847,7 +846,7 @@ struct block_givwhen {
 /* basic block, i.e. pp_enter/leave */
 
 #define PUSHBASICBLK(cx)                                                \
-        cx->cx_u.cx_blk.blku_old_savestack_ix = PL_savestack_ix;
+        cx->cx_old_savestack_ix = PL_savestack_ix;
 
 #define POPBASICBLK(cx)                                                 \
        NOOP;
@@ -864,7 +863,6 @@ struct block {
     I32                blku_oldscopesp;        /* scope stack index */
     PMOP *     blku_oldpm;     /* values of pattern match vars */
     SSize_t     blku_old_tmpsfloor;     /* saved PL_tmps_floor */
-    I32         blku_old_savestack_ix;  /* saved PL_savestack_ix */
 
     union {
        struct block_sub        blku_sub;
@@ -896,7 +894,7 @@ struct block {
                    (long)PL_scopestack_ix,                             \
                    (long)(cxstack[cxstack_ix].blk_oldscopesp),         \
                    (long)PL_savestack_ix,                              \
-                   (long)(cxstack[cxstack_ix].cx_u.cx_blk.blku_old_savestack_ix),\
+                   (long)(cxstack[cxstack_ix].cx_old_savestack_ix),    \
                    __FILE__, __LINE__));
 
 /* Enter a block. */
@@ -921,8 +919,8 @@ struct block {
         /* LEAVE_SCOPE() should have made this true. /(?{})/ cheats
          * and leaves a CX entry lying around for repeated use, so
          * skip for multicall */                  \
-        assert((CxTYPE(cx) == CXt_SUB && CxMULTICALL(cx)) ||            \
-            PL_savestack_ix == cx->cx_u.cx_blk.blku_old_savestack_ix);  \
+        assert(   (CxTYPE(cx) == CXt_SUB && CxMULTICALL(cx))            \
+                || PL_savestack_ix == cx->cx_old_savestack_ix);         \
         PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;             \
        PL_curpm         = cx->blk_oldpm;
 
@@ -993,7 +991,7 @@ struct subst {
 #define CxONCE(cx)             ((cx)->cx_type & CXp_ONCE)
 
 struct context {
-    I32                        cx_old_savestack_ix;
+    I32                        cx_old_savestack_ix;   /* saved PL_savestack_ix */
     union {
        struct block    cx_blk;
        struct subst    cx_subst;
@@ -1262,7 +1260,7 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
        PUSHSTACKi(PERLSI_MULTICALL);                                   \
        PUSHBLOCK(cx, (CXt_SUB|CXp_MULTICALL|flags), PL_stack_sp);      \
        PUSHSUB(cx);                                                    \
-        cx->cx_u.cx_blk.blku_old_savestack_ix = PL_savestack_ix;        \
+        cx->cx_old_savestack_ix = PL_savestack_ix;                      \
        SAVEVPTR(PL_op);                                                \
         if (!(flags & CXp_SUB_RE_FAKE))                                 \
             CvDEPTH(cv)++;                                             \
index 8564af3..a35e80c 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -285,7 +285,7 @@ PP(pp_substcont)
            /* PL_tainted must be correctly set for this mg_set */
            SvSETMAGIC(TARG);
            TAINT_NOT;
-           LEAVE_SCOPE(cx->cx_old_savestack_ix);
+           CX_LEAVE_SCOPE(cx);
            POPSUBST(cx);
            PERL_ASYNC_CHECK();
            RETURNOP(pm->op_next);
@@ -1996,7 +1996,7 @@ PP(pp_dbstate)
            PUSHBLOCK(cx, CXt_SUB, SP);
            PUSHSUB_DB(cx);
            cx->blk_sub.retop = PL_op->op_next;
-            cx->cx_u.cx_blk.blku_old_savestack_ix = PL_savestack_ix;
+            cx->cx_old_savestack_ix = PL_savestack_ix;
 
             SAVEI32(PL_debug);
             PL_debug = 0;
@@ -4102,7 +4102,7 @@ PP(pp_require)
     /* switch to eval mode */
     PUSHBLOCK(cx, CXt_EVAL, SP);
     PUSHEVAL(cx, name);
-    cx->cx_u.cx_blk.blku_old_savestack_ix = old_savestack_ix;
+    cx->cx_old_savestack_ix = old_savestack_ix;
     cx->blk_eval.retop = PL_op->op_next;
 
     SAVECOPLINE(&PL_compiling);
@@ -4218,7 +4218,7 @@ PP(pp_entereval)
 
     PUSHBLOCK(cx, (CXt_EVAL|CXp_REAL), SP);
     PUSHEVAL(cx, 0);
-    cx->cx_u.cx_blk.blku_old_savestack_ix = old_savestack_ix;
+    cx->cx_old_savestack_ix = old_savestack_ix;
     cx->blk_eval.retop = PL_op->op_next;
 
     /* prepare to compile string */
@@ -4354,7 +4354,7 @@ Perl_create_eval_scope(pTHX_ U32 flags)
        
     PUSHBLOCK(cx, (CXt_EVAL|CXp_TRYBLOCK), PL_stack_sp);
     PUSHEVAL(cx, 0);
-    cx->cx_u.cx_blk.blku_old_savestack_ix = PL_savestack_ix;
+    cx->cx_old_savestack_ix = PL_savestack_ix;
 
     PL_in_eval = EVAL_INEVAL;
     if (flags & G_KEEPERR)
index 147f9cb..5f2523c 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -3551,7 +3551,7 @@ PP(pp_entersub)
         hasargs = cBOOL(PL_op->op_flags & OPf_STACKED);
        PUSHSUB(cx);
        cx->blk_sub.retop = PL_op->op_next;
-        cx->cx_u.cx_blk.blku_old_savestack_ix = old_savestack_ix;
+        cx->cx_old_savestack_ix = old_savestack_ix;
 
        padlist = CvPADLIST(cv);
        if (UNLIKELY((depth = ++CvDEPTH(cv)) >= 2)) {
index 63214b9..8a4bb0f 100644 (file)
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1691,7 +1691,7 @@ PP(pp_sort)
 
                }
            }
-            cx->cx_u.cx_blk.blku_old_savestack_ix = old_savestack_ix;
+            cx->cx_old_savestack_ix = old_savestack_ix;
 
            start = p1 - max;
            sortsvp(aTHX_ start, max,