Branch: refs/heads/yves/curlyx_curlym
  Home:   https://github.com/Perl/perl5
  Commit: 35f7e00fcb7234820214dc9a5bd1f792b21ef46b
      
https://github.com/Perl/perl5/commit/35f7e00fcb7234820214dc9a5bd1f792b21ef46b
  Author: Yves Orton <[email protected]>
  Date:   2023-01-14 (Sat, 14 Jan 2023)

  Changed paths:
    M regcomp.c
    M regcomp.h
    M regcomp.sym
    M regcomp_internal.h
    M regexec.c
    M regexp.h
    M regnodes.h

  Log Message:
  -----------
  regexec.c - make REF into a backtracking state

This way we can do the required paren restoration only when it is in use.
When we match a REF type node which is potentially a reference to an
unclosed paren we push the match context information, currently for
"everything", but in a future patch we can teach it to be more efficient.

This converts the backtracking changes from an earlier commit titled
"regexec.c - incredibly inefficient solution to backref problem" to be run
only when specially enabled via the define RE_PESSIMISTIC_PARENS which is by
default 0. We don't make the new fields in the struct conditional as the stack
frames are large and our changes don't make any real difference and it keeps
things simpler to not have conditional members, since some of the structures
have to line up with each other. If enabling RE_PESSIMISTIC_PARENS fixes
a backtracking bug then it means something is sensitive to us not
necessarily restoring the parens properly on failure. We make some
assumptions that the paren state after a failing state will be corrected
by a future successful state, or that the state of the parens is
irrelevant as we will fail anyway. This can be made not true by EVAL,
backrefs, and potentially some other scenarios.  Thus I have left this
inefficient logic in place but guarded by the flag.


Reply via email to