Change 29524 by [EMAIL PROTECTED] on 2006/12/11 22:18:53
Move PERL_FBM_TABLE_OFFSET and PERL_FBM_FLAGS_OFFSET_FROM_TABLE to sv.h
Stow BmRARE in the SvPVX, and so delete xbm_rare.
Can you see what it is yet?
Affected files ...
... //depot/perl/sv.h#294 edit
... //depot/perl/util.c#596 edit
Differences ...
==== //depot/perl/sv.h#294 (text) ====
Index: perl/sv.h
--- perl/sv.h#293~29523~ 2006-12-11 13:52:12.000000000 -0800
+++ perl/sv.h 2006-12-11 14:18:53.000000000 -0800
@@ -546,7 +546,6 @@
HV* xmg_stash; /* class package */
U16 xbm_previous; /* how many characters in string before
rare? */
- U8 xbm_rare; /* rarest character in string */
};
/* This structure must match XPVCV in cv.h */
@@ -1310,12 +1309,22 @@
} \
} STMT_END
+
+#define PERL_FBM_TABLE_OFFSET 5 /* Number of bytes between EOS and
table */
+#define PERL_FBM_FLAGS_OFFSET_FROM_TABLE -1
+#define PERL_FBM_RARE_OFFSET_FROM_TABLE -4
+
+/* SvPOKp not SvPOK in the assertion because the string can be tainted! eg
+ perl -T -e '/$^X/'
+*/
#if defined (DEBUGGING) && defined(__GNUC__) &&
!defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
# define BmRARE(sv) \
(*({ SV *const _svi = (SV *) (sv); \
assert(SvTYPE(_svi) == SVt_PVBM); \
assert(SvVALID(_svi)); \
- &(((XPVBM*) SvANY(_svi))->xbm_rare); \
+ assert(SvPOKp(_svi)); \
+ (U8*)(SvEND(_svi) \
+ + PERL_FBM_TABLE_OFFSET + PERL_FBM_RARE_OFFSET_FROM_TABLE); \
}))
# define BmUSEFUL(sv) \
(*({ SV *const _svi = (SV *) (sv); \
@@ -1331,7 +1340,10 @@
&(((XPVBM*) SvANY(_svi))->xbm_previous); \
}))
#else
-# define BmRARE(sv) ((XPVBM*) SvANY(sv))->xbm_rare
+# define BmRARE(sv) \
+ (*(U8*)(SvEND(sv) \
+ + PERL_FBM_TABLE_OFFSET + PERL_FBM_RARE_OFFSET_FROM_TABLE))
+
# define BmUSEFUL(sv) ((XPVBM*) SvANY(sv))->xiv_u.xivu_i32
# define BmPREVIOUS(sv) ((XPVBM*) SvANY(sv))->xbm_previous
#endif
==== //depot/perl/util.c#596 (text) ====
Index: perl/util.c
--- perl/util.c#595~29522~ 2006-12-11 13:21:09.000000000 -0800
+++ perl/util.c 2006-12-11 14:18:53.000000000 -0800
@@ -454,9 +454,6 @@
return NULL;
}
-#define PERL_FBM_TABLE_OFFSET 2 /* Number of bytes between EOS and
table*/
-#define PERL_FBM_FLAGS_OFFSET_FROM_TABLE -1
-
/* As a space optimization, we do not compile tables for strings of length
0 and 1, and for strings of length 2 unless FBMcf_TAIL. These are
special-cased in fbm_instr().
End of Patch.