From d1c771f5a95fddf225347623798f65884aa6eee7 Mon Sep 17 00:00:00 2001 From: Bram Date: Thu, 26 Aug 2010 13:27:24 +0200 Subject: VERB nodes in the regex engine should NOT be marked as JUMPABLE. JUMPABLE nodes can be ignored during certain phases of regex execution, including ones where backtracking is affected. This change disables this behviour so that the VERBS can perform their desired results. Committer has taken the liberty of modifying the patch so that all VERBS are jumped, thus making the JUMPABLE expression a little simpler. I have left Bram's change to JUMPABLE intact, but inside of a comment for now. See discussion in thread for [perl #71942] *COMMIT bypasses optimisation for futher details. http://rt.perl.org/rt3/Ticket/Display.html?id=71942 There appears to be room for futher optimisation here by moving the JUMPABLE logic to regex-compile time. Currently it is arguable that the "optimisation" this patch seeks to avoid is actually not an optimisation at all, as it happens OVER AND OVER during execution of a match, thus the extra effort might actually outweight the benefit, especially on large strings. --- regexec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'regexec.c') diff --git a/regexec.c b/regexec.c index 35ef8d4b12..ec4c4b049a 100644 --- a/regexec.c +++ b/regexec.c @@ -252,7 +252,8 @@ OP(rn) == EVAL || \ OP(rn) == SUSPEND || OP(rn) == IFMATCH || \ OP(rn) == PLUS || OP(rn) == MINMOD || \ - OP(rn) == KEEPS || (PL_regkind[OP(rn)] == VERB) || \ + OP(rn) == KEEPS || \ + /*(PL_regkind[OP(rn)] == VERB && OP(rn) != PRUNE && OP(rn) != COMMIT && OP(rn) != MARKPOINT && OP(rn) != SKIP && OP(rn) != CUTGROUP) || */\ (PL_regkind[OP(rn)] == CURLY && ARG1(rn) > 0) \ ) #define IS_EXACT(rn) (PL_regkind[OP(rn)] == EXACT) -- cgit v1.2.1