Perl

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Change 28571: remove regex postive super-linear cache code

    0 answers - 5649 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Change 28571 by davem@davem-cyril on 2006/07/14 11:50:37
    remove regex postive super-linear cache code
    (it wasn't actually achieving anything)
    Affected files
    //depot/perl/regexec.c#441 edit
    //depot/perl/t/op/re_tests#95 edit
    Differences
    //depot/perl/regexec.c#441 (text)
    Index: perl/regexec.c
    perl/regexec.c#440~28565~2006-07-13 07:04:18.000000000 -0700
    perl/regexec.c2006-07-14 04:50:37.000000000 -0700
    @@ -2099,54 +2099,14 @@
    #define sayNSILENT goto do_no
    #define saySAME(x) if (x) goto yes; else goto no
    -#define PSCACHE_SUCCESS 0/* caching success rather than failure */
    -#define PSCACHE_SEEN 1/* we know what we're caching */
    -#define PSCACHE_START 2/* the real cache: this bit maps to pos 0 */
    -
    -#define CACHEsayYES STMT_START { \
    - if (st->u.whilem.cache_offset | st->u.whilem.cache_bit) { \
    -if (!(PL_reg_poscache[0] & (1<<PSCACHE_SEEN))) { \
    - PL_reg_poscache[0] |= (1<<PSCACHE_SUCCESS) | (1<<PSCACHE_SEEN); \
    - PL_reg_poscache[st->u.whilem.cache_offset] |= (1<<st->u.whilem.cache_bit); \
    -} \
    - else if (PL_reg_poscache[0] & (1<<PSCACHE_SUCCESS)) { \
    - PL_reg_poscache[st->u.whilem.cache_offset] |= (1<<st->u.whilem.cache_bit); \
    -} \
    -else { \
    - /* cache records failure, but this is success */ \
    - DEBUG_r( \
    -PerlI(Perl_debug_log, \
    - "%*s (remove success from failure cache)\n", \
    - REPRT_CDEFF+PL_regindent*2, "") \
    - ); \
    - PL_reg_poscache[st->u.whilem.cache_offset] &= ~(1<<st->u.whilem.cache_bit); \
    -} \
    - } \
    - sayYES; \
    -} STMT_END
    -
    #define CACHEsayN STMT_START { \
    - if (st->u.whilem.cache_offset | st->u.whilem.cache_bit) { \
    -if (!(PL_reg_poscache[0] & (1<<PSCACHE_SEEN))) { \
    - PL_reg_poscache[0] |= (1<<PSCACHE_SEEN); \
    - PL_reg_poscache[st->u.whilem.cache_offset] |= (1<<st->u.whilem.cache_bit); \
    -} \
    - else if (!(PL_reg_poscache[0] & (1<<PSCACHE_SUCCESS))) { \
    - PL_reg_poscache[st->u.whilem.cache_offset] |= (1<<st->u.whilem.cache_bit); \
    -} \
    -else { \
    - /* cache records success, but this is failure */ \
    - DEBUG_r( \
    -PerlI(Perl_debug_log, \
    - "%*s (remove failure from success cache)\n", \
    - REPRT_CDEFF+PL_regindent*2, "") \
    - ); \
    - PL_reg_poscache[st->u.whilem.cache_offset] &= ~(1<<st->u.whilem.cache_bit); \
    -} \
    - } \
    + if (st->u.whilem.cache_offset | st->u.whilem.cache_bit) \
    + PL_reg_poscache[st->u.whilem.cache_offset] |= \
    + (1<<st->u.whilem.cache_bit); \
    sayN; \
    } STMT_END
    +
    /* this is used to determine how far from the left messages like
    'failed' are printed. Currently 29 makes these messages line
    up with the opcode they refer to. Earlier perls used 25 which
    @@ -3587,7 +3547,7 @@
    PL_reg_leftiter = PL_reg_maxiter;
    }
    if (PL_reg_leftiter-- == 0) {
    - const I32 size = (PL_reg_maxiter + 7 + PSCACHE_START)/8;
    + const I32 size = (PL_reg_maxiter + 7)/8;
    if (PL_reg_poscache) {
    if ((I32)PL_reg_poscache_size < size) {
    Renew(PL_reg_poscache, size, char);
    @@ -3608,7 +3568,7 @@
    if (PL_reg_leftiter < 0) {
    st->u.whilem.cache_offset = locinput - PL_bostr;
    - st->u.whilem.cache_offset = (scan->flags & 0xf) - 1 + PSCACHE_START
    + st->u.whilem.cache_offset = (scan->flags & 0xf) - 1
    + st->u.whilem.cache_offset * (scan->flags>>4);
    st->u.whilem.cache_bit = st->u.whilem.cache_offset % 8;
    st->u.whilem.cache_offset /= 8;
    @@ -3618,12 +3578,7 @@
    "%*s already tried at this position\n",
    REPRT_CDEFF+PL_regindent*2, "")
    );
    -if (PL_reg_poscache[0] & (1<<PSCACHE_SUCCESS))
    - /* cache records success */
    - sayYES;
    -else
    - /* cache records failure */
    - sayNSILENT;
    +sayN; /* cache records failure */
    }
    }
    }
    @@ -3642,7 +3597,7 @@
    st->cc = st->u.whilem.savecc;
    if (result) {
    regcpblow(st->u.whilem.cp);
    -CACHEsayYES;/* All done. */
    +sayYES;/* All done. */
    }
    REGCP_UNWIND(st->u.whilem.lastcp);
    regcppop(rex);
    @@ -3675,7 +3630,7 @@
    / all unsaved local vars undefined at this point */
    if (result) {
    regcpblow(st->u.whilem.cp);
    -CACHEsayYES;
    +sayYES;
    }
    REGCP_UNWIND(st->u.whilem.lastcp);
    regcppop(rex);
    @@ -3695,7 +3650,7 @@
    / all unsaved local vars undefined at this point */
    if (result) {
    regcpblow(st->u.whilem.cp);
    -CACHEsayYES;
    +sayYES;
    }
    REGCP_UNWIND(st->u.whilem.lastcp);
    regcppop(rex);/* Restore some previous $<digit>s? */
    @@ -3723,7 +3678,7 @@
    / all unsaved local vars undefined at this point */
    st->cc = st->u.whilem.savecc;
    if (result)
    - CACHEsayYES;
    + sayYES;
    if (st->cc->u.curlyx.outercc)
    st->cc->u.curlyx.outercc->u.curlyx.cur = st->ln;
    st->cc->u.curlyx.cur = n - 1;
    //depot/perl/t/op/re_tests#95 (text)
    Index: perl/t/op/re_tests
    perl/t/op/re_tests#94~28398~2006-06-16 16:25:51.000000000 -0700
    perl/t/op/re_tests2006-07-14 04:50:37.000000000 -0700
    @@ -972,3 +972,7 @@
    X(A|B||C|D)YXXXYYYy$&XY# Trie w/ NTHING
    (?i:X([A]|[B]|y[Y]y|[D]|)Y)XXXYYYBy$&XY# Trie w/ NTHING
    ^([a]{1})*$aay$1a
    +a(?!b(?!c))()abababcy$1bc# test nested negatives
    +a(?!b(?=a))()abababcy$1bc# test nested lookaheads
    +a(?!b(?!c(?!d(?!e))))(.)abxabcdxabcdey$1e
    +X(?!b+(?!(c+)*(?!(c+)*d))).*XaXbbbbbbbcccccccccccccaaaXy--
    End of Patch.

Re: Change 28571: remove regex postive super-linear cache code


max 4000 letters.
Your nickname that display:
In order to stop the spam: 0 + 9 =
QUESTION ON "Perl"

EMSDN.COM