summaryrefslogtreecommitdiff
path: root/regcomp.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-09-20 11:15:00 -0600
committerKarl Williamson <khw@cpan.org>2018-10-20 00:09:54 -0600
commit46fc0c4304793e740ce6eefd1561a6bb9cb9a6c8 (patch)
tree0cf8e5fc43b2642314cc491188b61af6d0fa7d41 /regcomp.h
parentea461dd624d982da3d7216fd18fd3caca818c2bb (diff)
downloadperl-46fc0c4304793e740ce6eefd1561a6bb9cb9a6c8.tar.gz
regcomp.sym: Add lengths for ANYOF nodes
This changes regcomp.sym to generate the correct lengths for ANYOF nodes, which means they don't have to be special cased in regcomp.c, leading to simplification
Diffstat (limited to 'regcomp.h')
-rw-r--r--regcomp.h35
1 files changed, 14 insertions, 21 deletions
diff --git a/regcomp.h b/regcomp.h
index 8bffb5d777..45d24c2599 100644
--- a/regcomp.h
+++ b/regcomp.h
@@ -367,7 +367,9 @@ struct regnode_ssc {
STMT_START { \
ARG_SET(ptr, arg); \
FILL_ADVANCE_NODE(ptr, op); \
- (ptr) += 1; \
+ /* This is used generically for other operations\
+ * that have a longer argument */ \
+ (ptr) += regarglen[op]; \
} STMT_END
#define FILL_ADVANCE_NODE_2L_ARG(ptr, op, arg1, arg2) \
STMT_START { \
@@ -466,22 +468,18 @@ struct regnode_ssc {
* handler function, as the macro REGINCLASS in regexec.c does now for other
* cases.
*
- * Another possibility is to instead (or additionally) rename the ANYOF_POSIXL
- * flag to be ANYOFL_LARGE, to mean that the ANYOF node has an extra 32 bits
- * beyond what a regular one does. That's what it effectively means now, with
- * the extra space all for the POSIX class flags. But those classes actually
- * only occupy 30 bits, so the ANYOFL_FOLD and
- * ANYOFL_SHARED_UTF8_LOCALE_fold_HAS_MATCHES_nonfold_REQD flags could be moved
- * to that extra space. The 30 bits in the extra word would indicate if a
- * posix class should be looked up or not. The downside of this is that ANYOFL
- * nodes with folding would always have to have the extra space allocated, even
- * if they didn't use the 30 posix bits. There isn't an SSC problem as all
- * SSCs are this large anyway.
+ * Another possibility is based on the fact that ANYOF_MATCHES_POSIXL is
+ * redundant with the node type ANYOFPOSIXL. That flag could be removed, but
+ * at the expense of extra code in regexec.c. The flag has been retained
+ * because it allows us to see if we need to call reginsert, or just use the
+ * bitmap in one test.
*
- * One could completely remove ANYOFL_LARGE and make all ANYOFL nodes large.
- * REGINCLASS would have to be modified so that if the node type were this, it
- * would call reginclass(), as the flag bit that indicates to do this now would
- * be gone.
+ * If this is done, an extension would be to make all ANYOFL nodes contain the
+ * extra 32 bits that ANYOFPOSIXL ones do. The posix flags only occupy 30
+ * bits, so the ANYOFL_SHARED_UTF8_LOCALE_fold_HAS_MATCHES_nonfold_REQD flags
+ * and ANYOFL_FOLD could be moved to that extra space, but it would mean extra
+ * instructions, as there are currently places in the code that assume those
+ * two bits are zero.
*
* All told, 5 bits could be available for other uses if all of the above were
* done.
@@ -707,11 +705,6 @@ struct regnode_ssc {
#define ANYOF_BITMAP_CLEARALL(p) \
Zero (ANYOF_BITMAP(p), ANYOF_BITMAP_SIZE)
-#define ANYOF_SKIP (EXTRA_SIZE(regnode_charclass) \
- - EXTRA_SIZE(struct regnode_1))
-#define ANYOF_POSIXL_SKIP (EXTRA_SIZE(regnode_charclass_posixl) \
- - EXTRA_SIZE(struct regnode_1))
-
/*
* Utility definitions.
*/