From acba93e826abe70ba59f9af9bbc24846c22aeb66 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Sun, 2 Feb 2014 19:49:51 +0000 Subject: [PATCH] re_intuit_start(): remove try_at_* labels Now that both "other" blocks have been merged into one block, there's only one occurrence of the following rather than two: if (rx_origin == strpos) goto try_at_start; goto try_at_offset; which allows us to eliminate these two gotos and just fall through into the 'if (rx_origin == strpos)' just before the two code blocks marked by those two labels. Also intro introduce another label, 'postprocess_substr_matches', which is needed by the stclass code now that those other two labels have gone. --- regexec.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/regexec.c b/regexec.c index 9310167..99bb81b 100644 --- a/regexec.c +++ b/regexec.c @@ -1070,32 +1070,29 @@ Perl_re_intuit_start(pTHX_ other_last = HOP3c(s, 1, strend); } s = saved_s; - if (rx_origin == strpos) - goto try_at_start; - goto try_at_offset; } } } + else { + DEBUG_OPTIMISE_MORE_r( + PerlIO_printf(Perl_debug_log, + " Check-only match: offset min:%"IVdf" max:%"IVdf + " s:%"IVdf" rx_origin:%"IVdf" rx_origin-s:%"IVdf + " strend-strpos:%"IVdf"\n", + (IV)prog->check_offset_min, + (IV)prog->check_offset_max, + (IV)(s-strpos), + (IV)(rx_origin-strpos), + (IV)(rx_origin-s), + (IV)(strend-strpos) + ) + ); + } - - DEBUG_OPTIMISE_MORE_r( - PerlIO_printf(Perl_debug_log, - " Check-only match: offset min:%"IVdf" max:%"IVdf - " s:%"IVdf" rx_origin:%"IVdf" rx_origin-s:%"IVdf - " strend-strpos:%"IVdf"\n", - (IV)prog->check_offset_min, - (IV)prog->check_offset_max, - (IV)(s-strpos), - (IV)(rx_origin-strpos), - (IV)(rx_origin-s), - (IV)(strend-strpos) - ) - ); - + postprocess_substr_matches: if (rx_origin != strpos) { /* Fixed substring is found far enough so that the match cannot start at strpos. */ - try_at_offset: DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, " try at offset...\n")); if (ml_anch && rx_origin[-1] != '\n') { /* Eventually fbm_*() should handle this, but often @@ -1157,7 +1154,6 @@ Perl_re_intuit_start(pTHX_ - no optimization of calling REx engine can be performed, unless it was an MBOL and we are not after MBOL, or a future STCLASS check will fail this. */ - try_at_start: DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, " try at start...\n")); /* Even in this situation we may use MBOL flag if strpos is offset wrt the start of the string. */ @@ -1312,7 +1308,10 @@ Perl_re_intuit_start(pTHX_ " Looking for /%s^%s/m starting at offset %ld...\n", PL_colors[0], PL_colors[1], (long)(rx_origin - i_strpos)) ); - goto try_at_offset; + /* XXX DAPM I don't yet know why this is true, but the code + * assumed it when it used to do goto try_at_offset */ + assert(rx_origin != strpos); + goto postprocess_substr_matches; } if (!(utf8_target ? prog->float_utf8 : prog->float_substr)) /* Could have been deleted */ goto fail; -- 2.7.4