diff options
author | David Mitchell <davem@iabyn.com> | 2010-06-06 21:09:22 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2010-06-06 23:14:33 +0100 |
commit | d02d6d97d5eefad4e164003699595f59abb06506 (patch) | |
tree | 3d3255267528b5818f782d8373391b0099b8b51d | |
parent | 6dd2be570d715119e05672f6f0266d924022b65a (diff) | |
download | perl-d02d6d97d5eefad4e164003699595f59abb06506.tar.gz |
reduce size of regmatch_state.u.curlyx by 2 words
-rw-r--r-- | regexec.c | 27 | ||||
-rw-r--r-- | regexp.h | 5 |
2 files changed, 16 insertions, 16 deletions
@@ -4325,9 +4325,7 @@ NULL /* these fields contain the state of the current curly. * they are accessed by subsequent WHILEMs */ ST.parenfloor = parenfloor; - ST.min = ARG1(scan); - ST.max = ARG2(scan); - ST.A = NEXTOPER(scan) + EXTRA_STEP_2ARGS; + ST.me = scan; ST.B = next; ST.minmod = minmod; minmod = 0; @@ -4358,6 +4356,10 @@ NULL { /* see the discussion above about CURLYX/WHILEM */ I32 n; + int min = ARG1(cur_curlyx->u.curlyx.me); + int max = ARG2(cur_curlyx->u.curlyx.me); + regnode *A = NEXTOPER(cur_curlyx->u.curlyx.me) + EXTRA_STEP_2ARGS; + assert(cur_curlyx); /* keep Coverity happy */ n = ++cur_curlyx->u.curlyx.count; /* how many A's matched */ ST.save_lastloc = cur_curlyx->u.curlyx.lastloc; @@ -4367,17 +4369,15 @@ NULL PL_reginput = locinput; DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, - "%*s whilem: matched %ld out of %ld..%ld\n", - REPORT_CODE_OFF+depth*2, "", (long)n, - (long)cur_curlyx->u.curlyx.min, - (long)cur_curlyx->u.curlyx.max) + "%*s whilem: matched %ld out of %d..%d\n", + REPORT_CODE_OFF+depth*2, "", (long)n, min, max) ); /* First just match a string of min A's. */ - if (n < cur_curlyx->u.curlyx.min) { + if (n < min) { cur_curlyx->u.curlyx.lastloc = locinput; - PUSH_STATE_GOTO(WHILEM_A_pre, cur_curlyx->u.curlyx.A); + PUSH_STATE_GOTO(WHILEM_A_pre, A); /* NOTREACHED */ } @@ -4457,11 +4457,11 @@ NULL /* Prefer A over B for maximal matching. */ - if (n < cur_curlyx->u.curlyx.max) { /* More greed allowed? */ + if (n < max) { /* More greed allowed? */ ST.cp = regcppush(cur_curlyx->u.curlyx.parenfloor); cur_curlyx->u.curlyx.lastloc = locinput; REGCP_SET(ST.lastcp); - PUSH_STATE_GOTO(WHILEM_A_max, cur_curlyx->u.curlyx.A); + PUSH_STATE_GOTO(WHILEM_A_max, A); /* NOTREACHED */ } goto do_whilem_B_max; @@ -4521,7 +4521,7 @@ NULL REGCP_UNWIND(ST.lastcp); regcppop(rex); - if (cur_curlyx->u.curlyx.count >= cur_curlyx->u.curlyx.max) { + if (cur_curlyx->u.curlyx.count >= /*max*/ARG2(cur_curlyx->u.curlyx.me)) { /* Maximum greed exceeded */ if (cur_curlyx->u.curlyx.count >= REG_INFTY && ckWARN(WARN_REGEXP) @@ -4545,7 +4545,8 @@ NULL cur_curlyx->u.curlyx.lastloc = locinput; ST.cp = regcppush(cur_curlyx->u.curlyx.parenfloor); REGCP_SET(ST.lastcp); - PUSH_STATE_GOTO(WHILEM_A_min, ST.save_curlyx->u.curlyx.A); + PUSH_STATE_GOTO(WHILEM_A_min, + /*A*/ NEXTOPER(ST.save_curlyx->u.curlyx.me) + EXTRA_STEP_2ARGS); /* NOTREACHED */ #undef ST @@ -603,12 +603,11 @@ typedef struct regmatch_state { /* this first element must match u.yes */ struct regmatch_state *prev_yes_state; struct regmatch_state *prev_curlyx; /* previous cur_curlyx */ - regnode *A, *B; /* the nodes corresponding to /A*B/ */ + regnode *me; /* the CURLYX node */ + regnode *B; /* the B node in /A*B/ */ CHECKPOINT cp; /* remember current savestack index */ bool minmod; int parenfloor;/* how far back to strip paren data */ - int min; /* the minimal number of A's to match */ - int max; /* the maximal number of A's to match */ /* these two are modified by WHILEM */ int count; /* how many instances of A we've matched */ |