Remove BmRARE and BmPREVIOUS
authorFather Chrysostomos <sprout@cpan.org>
Fri, 21 Jun 2013 18:26:26 +0000 (11:26 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 21 Jun 2013 19:38:52 +0000 (12:38 -0700)
These were only used by the study code, which was disabled in 5.16.0
and removed shortly thereafter.

dump.c
ext/B/B.xs
ext/Devel-Peek/t/Peek.t
sv.h
util.c

diff --git a/dump.c b/dump.c
index 93094a4..1e16aee 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -1710,8 +1710,6 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
            do_hv_dump(level, file, "  STASH", SvSTASH(sv));
 
        if ((type == SVt_PVMG || type == SVt_PVLV) && SvVALID(sv)) {
-           Perl_dump_indent(aTHX_ level, file, "  RARE = %u\n", (U8)BmRARE(sv));
-           Perl_dump_indent(aTHX_ level, file, "  PREVIOUS = %"UVuf"\n", (UV)BmPREVIOUS(sv));
            Perl_dump_indent(aTHX_ level, file, "  USEFUL = %"IVdf"\n", (IV)BmUSEFUL(sv));
        }
     }
index e2ebdad..fdeca72 100644 (file)
@@ -1288,16 +1288,14 @@ MODULE = B      PACKAGE = B::IV
 
 #define PVMG_stash_ix  sv_SVp | offsetof(struct xpvmg, xmg_stash)
 
-#if PERL_VERSION > 14
+#if PERL_VERSION > 18
+#    define PVBM_useful_ix     sv_I32p | offsetof(struct xpvgv, xnv_u.xbm_useful)
+#elif PERL_VERSION > 14
 #    define PVBM_useful_ix     sv_I32p | offsetof(struct xpvgv, xnv_u.xbm_s.xbm_useful)
-#    define PVBM_previous_ix   sv_UVp | offsetof(struct xpvuv, xuv_uv)
 #else
 #define PVBM_useful_ix sv_I32p | offsetof(struct xpvgv, xiv_u.xivu_i32)
-#define PVBM_previous_ix    sv_U32p | offsetof(struct xpvgv, xnv_u.xbm_s.xbm_previous)
 #endif
 
-#define PVBM_rare_ix   sv_U8p | offsetof(struct xpvgv, xnv_u.xbm_s.xbm_rare)
-
 #define PVLV_targoff_ix        sv_U32p | offsetof(struct xpvlv, xlv_targoff)
 #define PVLV_targlen_ix        sv_U32p | offsetof(struct xpvlv, xlv_targlen)
 #define PVLV_targ_ix   sv_SVp | offsetof(struct xpvlv, xlv_targ)
@@ -1364,8 +1362,6 @@ IVX(sv)
        B::GV::STASH = PVGV_stash_ix
        B::GV::GvFLAGS = PVGV_flags_ix
        B::BM::USEFUL = PVBM_useful_ix
-       B::BM::PREVIOUS = PVBM_previous_ix
-       B::BM::RARE = PVBM_rare_ix
        B::IO::LINES =  PVIO_lines_ix
        B::IO::PAGE = PVIO_page_ix
        B::IO::PAGE_LEN = PVIO_page_len_ix
@@ -1666,6 +1662,16 @@ MOREMAGIC(mg)
            break;
        }
 
+MODULE = B     PACKAGE = B::BM         PREFIX = Bm
+
+U32
+BmPREVIOUS(sv)
+       B::BM   sv
+
+U8
+BmRARE(sv)
+       B::BM   sv
+
 MODULE = B     PACKAGE = B::GV         PREFIX = Gv
 
 void
index ecef607..5019fb1 100644 (file)
@@ -955,8 +955,8 @@ unless ($Config{useithreads}) {
     MG_TYPE = PERL_MAGIC_bm\\(B\\)
     MG_LEN = 256
     MG_PTR = $ADDR "(?:\\\\\d){256}"
-  RARE = \d+
-  PREVIOUS = 1
+  RARE = \d+                                   # $] < 5.019002
+  PREVIOUS = 1                                 # $] < 5.019002
   USEFUL = 100
 ');
 
@@ -974,8 +974,8 @@ unless ($Config{useithreads}) {
     MG_TYPE = PERL_MAGIC_bm\\(B\\)
     MG_LEN = 256
     MG_PTR = $ADDR "(?:\\\\\d){256}"
-  RARE = \d+
-  PREVIOUS = 1
+  RARE = \d+                                   # $] < 5.019002
+  PREVIOUS = 1                                 # $] < 5.019002
   USEFUL = 100
 ');
 
@@ -1009,8 +1009,8 @@ unless ($Config{useithreads}) {
     MG_TYPE = PERL_MAGIC_bm\\(B\\)
     MG_LEN = 256
     MG_PTR = $ADDR "(?:\\\\\d){256}"
-  RARE = \d+
-  PREVIOUS = \d+
+  RARE = \d+                                   # $] < 5.019002
+  PREVIOUS = \d+                               # $] < 5.019002
   USEFUL = 100
 ';
 
diff --git a/sv.h b/sv.h
index b0fd5b2..0ba73d1 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -462,10 +462,7 @@ union _xnvu {
        U32 xlow;
        U32 xhigh;
     }      xpad_cop_seq;       /* used by pad.c for cop_sequence */
-    struct {
-       I32 xbm_useful;
-       U8  xbm_rare;           /* rarest character in string */
-    }      xbm_s;              /* fields from PVBM */
+    I32            xbm_useful;
 };
 
 union _xivu {
@@ -1360,32 +1357,23 @@ sv_force_normal does nothing.
 #endif
 
 #if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
-#  define BmRARE(sv)                                                   \
-       (*({ SV *const _bmrare = MUTABLE_SV(sv);                        \
-               assert(SvTYPE(_bmrare) == SVt_PVMG);                    \
-               assert(SvVALID(_bmrare));                               \
-           &(((XPVMG*) SvANY(_bmrare))->xnv_u.xbm_s.xbm_rare);         \
-        }))
 #  define BmUSEFUL(sv)                                                 \
        (*({ SV *const _bmuseful = MUTABLE_SV(sv);                      \
            assert(SvTYPE(_bmuseful) == SVt_PVMG);                      \
            assert(SvVALID(_bmuseful));                                 \
            assert(!SvIOK(_bmuseful));                                  \
-           &(((XPVMG*) SvANY(_bmuseful))->xnv_u.xbm_s.xbm_useful);     \
-        }))
-#  define BmPREVIOUS(sv)                                               \
-    (*({ SV *const _bmprevious = MUTABLE_SV(sv);                       \
-               assert(SvTYPE(_bmprevious) == SVt_PVMG);                \
-               assert(SvVALID(_bmprevious));                           \
-           &(((XPVMG*) SvANY(_bmprevious))->xiv_u.xivu_uv);            \
+           &(((XPVMG*) SvANY(_bmuseful))->xnv_u.xbm_useful);           \
         }))
 #else
-#  define BmRARE(sv)           ((XPVMG*) SvANY(sv))->xnv_u.xbm_s.xbm_rare
-#  define BmUSEFUL(sv)         ((XPVMG*) SvANY(sv))->xnv_u.xbm_s.xbm_useful
-#  define BmPREVIOUS(sv)       ((XPVMG*) SvANY(sv))->xiv_u.xivu_uv
+#  define BmUSEFUL(sv)         ((XPVMG*) SvANY(sv))->xnv_u.xbm_useful
 
 #endif
 
+#ifndef PERL_CORE
+# define BmRARE(sv)    0
+# define BmPREVIOUS(sv)        0
+#endif
+
 #define FmLINES(sv)    ((XPVIV*)  SvANY(sv))->xiv_iv
 
 #define LvTYPE(sv)     ((XPVLV*)  SvANY(sv))->xlv_type
diff --git a/util.c b/util.c
index 01acc83..d8b3d33 100644 (file)
--- a/util.c
+++ b/util.c
@@ -593,13 +593,11 @@ Perl_fbm_compile(pTHX_ SV *sv, U32 flags)
            frequency = PL_freq[s[i]];
        }
     }
-    BmRARE(sv) = s[rarest];
-    BmPREVIOUS(sv) = rarest;
     BmUSEFUL(sv) = 100;                        /* Initial value */
     if (flags & FBMcf_TAIL)
        SvTAIL_on(sv);
     DEBUG_r(PerlIO_printf(Perl_debug_log, "rarest char %c at %"UVuf"\n",
-                         BmRARE(sv), BmPREVIOUS(sv)));
+                         s[rarest], rarest));
 }
 
 /* If SvTAIL(littlestr), it has a fake '\n' at end. */