diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-12-29 17:01:51 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-12-29 17:01:51 +0000 |
commit | 52d81aa88ad6014ec0ca7c381776c58dd68e428a (patch) | |
tree | b736c2dbcdd28453c37cad08c4075e004705ffc6 | |
parent | 14f3b9f2b06052c35a95062569fb2799771d1e2b (diff) | |
download | perl-52d81aa88ad6014ec0ca7c381776c58dd68e428a.tar.gz |
Reorder the external regexp flags to get RXf_PMf_STD_PMMOD into the
lowest 4 bits (which saves a shift), and the "flags indicating special
patterns" into contiguous bits. This makes everything a little tidier,
and saves 88 bytes (woohoo!) of object file with -Os on x86 FreeBSD.
p4raw-id: //depot/perl@32775
-rw-r--r-- | op.h | 32 | ||||
-rw-r--r-- | regexp.h | 80 | ||||
-rw-r--r-- | regnodes.h | 60 |
3 files changed, 86 insertions, 86 deletions
@@ -347,35 +347,35 @@ struct pmop { #endif -#define PMf_RETAINT 0x0001 /* taint $1 etc. if target tainted */ -#define PMf_ONCE 0x0002 /* match successfully only once per +#define PMf_RETAINT 0x00000040 /* taint $1 etc. if target tainted */ +#define PMf_ONCE 0x00000080 /* match successfully only once per reset, with related flag RXf_USED in re->extflags holding state. This is used only for ?? matches, and only on OP_MATCH and OP_QR */ -#define PMf_UNUSED 0x0004 /* free for use */ -#define PMf_MAYBE_CONST 0x0008 /* replacement contains variables */ +#define PMf_UNUSED 0x00000100 /* free for use */ +#define PMf_MAYBE_CONST 0x00000200 /* replacement contains variables */ -#define PMf_USED 0x0010 /* PMf_ONCE has matched successfully. +#define PMf_USED 0x00000400 /* PMf_ONCE has matched successfully. Not used under threading. */ -#define PMf_CONST 0x0040 /* subst replacement is constant */ -#define PMf_KEEP 0x0080 /* keep 1st runtime pattern forever */ -#define PMf_GLOBAL 0x0100 /* pattern had a g modifier */ -#define PMf_CONTINUE 0x0200 /* don't reset pos() if //g fails */ -#define PMf_EVAL 0x0400 /* evaluating replacement as expr */ +#define PMf_CONST 0x00000800 /* subst replacement is constant */ +#define PMf_KEEP 0x00001000 /* keep 1st runtime pattern forever */ +#define PMf_GLOBAL 0x00002000 /* pattern had a g modifier */ +#define PMf_CONTINUE 0x00004000 /* don't reset pos() if //g fails */ +#define PMf_EVAL 0x00008000 /* evaluating replacement as expr */ /* The following flags have exact equivalents in regcomp.h with the prefix RXf_ * which are stored in the regexp->extflags member. If you change them here, * you have to change them there, and vice versa. */ -#define PMf_LOCALE 0x00800 /* use locale for character types */ -#define PMf_MULTILINE 0x01000 /* assume multiple lines */ -#define PMf_SINGLELINE 0x02000 /* assume single line */ -#define PMf_FOLD 0x04000 /* case insensitivity */ -#define PMf_EXTENDED 0x08000 /* chuck embedded whitespace */ -#define PMf_KEEPCOPY 0x10000 /* copy the string when matching */ +#define PMf_MULTILINE 0x00000001 /* assume multiple lines */ +#define PMf_SINGLELINE 0x00000002 /* assume single line */ +#define PMf_FOLD 0x00000004 /* case insensitivity */ +#define PMf_EXTENDED 0x00000008 /* chuck embedded whitespace */ +#define PMf_KEEPCOPY 0x00000010 /* copy the string when matching */ +#define PMf_LOCALE 0x00000020 /* use locale for character types */ /* mask of bits that need to be transfered to re->extflags */ #define PMf_COMPILETIME (PMf_MULTILINE|PMf_SINGLELINE|PMf_LOCALE|PMf_FOLD|PMf_EXTENDED|PMf_KEEPCOPY) @@ -227,35 +227,17 @@ and check for NULL. * */ -/* Anchor and GPOS related stuff */ -#define RXf_ANCH_BOL 0x00000001 -#define RXf_ANCH_MBOL 0x00000002 -#define RXf_ANCH_SBOL 0x00000004 -#define RXf_ANCH_GPOS 0x00000008 -#define RXf_GPOS_SEEN 0x00000010 -#define RXf_GPOS_FLOAT 0x00000020 -/* two bits here */ -#define RXf_ANCH (RXf_ANCH_BOL|RXf_ANCH_MBOL|RXf_ANCH_GPOS|RXf_ANCH_SBOL) -#define RXf_GPOS_CHECK (RXf_GPOS_SEEN|RXf_ANCH_GPOS) -#define RXf_ANCH_SINGLE (RXf_ANCH_SBOL|RXf_ANCH_GPOS) - -/* Flags indicating special patterns */ -#define RXf_SKIPWHITE 0x00000100 /* Pattern is for a split / / */ -#define RXf_START_ONLY 0x00000200 /* Pattern is /^/ */ -#define RXf_WHITE 0x00000400 /* Pattern is /\s+/ */ -#define RXf_NULL 0x40000000 /* Pattern is // */ - -/* 0x1F800 of extflags is used by (RXf_)PMf_COMPILETIME +/* 0x3F of extflags is used by (RXf_)PMf_COMPILETIME * If you change these you need to change the equivalent flags in op.h, and * vice versa. */ -#define RXf_PMf_LOCALE 0x00000800 /* use locale */ -#define RXf_PMf_MULTILINE 0x00001000 /* /m */ -#define RXf_PMf_SINGLELINE 0x00002000 /* /s */ -#define RXf_PMf_FOLD 0x00004000 /* /i */ -#define RXf_PMf_EXTENDED 0x00008000 /* /x */ -#define RXf_PMf_KEEPCOPY 0x00010000 /* /p */ +#define RXf_PMf_MULTILINE 0x00000001 /* /m */ +#define RXf_PMf_SINGLELINE 0x00000002 /* /s */ +#define RXf_PMf_FOLD 0x00000004 /* /i */ +#define RXf_PMf_EXTENDED 0x00000008 /* /x */ +#define RXf_PMf_KEEPCOPY 0x00000010 /* /p */ +#define RXf_PMf_LOCALE 0x00000020 /* use locale */ /* these flags are transfered from the PMOP->op_pmflags member during compilation */ -#define RXf_PMf_STD_PMMOD_SHIFT 12 +#define RXf_PMf_STD_PMMOD_SHIFT 0 #define RXf_PMf_STD_PMMOD (RXf_PMf_MULTILINE|RXf_PMf_SINGLELINE|RXf_PMf_FOLD|RXf_PMf_EXTENDED) #define RXf_PMf_COMPILETIME (RXf_PMf_MULTILINE|RXf_PMf_SINGLELINE|RXf_PMf_LOCALE|RXf_PMf_FOLD|RXf_PMf_EXTENDED|RXf_PMf_KEEPCOPY) @@ -302,37 +284,55 @@ and check for NULL. * */ +/* Anchor and GPOS related stuff */ +#define RXf_ANCH_BOL 0x00000100 +#define RXf_ANCH_MBOL 0x00000200 +#define RXf_ANCH_SBOL 0x00000400 +#define RXf_ANCH_GPOS 0x00000800 +#define RXf_GPOS_SEEN 0x00001000 +#define RXf_GPOS_FLOAT 0x00002000 +/* two bits here */ +#define RXf_ANCH (RXf_ANCH_BOL|RXf_ANCH_MBOL|RXf_ANCH_GPOS|RXf_ANCH_SBOL) +#define RXf_GPOS_CHECK (RXf_GPOS_SEEN|RXf_ANCH_GPOS) +#define RXf_ANCH_SINGLE (RXf_ANCH_SBOL|RXf_ANCH_GPOS) + /* What we have seen */ -#define RXf_LOOKBEHIND_SEEN 0x00020000 -#define RXf_EVAL_SEEN 0x00040000 -#define RXf_CANY_SEEN 0x00080000 +#define RXf_LOOKBEHIND_SEEN 0x00004000 +#define RXf_EVAL_SEEN 0x00008000 +#define RXf_CANY_SEEN 0x00010000 /* Special */ -#define RXf_NOSCAN 0x00100000 -#define RXf_CHECK_ALL 0x00200000 +#define RXf_NOSCAN 0x00020000 +#define RXf_CHECK_ALL 0x00040000 /* UTF8 related */ -#define RXf_UTF8 0x00400000 -#define RXf_MATCH_UTF8 0x00800000 +#define RXf_UTF8 0x00080000 +#define RXf_MATCH_UTF8 0x00100000 /* Intuit related */ -#define RXf_USE_INTUIT_NOML 0x01000000 -#define RXf_USE_INTUIT_ML 0x02000000 -#define RXf_INTUIT_TAIL 0x04000000 +#define RXf_USE_INTUIT_NOML 0x00200000 +#define RXf_USE_INTUIT_ML 0x00400000 +#define RXf_INTUIT_TAIL 0x00800000 /* Set in Perl_pmruntime if op_flags & OPf_SPECIAL, i.e. split. Will be used by regex engines to check whether they should set RXf_SKIPWHITE */ -#define RXf_SPLIT 0x08000000 +#define RXf_SPLIT 0x01000000 #define RXf_USE_INTUIT (RXf_USE_INTUIT_NOML|RXf_USE_INTUIT_ML) /* Copy and tainted info */ -#define RXf_COPY_DONE 0x10000000 -#define RXf_TAINTED_SEEN 0x20000000 -#define RXf_TAINTED 0x80000000 /* this pattern is tainted */ +#define RXf_COPY_DONE 0x02000000 +#define RXf_TAINTED_SEEN 0x04000000 +#define RXf_TAINTED 0x08000000 /* this pattern is tainted */ + +/* Flags indicating special patterns */ +#define RXf_START_ONLY 0x10000000 /* Pattern is /^/ */ +#define RXf_SKIPWHITE 0x20000000 /* Pattern is for a split / / */ +#define RXf_WHITE 0x40000000 /* Pattern is /\s+/ */ +#define RXf_NULL 0x80000000 /* Pattern is // */ /* * NOTE: if you modify any RXf flags you should run regen.pl or regcomp.pl diff --git a/regnodes.h b/regnodes.h index 1697a12973..b47e450e1d 100644 --- a/regnodes.h +++ b/regnodes.h @@ -626,38 +626,38 @@ EXTCONST char * PL_reg_extflags_name[]; #else EXTCONST char * const PL_reg_extflags_name[] = { /* Bits in extflags defined: 11111111111111111111111100111111 */ - "ANCH_BOL", /* 0x00000001 */ - "ANCH_MBOL", /* 0x00000002 */ - "ANCH_SBOL", /* 0x00000004 */ - "ANCH_GPOS", /* 0x00000008 */ - "GPOS_SEEN", /* 0x00000010 */ - "GPOS_FLOAT", /* 0x00000020 */ + "MULTILINE", /* 0x00000001 */ + "SINGLELINE", /* 0x00000002 */ + "FOLD", /* 0x00000004 */ + "EXTENDED", /* 0x00000008 */ + "KEEPCOPY", /* 0x00000010 */ + "LOCALE", /* 0x00000020 */ "UNUSED_BIT_6", /* 0x00000040 */ "UNUSED_BIT_7", /* 0x00000080 */ - "SKIPWHITE", /* 0x00000100 */ - "START_ONLY", /* 0x00000200 */ - "WHITE", /* 0x00000400 */ - "LOCALE", /* 0x00000800 */ - "MULTILINE", /* 0x00001000 */ - "SINGLELINE", /* 0x00002000 */ - "FOLD", /* 0x00004000 */ - "EXTENDED", /* 0x00008000 */ - "KEEPCOPY", /* 0x00010000 */ - "LOOKBEHIND_SEEN", /* 0x00020000 */ - "EVAL_SEEN", /* 0x00040000 */ - "CANY_SEEN", /* 0x00080000 */ - "NOSCAN", /* 0x00100000 */ - "CHECK_ALL", /* 0x00200000 */ - "UTF8", /* 0x00400000 */ - "MATCH_UTF8", /* 0x00800000 */ - "USE_INTUIT_NOML", /* 0x01000000 */ - "USE_INTUIT_ML", /* 0x02000000 */ - "INTUIT_TAIL", /* 0x04000000 */ - "SPLIT", /* 0x08000000 */ - "COPY_DONE", /* 0x10000000 */ - "TAINTED_SEEN", /* 0x20000000 */ - "NULL", /* 0x40000000 */ - "TAINTED", /* 0x80000000 */ + "ANCH_BOL", /* 0x00000100 */ + "ANCH_MBOL", /* 0x00000200 */ + "ANCH_SBOL", /* 0x00000400 */ + "ANCH_GPOS", /* 0x00000800 */ + "GPOS_SEEN", /* 0x00001000 */ + "GPOS_FLOAT", /* 0x00002000 */ + "LOOKBEHIND_SEEN", /* 0x00004000 */ + "EVAL_SEEN", /* 0x00008000 */ + "CANY_SEEN", /* 0x00010000 */ + "NOSCAN", /* 0x00020000 */ + "CHECK_ALL", /* 0x00040000 */ + "UTF8", /* 0x00080000 */ + "MATCH_UTF8", /* 0x00100000 */ + "USE_INTUIT_NOML", /* 0x00200000 */ + "USE_INTUIT_ML", /* 0x00400000 */ + "INTUIT_TAIL", /* 0x00800000 */ + "SPLIT", /* 0x01000000 */ + "COPY_DONE", /* 0x02000000 */ + "TAINTED_SEEN", /* 0x04000000 */ + "TAINTED", /* 0x08000000 */ + "START_ONLY", /* 0x10000000 */ + "SKIPWHITE", /* 0x20000000 */ + "WHITE", /* 0x40000000 */ + "NULL", /* 0x80000000 */ }; #endif /* DOINIT */ |