summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2006-06-09 21:48:11 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-06-11 22:00:03 +0000
commitf2278c82849286ea411021a8d3efc5ccb2dc1250 (patch)
tree8617d077d2147eaea96f91749a937f284a3afe54 /regexec.c
parente7f343b6de977b5993b7a5a4707f5051ea388ff2 (diff)
downloadperl-f2278c82849286ea411021a8d3efc5ccb2dc1250.tar.gz
Re: [PATCH] Better version of the Aho-Corasick patch and lots of benchmarks.
Message-ID: <9b18b3110606091048n4d1f3b17vc608943044d4532a@mail.gmail.com> p4raw-id: //depot/perl@28379
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/regexec.c b/regexec.c
index ffe9888980..5338e7977f 100644
--- a/regexec.c
+++ b/regexec.c
@@ -3020,6 +3020,17 @@ S_regmatch(pTHX_ const regmatch_info *reginfo, regnode *prog)
*/
if ( st->u.trie.accepted == 1 ) {
+ DEBUG_EXECUTE_r({
+ SV ** const tmp = RX_DEBUG(reginfo->prog)
+ ? av_fetch( trie->words, st->u.trie.accept_buff[ 0 ].wordnum-1, 0 )
+ : NULL;
+ PerlIO_printf( Perl_debug_log,
+ "%*s %sonly one match : #%d <%s>%s\n",
+ REPORT_CODE_OFF+PL_regindent*2, "", PL_colors[4],
+ st->u.trie.accept_buff[ 0 ].wordnum,
+ tmp ? SvPV_nolen_const( *tmp ) : "not compiled under -Dr",
+ PL_colors[5] );
+ });
PL_reginput = (char *)st->u.trie.accept_buff[ 0 ].endpos;
/* in this case we free tmps/leave before we call regmatch
as we wont be using accept_buff again. */
@@ -3050,6 +3061,18 @@ S_regmatch(pTHX_ const regmatch_info *reginfo, regnode *prog)
st->u.trie.accept_buff[best].wordnum)
best = cur;
}
+ DEBUG_EXECUTE_r({
+ reg_trie_data * const trie = (reg_trie_data*)
+ rex->data->data[ARG(scan)];
+ SV ** const tmp = RX_DEBUG(reginfo->prog)
+ ? av_fetch( trie->words, st->u.trie.accept_buff[ best ].wordnum - 1, 0 )
+ : NULL;
+ PerlIO_printf( Perl_debug_log, "%*s %strying alternation #%d <%s> at node #%d %s\n",
+ REPORT_CODE_OFF+PL_regindent*2, "", PL_colors[4],
+ st->u.trie.accept_buff[best].wordnum,
+ tmp ? SvPV_nolen_const( *tmp ) : "not compiled under -Dr", REG_NODE_NUM(scan),
+ PL_colors[5] );
+ });
if ( best<st->u.trie.accepted ) {
reg_trie_accepted tmp = st->u.trie.accept_buff[ best ];
st->u.trie.accept_buff[ best ] = st->u.trie.accept_buff[ st->u.trie.accepted ];