Eliminate hasargs from structs block_sub and block_format by storing
Nicholas Clark [Sun, 20 Jan 2008 22:20:56 +0000 (22:20 +0000)]
it with a private flag CXp_HASARGS in cx_type. (It's only a boolean.)

p4raw-id: //depot/perl@33018

cop.h
pp_ctl.c

diff --git a/cop.h b/cop.h
index c03dfdc..4dbc197 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -282,7 +282,6 @@ struct block_sub {
     OP *       retop;  /* op to execute on exit from sub */
     /* Above here is the same for sub, format and eval.  */
     CV *       cv;
-    U8         hasargs;
     U8         lval;           /* XXX merge lval and hasargs? */
     /* Above here is the same for sub and format.  */
     AV *       savearray;
@@ -297,7 +296,6 @@ struct block_format {
     OP *       retop;  /* op to execute on exit from sub */
     /* Above here is the same for sub, format and eval.  */
     CV *       cv;
-    U8         hasargs;
     U8         lval;           /* XXX merge lval and hasargs? */
     /* Above here is the same for sub and format.  */
     GV *       gv;
@@ -315,7 +313,7 @@ struct block_format {
                                                                        \
        cx->blk_sub.cv = cv;                                            \
        cx->blk_sub.olddepth = CvDEPTH(cv);                             \
-       cx->blk_sub.hasargs = hasargs;                                  \
+       cx->cx_type |= (hasargs) ? CXp_HASARGS : 0;                     \
        cx->blk_sub.retop = NULL;                                       \
        if (!CvDEPTH(cv)) {                                             \
            SvREFCNT_inc_simple_void_NN(cv);                            \
@@ -339,7 +337,6 @@ struct block_format {
        cx->blk_format.cv = cv;                                         \
        cx->blk_format.gv = gv;                                         \
        cx->blk_format.retop = (retop);                                 \
-       cx->blk_format.hasargs = 0;                                     \
        cx->blk_format.dfoutgv = PL_defoutgv;                           \
        SvREFCNT_inc_void(cx->blk_format.dfoutgv)
 
@@ -488,7 +485,7 @@ struct block_loop {
            cx->blk_loop.itersave = NULL;
 #endif
 #define CxLABEL(c)     (0 + (c)->blk_oldcop->cop_label)
-#define CxHASARGS(c)   (0 + (c)->blk_sub.hasargs)
+#define CxHASARGS(c)   (((c)->cx_type & CXp_HASARGS) == CXp_HASARGS)
 #define CxLVAL(c)      (0 + (c)->blk_sub.lval)
 
 #ifdef USE_ITHREADS
@@ -675,6 +672,9 @@ struct context {
 #define CXp_MULTICALL  0x00000400      /* part of a multicall (so don't
                                           tear down context on exit). */ 
 
+/* private flags for CXt_SUB and CXt_FORMAT */
+#define CXp_HASARGS    0x00000200
+
 /* private flags for CXt_EVAL */
 #define CXp_REAL       0x00000100      /* truly eval'', not a lookalike */
 #define CXp_TRYBLOCK   0x00000200      /* eval{}, not eval'' or similar */
index 2d3648b..c1f115d 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2440,7 +2440,6 @@ PP(pp_goto)
                    PL_in_eval = cx->blk_eval.old_in_eval;
                    PL_eval_root = cx->blk_eval.old_eval_root;
                    cx->cx_type = CXt_SUB;
-                   cx->blk_sub.hasargs = 0;
                }
                cx->blk_sub.cv = cv;
                cx->blk_sub.olddepth = CvDEPTH(cv);