This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove union _xivu from _XPVCV_COMMON, and hence structs xpvcv and xpvfm
authorNicholas Clark <nick@ccl4.org>
Tue, 26 Jan 2010 17:03:41 +0000 (17:03 +0000)
committerNicholas Clark <nick@ccl4.org>
Fri, 21 May 2010 06:03:52 +0000 (07:03 +0100)
Replaced with xcv_depth and xfm_lines respectively. Both structures might
benefit from some field re-ordering.

Update the descriptive comments in the definition of union _xivu.

cv.h
sv.h

diff --git a/cv.h b/cv.h
index d7dcc4a..182415e 100644 (file)
--- a/cv.h
+++ b/cv.h
@@ -13,6 +13,7 @@
 struct xpvcv {
     _XPV_HEAD;
     _XPVCV_COMMON;
+    I32        xcv_depth;      /* >= 2 indicates recursive call */
 };
 
 /*
@@ -51,10 +52,10 @@ Returns the stash of the CV.
 #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
 #  define CvDEPTH(sv) (*({const CV *const _cvdepth = (const CV *)sv; \
                          assert(SvTYPE(_cvdepth) == SVt_PVCV);  \
-                         &((XPVCV*)SvANY(_cvdepth))->xiv_u.xivu_i32; \
+                         &((XPVCV*)SvANY(_cvdepth))->xcv_depth; \
                        }))
 #else
-#  define CvDEPTH(sv)  ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xiv_u.xivu_i32
+#  define CvDEPTH(sv)  ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_depth
 #endif
 #define CvPADLIST(sv)  ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist
 #define CvOUTSIDE(sv)  ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_outside
diff --git a/sv.h b/sv.h
index d5872c9..97a6c53 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -416,9 +416,8 @@ union _xnvu {
 
 union _xivu {
     IV     xivu_iv;            /* integer value */
-                               /* xpvfm: lines */
     UV     xivu_uv;
-    I32            xivu_i32;
+    I32            xivu_i32;           /* BmUSEFUL */
     HEK *   xivu_namehek;      /* xpvlv, xpvgv: GvNAME */
 };
 
@@ -482,7 +481,6 @@ struct xpvgv {
 typedef U16 cv_flags_t;
 
 #define _XPVCV_COMMON                                                          \
-    union _xivu xiv_u;                                                         \
     HV *       xcv_stash;                                                      \
     union {                                                                    \
        OP *    xcv_start;                                                      \
@@ -504,6 +502,7 @@ typedef U16 cv_flags_t;
 struct xpvfm {
     _XPV_HEAD;
     _XPVCV_COMMON;
+    IV         xfm_lines;
 };
 
 #define _XPVIO_TAIL                                                    \
@@ -1302,7 +1301,7 @@ the scalar's value cannot change unless written to.
 
 #endif
 
-#define FmLINES(sv)    ((XPVFM*)  SvANY(sv))->xiv_u.xivu_iv
+#define FmLINES(sv)    ((XPVFM*)  SvANY(sv))->xfm_lines
 
 #define LvTYPE(sv)     ((XPVLV*)  SvANY(sv))->xlv_type
 #define LvTARG(sv)     ((XPVLV*)  SvANY(sv))->xlv_targ