Change 33017 by [EMAIL PROTECTED] on 2008/01/20 21:50:31

        In struct block_sub and block_format, access the members hasargs and
        lval via macros CxHASARGS() and CxLVAL(), which will allow the storage
        location to be changed.

Affected files ...

... //depot/perl/cop.h#153 edit
... //depot/perl/pp_ctl.c#660 edit
... //depot/perl/pp_hot.c#556 edit
... //depot/perl/scope.c#214 edit
... //depot/perl/sv.c#1490 edit

Differences ...

==== //depot/perl/cop.h#153 (text) ====
Index: perl/cop.h
--- perl/cop.h#152~33016~       2008-01-20 13:05:26.000000000 -0800
+++ perl/cop.h  2008-01-20 13:50:31.000000000 -0800
@@ -364,7 +364,7 @@
                CopFILE((COP*)CvSTART((CV*)cx->blk_sub.cv)),            \
                CopLINE((COP*)CvSTART((CV*)cx->blk_sub.cv)));           \
                                                                        \
-       if (cx->blk_sub.hasargs) {                                      \
+       if (CxHASARGS(cx)) {                                            \
            POP_SAVEARRAY();                                            \
            /* abandon @_ if it got reified */                          \
            if (AvREAL(cx->blk_sub.argarray)) {                         \
@@ -488,6 +488,8 @@
            cx->blk_loop.itersave = NULL;
 #endif
 #define CxLABEL(c)     (0 + (c)->blk_oldcop->cop_label)
+#define CxHASARGS(c)   (0 + (c)->blk_sub.hasargs)
+#define CxLVAL(c)      (0 + (c)->blk_sub.lval)
 
 #ifdef USE_ITHREADS
 #  define PUSHLOOP_OP_NEXT             /* No need to do anything.  */

==== //depot/perl/pp_ctl.c#660 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#659~33015~    2008-01-20 12:40:38.000000000 -0800
+++ perl/pp_ctl.c       2008-01-20 13:50:31.000000000 -0800
@@ -1308,8 +1308,8 @@
     const I32 cxix = dopoptosub(cxstack_ix);
     assert(cxix >= 0);  /* We should only be called from inside subs */
 
-    if (cxstack[cxix].blk_sub.lval && CvLVALUE(cxstack[cxix].blk_sub.cv))
-       return cxstack[cxix].blk_sub.lval;
+    if (CxLVAL(cxstack + cxix) && CvLVALUE(cxstack[cxix].blk_sub.cv))
+       return CxLVAL(cxstack + cxix);
     else
        return 0;
 }
@@ -1654,11 +1654,11 @@
            SV * const sv = newSV(0);
            gv_efullname3(sv, cvgv, NULL);
            mPUSHs(sv);
-           mPUSHi((I32)cx->blk_sub.hasargs);
+           mPUSHi((I32)CxHASARGS(cx));
        }
        else {
            PUSHs(newSVpvs_flags("(unknown)", SVs_TEMP));
-           mPUSHi((I32)cx->blk_sub.hasargs);
+           mPUSHi((I32)CxHASARGS(cx));
        }
     }
     else {
@@ -1691,7 +1691,7 @@
        PUSHs(&PL_sv_undef);
        PUSHs(&PL_sv_undef);
     }
-    if (CxTYPE(cx) == CXt_SUB && cx->blk_sub.hasargs
+    if (CxTYPE(cx) == CXt_SUB && CxHASARGS(cx)
        && CopSTASH_eq(PL_curcop, PL_debstash))
     {
        AV * const ary = cx->blk_sub.argarray;
@@ -2378,7 +2378,7 @@
            }
            else if (CxMULTICALL(cx))
                DIE(aTHX_ "Can't goto subroutine from a sort sub (or similar 
callback)");
-           if (CxTYPE(cx) == CXt_SUB && cx->blk_sub.hasargs) {
+           if (CxTYPE(cx) == CXt_SUB && CxHASARGS(cx)) {
                /* put @_ back onto stack */
                AV* av = cx->blk_sub.argarray;
 
@@ -2455,7 +2455,7 @@
                }
                SAVECOMPPAD();
                PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv));
-               if (cx->blk_sub.hasargs)
+               if (CxHASARGS(cx))
                {
                    AV* const av = (AV*)PAD_SVl(0);
 

==== //depot/perl/pp_hot.c#556 (text) ====
Index: perl/pp_hot.c
--- perl/pp_hot.c#555~32979~    2008-01-15 03:11:07.000000000 -0800
+++ perl/pp_hot.c       2008-01-20 13:50:31.000000000 -0800
@@ -2505,7 +2505,7 @@
 
     TAINT_NOT;
 
-    if (cx->blk_sub.lval & OPpENTERSUB_INARGS) {
+    if (CxLVAL(cx) & OPpENTERSUB_INARGS) {
        /* We are an argument to a function or grep().
         * This kind of lvalueness was legal before lvalue
         * subroutines too, so be backward compatible:
@@ -2532,7 +2532,7 @@
            }
        }
     }
-    else if (cx->blk_sub.lval) {     /* Leave it as it is if we can. */
+    else if (CxLVAL(cx)) {     /* Leave it as it is if we can. */
        /* Here we go for robustness, not for speed, so we change all
         * the refcounts so the caller gets a live guy. Cannot set
         * TEMP, so sv_2mortal is out of question. */

==== //depot/perl/scope.c#214 (text) ====
Index: perl/scope.c
--- perl/scope.c#213~33014~     2008-01-20 11:56:21.000000000 -0800
+++ perl/scope.c        2008-01-20 13:50:31.000000000 -0800
@@ -1053,7 +1053,7 @@
        PerlIO_printf(Perl_debug_log, "BLK_FORMAT.DFOUTGV = 0x%"UVxf"\n",
                PTR2UV(cx->blk_format.dfoutgv));
        PerlIO_printf(Perl_debug_log, "BLK_FORMAT.HASARGS = %d\n",
-               (int)cx->blk_format.hasargs);
+                     (int)CxHASARGS(cx));
        PerlIO_printf(Perl_debug_log, "BLK_FORMAT.RETOP = 0x%"UVxf"\n",
                PTR2UV(cx->blk_format.retop));
        break;
@@ -1063,9 +1063,8 @@
        PerlIO_printf(Perl_debug_log, "BLK_SUB.OLDDEPTH = %ld\n",
                (long)cx->blk_sub.olddepth);
        PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n",
-               (int)cx->blk_sub.hasargs);
-       PerlIO_printf(Perl_debug_log, "BLK_SUB.LVAL = %d\n",
-               (int)cx->blk_sub.lval);
+               (int)CxHASARGS(cx));
+       PerlIO_printf(Perl_debug_log, "BLK_SUB.LVAL = %d\n", (int)CxLVAL(cx));
        PerlIO_printf(Perl_debug_log, "BLK_SUB.RETOP = 0x%"UVxf"\n",
                PTR2UV(cx->blk_sub.retop));
        break;

==== //depot/perl/sv.c#1490 (text) ====
Index: perl/sv.c
--- perl/sv.c#1489~33014~       2008-01-20 11:56:21.000000000 -0800
+++ perl/sv.c   2008-01-20 13:50:31.000000000 -0800
@@ -10528,7 +10528,7 @@
                ncx->blk_sub.cv         = (ncx->blk_sub.olddepth == 0
                                           ? cv_dup_inc(ncx->blk_sub.cv, param)
                                           : cv_dup(ncx->blk_sub.cv,param));
-               ncx->blk_sub.argarray   = (ncx->blk_sub.hasargs
+               ncx->blk_sub.argarray   = (CxHASARGS(ncx)
                                           ? av_dup_inc(ncx->blk_sub.argarray,
                                                        param)
                                           : NULL);
End of Patch.

Reply via email to