regcomp.h: Restore separate bit for LOC class
authorKarl Williamson <public@khwilliamson.com>
Tue, 23 Nov 2010 00:41:23 +0000 (17:41 -0700)
committerDavid Golden <dagolden@cpan.org>
Tue, 23 Nov 2010 01:19:08 +0000 (20:19 -0500)
This commit partially reverts cefafd73018b048fa66d2b22250431112141955a
which unconditionally used a bitmap for classes like \w in ANYOF nodes
used in locales.  Unfortunately, I forgot to unconditionally allocate
that space, so things were getting corrupted.  It is scary that that did
not show up in my testing, but locales are hard to test.  It showed up
in a workspace without DEBUGGING.

This commit now causes the bitmap to be used only when necessary, at the
expense of using a precious bit in the flags field to indicate that it
is being used.  However, as events have turned out since that commit,
that flags bit isn't as precious as I thought.  It looks like we will
have to split the ANYOF node into two similar nodes, one of which is
variable length, as there are bugs due to the optimizer thinking it is
of length 1, when in fact it doesn't currently have to be.   That split
should allow more bits to be freed.

I'm retaining for now some ancillary code that was to help improve the
efficiency when that bit was removed; just in case we have to redo this.
But if we do, we have to unconditionally allocate the space we think we
are using.

Signed-off-by: David Golden <dagolden@cpan.org>
regcomp.h

index 56dfd92..6dc05f5 100644 (file)
--- a/regcomp.h
+++ b/regcomp.h
@@ -319,8 +319,7 @@ struct regnode_charclass_class {
 #define ANYOF_INVERT           0x04
 
 /* CLASS is never set unless LOCALE is too: has runtime \d, \w, [:posix:], ... */
-/* For now, set it always when LOCALE is set, to save a bit for other uses. */
-#define ANYOF_CLASS     ANYOF_LOCALE
+#define ANYOF_CLASS     0x08
 #define ANYOF_LARGE      ANYOF_CLASS    /* Same; name retained for back compat */
 
 /* Can match something outside the bitmap that is expressible only in utf8 */