This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
eliminate REG_SEEN_EVAL
authorDavid Mitchell <davem@iabyn.com>
Sun, 1 Apr 2012 12:04:05 +0000 (13:04 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 13 Jun 2012 12:32:50 +0000 (13:32 +0100)
This flag was set during pattern compilation if a (?{}) was encountered;
but is redundant now that we have pRExC_state->num_code_blocks.

regcomp.c
regcomp.h

index b9f9e41..7827bb3 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -6073,7 +6073,7 @@ reStudy:
        else if ((!sawopen || !RExC_sawback) &&
            (OP(first) == STAR &&
            PL_regkind[OP(NEXTOPER(first))] == REG_ANY) &&
-           !(r->extflags & RXf_ANCH) && !(RExC_seen & REG_SEEN_EVAL))
+           !(r->extflags & RXf_ANCH) && !pRExC_state->num_code_blocks)
        {
            /* turn .* into ^.* with an implied $*=1 */
            const int type =
@@ -6086,7 +6086,7 @@ reStudy:
            goto again;
        }
        if (sawplus && !sawlookahead && (!sawopen || !RExC_sawback)
-           && !(RExC_seen & REG_SEEN_EVAL)) /* May examine pos and $& */
+           && !pRExC_state->num_code_blocks) /* May examine pos and $& */
            /* x+ must match at the 1st pos of run of x's */
            r->intflags |= PREGf_SKIP;
 
@@ -6359,7 +6359,7 @@ reStudy:
        r->extflags |= RXf_GPOS_SEEN;
     if (RExC_seen & REG_SEEN_LOOKBEHIND)
        r->extflags |= RXf_LOOKBEHIND_SEEN;
-    if (RExC_seen & REG_SEEN_EVAL)
+    if (pRExC_state->num_code_blocks)
        r->extflags |= RXf_EVAL_SEEN;
     if (RExC_seen & REG_SEEN_CANY)
        r->extflags |= RXf_CANY_SEEN;
@@ -8581,7 +8581,6 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
                struct reg_code_block *cb;
 
                RExC_seen_zerolen++;
-               RExC_seen |= REG_SEEN_EVAL;
 
                if (   !pRExC_state->num_code_blocks
                    || pRExC_state->code_index >= pRExC_state->num_code_blocks
index 29a4a6e..8cf0a92 100644 (file)
--- a/regcomp.h
+++ b/regcomp.h
@@ -488,7 +488,7 @@ struct regnode_charclass_class {
 #define REG_SEEN_ZERO_LEN      0x00000001
 #define REG_SEEN_LOOKBEHIND    0x00000002
 #define REG_SEEN_GPOS          0x00000004
-#define REG_SEEN_EVAL          0x00000008
+/* spare */
 #define REG_SEEN_CANY          0x00000010
 #define REG_SEEN_SANY          REG_SEEN_CANY /* src bckwrd cmpt */
 #define REG_SEEN_RECURSE        0x00000020