diff options
author | Yves Orton <demerphq@gmail.com> | 2006-10-04 21:08:47 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-10-05 12:39:53 +0000 |
commit | eaf3ca90bc6ae9ae7e97dcea569c7cee82be7d00 (patch) | |
tree | 6b0f9b19f761597b0be1e9f8d3e98d583427abe7 /regcomp.c | |
parent | 586634170b2f5ccf13a9af971b91c10ce5e9b7d7 (diff) | |
download | perl-eaf3ca90bc6ae9ae7e97dcea569c7cee82be7d00.tar.gz |
Re: [perl #8835] fairly large regex optimization bug with 5.7.3
Message-ID: <9b18b3110610041008v2bd63d14g9294f93804122dec@mail.gmail.com>
p4raw-id: //depot/perl@28943
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -3895,7 +3895,7 @@ reStudy: /* testing for BRANCH here tells us whether there is "must appear" data in the pattern. If there is then we can use it for optimisations */ - if (OP(scan) != BRANCH) { /* Only one top-level choice. */ + if (!(RExC_seen & REG_TOP_LEVEL_BRANCHES)) { /* Only one top-level choice. */ I32 fake; STRLEN longest_float_length, longest_fixed_length; struct regnode_charclass_class ch_class; /* pointed to by data */ @@ -4747,9 +4747,12 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth) ender = reg_node(pRExC_state, END); break; } - REGTAIL_STUDY(pRExC_state, lastbr, ender); + REGTAIL(pRExC_state, lastbr, ender); if (have_branch && !SIZE_ONLY) { + if (depth==1) + RExC_seen |= REG_TOP_LEVEL_BRANCHES; + /* Hook the tails of the branches to the closing node. */ for (br = ret; br; br = regnext(br)) { const U8 op = PL_regkind[OP(br)]; @@ -7147,8 +7150,11 @@ S_regtail(pTHX_ RExC_state_t *pRExC_state, regnode *p, const regnode *val,U32 de SV * const mysv=sv_newmortal(); DEBUG_PARSE_MSG((scan==p ? "tail" : "")); regprop(RExC_rx, mysv, scan); - PerlIO_printf(Perl_debug_log, "~ %s (%d)\n", - SvPV_nolen_const(mysv), REG_NODE_NUM(scan)); + PerlIO_printf(Perl_debug_log, "~ %s (%d) %s %s\n", + SvPV_nolen_const(mysv), REG_NODE_NUM(scan), + (temp == NULL ? "->" : ""), + (temp == NULL ? reg_name[OP(val)] : "") + ); }); if (temp == NULL) break; @@ -7225,10 +7231,10 @@ S_regtail_study(pTHX_ RExC_state_t *pRExC_state, regnode *p, const regnode *val, SV * const mysv=sv_newmortal(); DEBUG_PARSE_MSG((scan==p ? "tsdy" : "")); regprop(RExC_rx, mysv, scan); - PerlIO_printf(Perl_debug_log, "~ %s (%s) (%d)\n", + PerlIO_printf(Perl_debug_log, "~ %s (%d) -> %s\n", SvPV_nolen_const(mysv), - reg_name[exact], - REG_NODE_NUM(scan)); + REG_NODE_NUM(scan), + reg_name[exact]); }); if (temp == NULL) break; |