rename PUSHBLOCK,PUSHSUB etc to CX_PUSHBLOCK etc
authorDavid Mitchell <davem@iabyn.com>
Sat, 26 Dec 2015 22:28:59 +0000 (22:28 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 09:19:19 +0000 (09:19 +0000)
Earlier all the POPFOO macros were renamed to CX_POPFOO to reflect
the changed API (like POPBLOCK no longer decremented cxstack_ix).

Now rename the PUSH ones for consistency.

cop.h
op.h
perl.c
pp_ctl.c
pp_hot.c
pp_sort.c
pp_sys.c
scope.c

diff --git a/cop.h b/cop.h
index 134ffd7..2815454 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -595,7 +595,7 @@ struct block_format {
  * The context frame holds a reference to the CV so that it can't be
  * freed while we're executing it */
 
-#define PUSHSUB_BASE(cx, cv, op, hasargs)                              \
+#define CX_PUSHSUB_BASE(cx, cv, op, hasargs)                           \
        ENTRY_PROBE(CvNAMED(cv)                                         \
                        ? HEK_KEY(CvNAME_HEK(cv))                       \
                        : GvENAME(CvGV(cv)),                            \
@@ -610,7 +610,7 @@ struct block_format {
        cx->blk_sub.retop = op;                                         \
         SvREFCNT_inc_simple_void_NN(cv);
 
-#define PUSHSUB_GET_LVALUE_MASK(func) \
+#define CX_PUSHSUB_GET_LVALUE_MASK(func) \
        /* If the context is indeterminate, then only the lvalue */     \
        /* flags that the caller also has are applicable.        */     \
        (                                                               \
@@ -620,21 +620,21 @@ struct block_format {
                   ? 0 : (U8)func(aTHX)                                 \
        )
 
-#define PUSHSUB(cx, cv, op, hasargs)                                   \
+#define CX_PUSHSUB(cx, cv, op, hasargs)                                        \
     {                                                                  \
-       U8 phlags = PUSHSUB_GET_LVALUE_MASK(Perl_was_lvalue_sub);       \
-       PUSHSUB_BASE(cx, cv, op, hasargs)                               \
+       U8 phlags = CX_PUSHSUB_GET_LVALUE_MASK(Perl_was_lvalue_sub);    \
+       CX_PUSHSUB_BASE(cx, cv, op, hasargs)                            \
        cx->blk_u16 = PL_op->op_private &                               \
                          (phlags|OPpDEREF);                            \
     }
 
 /* variant for use by OP_DBSTATE, where op_private holds hint bits */
-#define PUSHSUB_DB(cx, cv, op, hasargs)                                        \
-       PUSHSUB_BASE(cx, cv, op, hasargs)                               \
+#define CX_PUSHSUB_DB(cx, cv, op, hasargs)                             \
+       CX_PUSHSUB_BASE(cx, cv, op, hasargs)                            \
        cx->blk_u16 = 0;
 
 
-#define PUSHFORMAT(cx, cv, gv, retop)                                  \
+#define CX_PUSHFORMAT(cx, cv, gv, retop)                               \
        cx->blk_format.cv = cv;                                         \
        cx->blk_format.gv = gv;                                         \
        cx->blk_format.retop = (retop);                                 \
@@ -747,7 +747,7 @@ struct block_eval {
 #define CxOLD_IN_EVAL(cx)      (((cx)->blk_u16) & 0x7F)
 #define CxOLD_OP_TYPE(cx)      (((cx)->blk_u16) >> 7)
 
-#define PUSHEVAL(cx, op, n)                                            \
+#define CX_PUSHEVAL(cx, op, n)                                         \
     STMT_START {                                                       \
        assert(!(PL_in_eval & ~0x7F));                                  \
        assert(!(PL_op->op_type & ~0x1FF));                             \
@@ -833,20 +833,20 @@ struct block_loop {
 #define CxLVAL(c)      (0 + ((c)->blk_u16 & 0xff))
 
 
-#define PUSHLOOP_PLAIN(cx)                                             \
+#define CX_PUSHLOOP_PLAIN(cx)                                          \
        cx->blk_loop.my_op = cLOOP;
 
 #ifdef USE_ITHREADS
-#  define PUSHLOOP_FOR_setpad(c) (c)->blk_loop.oldcomppad = PL_comppad
+#  define CX_PUSHLOOP_FOR_setpad(c) (c)->blk_loop.oldcomppad = PL_comppad
 #else
-#  define PUSHLOOP_FOR_setpad(c) NOOP
+#  define CX_PUSHLOOP_FOR_setpad(c) NOOP
 #endif
 
-#define PUSHLOOP_FOR(cx, ivar, isave)                                  \
-       PUSHLOOP_PLAIN(cx);                                             \
+#define CX_PUSHLOOP_FOR(cx, ivar, isave)                               \
+       CX_PUSHLOOP_PLAIN(cx);                                          \
        cx->blk_loop.itervar_u.svp = (SV**)(ivar);                      \
         cx->blk_loop.itersave = isave;                                  \
-        PUSHLOOP_FOR_setpad(cx);
+        CX_PUSHLOOP_FOR_setpad(cx);
 
 #define CX_POPLOOP(cx)                                                 \
         assert(CxTYPE_is_LOOP(cx));                                     \
@@ -881,11 +881,11 @@ struct block_givwhen {
         SV *defsv_save; /* the original $_ */
 };
 
-#define PUSHWHEN(cx)                                                   \
+#define CX_PUSHWHEN(cx)                                                \
        cx->blk_givwhen.leave_op = cLOGOP->op_other;
 
-#define PUSHGIVEN(cx, orig_var)                                         \
-        PUSHWHEN(cx);                                                   \
+#define CX_PUSHGIVEN(cx, orig_var)                                      \
+        CX_PUSHWHEN(cx);                                                \
         cx->blk_givwhen.defsv_save = orig_var;
 
 #define CX_POPWHEN(cx)                                                  \
@@ -952,7 +952,7 @@ struct block {
                    __FILE__, __LINE__));
 
 /* Enter a block. */
-#define PUSHBLOCK(cx, t, gimme, sp, saveix)                             \
+#define CX_PUSHBLOCK(cx, t, gimme, sp, saveix)                          \
         CXINC,                                                          \
         cx = CX_CUR(),                                                 \
        cx->cx_type             = t,                                    \
@@ -1025,7 +1025,7 @@ struct subst {
 #define sb_rx          cx_u.cx_subst.sbu_rx
 
 #ifdef PERL_CORE
-#  define PUSHSUBST(cx) CXINC, cx = CX_CUR(),                          \
+#  define CX_PUSHSUBST(cx) CXINC, cx = CX_CUR(),                       \
        cx->blk_oldsaveix = oldsave,                                    \
        cx->sb_iters            = iters,                                \
        cx->sb_maxiters         = maxiters,                             \
@@ -1318,7 +1318,7 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
     OP *multicall_cop;                                                 \
     bool multicall_oldcatch;                                           \
     I32 saveix_floor;                                                   \
-    U8 hasargs = 0             /* used by PUSHSUB */
+    U8 hasargs = 0             /* used by CX_PUSHSUB */
 
 #define PUSH_MULTICALL(the_cv) \
     PUSH_MULTICALL_FLAGS(the_cv, 0)
@@ -1334,9 +1334,9 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
        multicall_oldcatch = CATCH_GET;                                 \
        CATCH_SET(TRUE);                                                \
        PUSHSTACKi(PERLSI_MULTICALL);                                   \
-       PUSHBLOCK(cx, (CXt_SUB|CXp_MULTICALL|flags), gimme,             \
+       CX_PUSHBLOCK(cx, (CXt_SUB|CXp_MULTICALL|flags), gimme,          \
                   PL_stack_sp, PL_savestack_ix);                       \
-       PUSHSUB(cx, cv, NULL, hasargs);                                 \
+       CX_PUSHSUB(cx, cv, NULL, hasargs);                              \
        SAVEOP();                                                       \
         saveix_floor = PL_savestack_ix;                                 \
         if (!(flags & CXp_SUB_RE_FAKE))                                 \
@@ -1385,7 +1385,7 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
        assert(CxMULTICALL(cx));                                        \
         CX_POPSUB_COMMON(cx);                                           \
        cx->cx_type = (CXt_SUB|CXp_MULTICALL|flags);                    \
-        PUSHSUB(cx, cv, NULL, hasargs);                                        \
+        CX_PUSHSUB(cx, cv, NULL, hasargs);                             \
         if (!(flags & CXp_SUB_RE_FAKE))                                 \
             CvDEPTH(cv)++;                                             \
        if (CvDEPTH(cv) >= 2)                                           \
diff --git a/op.h b/op.h
index 13afa8a..676dd48 100644 (file)
--- a/op.h
+++ b/op.h
@@ -67,7 +67,7 @@ typedef PERL_BITFIELD16 Optype;
     U8         op_private;
 #endif
 
-/* If op_type:9 is changed to :10, also change PUSHEVAL in cop.h.
+/* If op_type:9 is changed to :10, also change CX_PUSHEVAL in cop.h.
    Also, if the type of op_type is ever changed (e.g. to PERL_BITFIELD32)
    then all the other bit-fields before/after it should change their
    types too to let VC pack them into the same 4 byte integer.*/
diff --git a/perl.c b/perl.c
index 9858f16..1160e32 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -2893,7 +2893,7 @@ Perl_eval_sv(pTHX_ SV *sv, I32 flags)
        myop.op_private = (OPpEVAL_COPHH | OPpEVAL_RE_REPARSING);
 
     /* fail now; otherwise we could fail after the JMPENV_PUSH but
-     * before a PUSHEVAL, which corrupts the stack after a croak */
+     * before a CX_PUSHEVAL, which corrupts the stack after a croak */
     TAINT_PROPER("eval_sv()");
 
     JMPENV_PUSH(ret);
index fd6309b..d6c5275 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1366,7 +1366,7 @@ Perl_is_lvalue_sub(pTHX)
        return 0;
 }
 
-/* only used by PUSHSUB */
+/* only used by CX_PUSHSUB */
 I32
 Perl_was_lvalue_sub(pTHX)
 {
@@ -2011,8 +2011,8 @@ PP(pp_dbstate)
            return NORMAL;
        }
        else {
-           PUSHBLOCK(cx, CXt_SUB, gimme, SP, PL_savestack_ix);
-           PUSHSUB_DB(cx, cv, PL_op->op_next, 0);
+           CX_PUSHBLOCK(cx, CXt_SUB, gimme, SP, PL_savestack_ix);
+           CX_PUSHSUB_DB(cx, cv, PL_op->op_next, 0);
 
             SAVEI32(PL_debug);
             PL_debug = 0;
@@ -2035,7 +2035,7 @@ PP(pp_enter)
     PERL_CONTEXT *cx;
     I32 gimme = GIMME_V;
 
-    PUSHBLOCK(cx, CXt_BLOCK, gimme, SP, PL_savestack_ix);
+    CX_PUSHBLOCK(cx, CXt_BLOCK, gimme, SP, PL_savestack_ix);
 
     RETURN;
 }
@@ -2138,8 +2138,8 @@ PP(pp_enteriter)
      * there mustn't be anything in the blk_loop substruct that requires
      * freeing or undoing, in case we die in the meantime. And vice-versa.
      */
-    PUSHBLOCK(cx, cxflags, gimme, MARK, PL_savestack_ix);
-    PUSHLOOP_FOR(cx, itervarp, itersave);
+    CX_PUSHBLOCK(cx, cxflags, gimme, MARK, PL_savestack_ix);
+    CX_PUSHLOOP_FOR(cx, itervarp, itersave);
 
     if (PL_op->op_flags & OPf_STACKED) {
         /* OPf_STACKED implies either a single array: for(@), with a
@@ -2213,8 +2213,8 @@ PP(pp_enterloop)
     PERL_CONTEXT *cx;
     const I32 gimme = GIMME_V;
 
-    PUSHBLOCK(cx, CXt_LOOP_PLAIN, gimme, SP, PL_savestack_ix);
-    PUSHLOOP_PLAIN(cx);
+    CX_PUSHBLOCK(cx, CXt_LOOP_PLAIN, gimme, SP, PL_savestack_ix);
+    CX_PUSHLOOP_PLAIN(cx);
 
     RETURN;
 }
@@ -2824,7 +2824,7 @@ PP(pp_goto)
 
                 SAVEFREESV(cv); /* later, undo the 'avoid premature free' hack */
 
-                /* partial unrolled PUSHSUB(): */
+                /* partial unrolled CX_PUSHSUB(): */
 
                cx->blk_sub.cv = cv;
                cx->blk_sub.olddepth = CvDEPTH(cv);
@@ -4042,8 +4042,8 @@ PP(pp_require)
     }
 
     /* switch to eval mode */
-    PUSHBLOCK(cx, CXt_EVAL, gimme, SP, old_savestack_ix);
-    PUSHEVAL(cx, PL_op->op_next, newSVpv(name, 0));
+    CX_PUSHBLOCK(cx, CXt_EVAL, gimme, SP, old_savestack_ix);
+    CX_PUSHEVAL(cx, PL_op->op_next, newSVpv(name, 0));
 
     SAVECOPLINE(&PL_compiling);
     CopLINE_set(&PL_compiling, 0);
@@ -4156,8 +4156,8 @@ PP(pp_entereval)
      * to do the dirty work for us */
     runcv = find_runcv(&seq);
 
-    PUSHBLOCK(cx, (CXt_EVAL|CXp_REAL), gimme, SP, old_savestack_ix);
-    PUSHEVAL(cx, PL_op->op_next, NULL);
+    CX_PUSHBLOCK(cx, (CXt_EVAL|CXp_REAL), gimme, SP, old_savestack_ix);
+    CX_PUSHEVAL(cx, PL_op->op_next, NULL);
 
     /* prepare to compile string */
 
@@ -4286,8 +4286,9 @@ Perl_create_eval_scope(pTHX_ OP *retop, U32 flags)
     PERL_CONTEXT *cx;
     const I32 gimme = GIMME_V;
        
-    PUSHBLOCK(cx, (CXt_EVAL|CXp_TRYBLOCK), gimme, PL_stack_sp, PL_savestack_ix);
-    PUSHEVAL(cx, retop, NULL);
+    CX_PUSHBLOCK(cx, (CXt_EVAL|CXp_TRYBLOCK), gimme,
+                    PL_stack_sp, PL_savestack_ix);
+    CX_PUSHEVAL(cx, retop, NULL);
 
     PL_in_eval = EVAL_INEVAL;
     if (flags & G_KEEPERR)
@@ -4344,8 +4345,8 @@ PP(pp_entergiven)
     assert(!PL_op->op_targ); /* used to be set for lexical $_ */
     GvSV(PL_defgv) = SvREFCNT_inc(newsv);
 
-    PUSHBLOCK(cx, CXt_GIVEN, gimme, SP, PL_savestack_ix);
-    PUSHGIVEN(cx, origsv);
+    CX_PUSHBLOCK(cx, CXt_GIVEN, gimme, SP, PL_savestack_ix);
+    CX_PUSHGIVEN(cx, origsv);
 
     RETURN;
 }
@@ -4924,8 +4925,8 @@ PP(pp_enterwhen)
     if ((0 == (PL_op->op_flags & OPf_SPECIAL)) && !SvTRUEx(POPs))
        RETURNOP(cLOGOP->op_other->op_next);
 
-    PUSHBLOCK(cx, CXt_WHEN, gimme, SP, PL_savestack_ix);
-    PUSHWHEN(cx);
+    CX_PUSHBLOCK(cx, CXt_WHEN, gimme, SP, PL_savestack_ix);
+    CX_PUSHWHEN(cx);
 
     RETURN;
 }
index 825cf3f..3d72d0d 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -3146,7 +3146,7 @@ PP(pp_subst)
             * searching for places in this sub that uses a particular var:
             * iters maxiters r_flags oldsave rxtainted orig dstr targ
             * s m strend rx once */
-           PUSHSUBST(cx);
+           CX_PUSHSUBST(cx);
            RETURNOP(cPMOP->op_pmreplrootu.op_pmreplroot);
        }
        first = TRUE;
@@ -3763,9 +3763,9 @@ PP(pp_entersub)
     }
 
     /* At this point we want to save PL_savestack_ix, either by doing a
-     * PUSHSUB, or for XS, doing an ENTER. But we don't yet know the final
+     * CX_PUSHSUB, or for XS, doing an ENTER. But we don't yet know the final
      * CV we will be using (so we don't know whether its XS, so we can't
-     * PUSHSUB or ENTER yet), and determining cv may itself push stuff on
+     * CX_PUSHSUB or ENTER yet), and determining cv may itself push stuff on
      * the save stack. So remember where we are currently on the save
      * stack, and later update the CX or scopestack entry accordingly. */
     old_savestack_ix = PL_savestack_ix;
@@ -3852,9 +3852,9 @@ PP(pp_entersub)
         }
 
         gimme = GIMME_V;
-       PUSHBLOCK(cx, CXt_SUB, gimme, MARK, old_savestack_ix);
+       CX_PUSHBLOCK(cx, CXt_SUB, gimme, MARK, old_savestack_ix);
         hasargs = cBOOL(PL_op->op_flags & OPf_STACKED);
-       PUSHSUB(cx, cv, PL_op->op_next, hasargs);
+       CX_PUSHSUB(cx, cv, PL_op->op_next, hasargs);
 
        padlist = CvPADLIST(cv);
        if (UNLIKELY((depth = ++CvDEPTH(cv)) >= 2))
@@ -3911,7 +3911,7 @@ PP(pp_entersub)
        PUTBACK;
 
        if (UNLIKELY(((PL_op->op_private
-              & PUSHSUB_GET_LVALUE_MASK(Perl_is_lvalue_sub)
+              & CX_PUSHSUB_GET_LVALUE_MASK(Perl_is_lvalue_sub)
              ) & OPpENTERSUB_LVAL_MASK) == OPpLVAL_INTRO &&
            !CvLVALUE(cv)))
             DIE(aTHX_ "Can't modify non-lvalue subroutine call of &%"SVf,
index 5f7ae22..2b284d7 100644 (file)
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1668,10 +1668,10 @@ PP(pp_sort)
            }
 
             gimme = G_SCALAR;
-           PUSHBLOCK(cx, CXt_NULL, gimme, PL_stack_base, old_savestack_ix);
+           CX_PUSHBLOCK(cx, CXt_NULL, gimme, PL_stack_base, old_savestack_ix);
            if (!(flags & OPf_SPECIAL)) {
                cx->cx_type = CXt_SUB|CXp_MULTICALL;
-               PUSHSUB(cx, cv, NULL, hasargs);
+               CX_PUSHSUB(cx, cv, NULL, hasargs);
                if (!is_xsub) {
                    PADLIST * const padlist = CvPADLIST(cv);
 
index 5f0cf76..d3cf2e0 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1389,8 +1389,8 @@ S_doform(pTHX_ CV *cv, GV *gv, OP *retop)
     if (CvCLONE(cv))
        cv = MUTABLE_CV(sv_2mortal(MUTABLE_SV(cv_clone(cv))));
 
-    PUSHBLOCK(cx, CXt_FORMAT, gimme, PL_stack_sp, PL_savestack_ix);
-    PUSHFORMAT(cx, cv, gv, retop);
+    CX_PUSHBLOCK(cx, CXt_FORMAT, gimme, PL_stack_sp, PL_savestack_ix);
+    CX_PUSHFORMAT(cx, cv, gv, retop);
     if (CvDEPTH(cv) >= 2)
        pad_push(CvPADLIST(cv), CvDEPTH(cv));
     PAD_SET_CUR_NOSAVE(CvPADLIST(cv), CvDEPTH(cv));
diff --git a/scope.c b/scope.c
index f425be5..db2fef1 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -80,7 +80,7 @@ Perl_new_stackinfo(pTHX_ I32 stitems, I32 cxitems)
     si->si_cxix = -1;
     si->si_type = PERLSI_UNDEF;
     Newx(si->si_cxstack, cxitems, PERL_CONTEXT);
-    /* Without any kind of initialising PUSHSUBST()
+    /* Without any kind of initialising CX_PUSHSUBST()
      * in pp_subst() will read uninitialised heap. */
     PoisonNew(si->si_cxstack, cxitems, PERL_CONTEXT);
     return si;