Change 29518 by [EMAIL PROTECTED] on 2006/12/11 18:26:31

        Change SvTAIL() to check that both SVpbm_TAIL|SVpbm_VALID are true.
        SVpbm_VALID is the same bit value is SVf_IVisUV, which means that
        PVBMs can't actually ever be IOK. Therefore move BmUSEFUL() into the
        IV union, and save one I32 per PVBM.

Affected files ...

... //depot/perl/sv.h#291 edit
... //depot/perl/util.c#593 edit

Differences ...

==== //depot/perl/sv.h#291 (text) ====
Index: perl/sv.h
--- perl/sv.h#290~29496~        2006-12-09 17:13:09.000000000 -0800
+++ perl/sv.h   2006-12-11 10:26:31.000000000 -0800
@@ -536,7 +536,7 @@
        IV      xivu_iv;        /* integer value or pv offset */
        UV      xivu_uv;
        void *  xivu_p1;
-       I32     xivu_i32;
+       I32     xivu_i32;       /* is this constant pattern being useful? */
        HEK *   xivu_namehek;
     }          xiv_u;
     union {
@@ -545,7 +545,6 @@
     } xmg_u;
     HV*                xmg_stash;      /* class package */
 
-    I32                xbm_useful;     /* is this constant pattern being 
useful? */
     U16                xbm_previous;   /* how many characters in string before 
rare? */
     U8         xbm_rare;       /* rarest character in string */
 };
@@ -1063,10 +1062,13 @@
 #  define SvTAIL(sv)   ({ SV *const _svi = (SV *) (sv);                \
                            assert(SvTYPE(_svi) != SVt_PVAV);           \
                            assert(SvTYPE(_svi) != SVt_PVHV);           \
-                           SvFLAGS(sv) & SVpbm_TAIL;                   \
+                           (SvFLAGS(sv) & (SVpbm_TAIL|SVpbm_VALID))    \
+                               == (SVpbm_TAIL|SVpbm_VALID);            \
                        })
 #else
-#  define SvTAIL(sv)           (SvFLAGS(sv) & SVpbm_TAIL)
+#  define SvTAIL(sv)       ((SvFLAGS(sv) & (SVpbm_TAIL|SVpbm_VALID))   \
+                            == (SVpbm_TAIL|SVpbm_VALID));
+
 #endif
 #define SvTAIL_on(sv)          (SvFLAGS(sv) |= SVpbm_TAIL)
 #define SvTAIL_off(sv)         (SvFLAGS(sv) &= ~SVpbm_TAIL)
@@ -1317,7 +1319,8 @@
 #  define BmUSEFUL(sv)                                                 \
        (*({ SV *const _svi = (SV *) (sv);                              \
            assert(SvTYPE(_svi) == SVt_PVBM);                           \
-           &(((XPVBM*) SvANY(_svi))->xbm_useful);                      \
+           assert(!SvIOK(_svi));                                       \
+           &(((XPVBM*) SvANY(_svi))->xiv_u.xivu_i32);                  \
         }))
 #  define BmPREVIOUS(sv)                                               \
        (*({ SV *const _svi = (SV *) (sv);                              \
@@ -1326,7 +1329,7 @@
         }))
 #else
 #  define BmRARE(sv)   ((XPVBM*)  SvANY(sv))->xbm_rare
-#  define BmUSEFUL(sv) ((XPVBM*)  SvANY(sv))->xbm_useful
+#  define BmUSEFUL(sv) ((XPVBM*)  SvANY(sv))->xiv_u.xivu_i32
 #  define BmPREVIOUS(sv)       ((XPVBM*)  SvANY(sv))->xbm_previous
 #endif
 

==== //depot/perl/util.c#593 (text) ====
Index: perl/util.c
--- perl/util.c#592~29492~      2006-12-08 15:49:51.000000000 -0800
+++ perl/util.c 2006-12-11 10:26:31.000000000 -0800
@@ -493,6 +493,7 @@
     if (len == 0)              /* TAIL might be on a zero-length string. */
        return;
     SvUPGRADE(sv, SVt_PVBM);
+    SvIOK_off(sv);
     if (len > 2) {
        const unsigned char *sb;
        const U8 mlen = (len>255) ? 255 : (U8)len;
End of Patch.

Reply via email to