Branch: refs/heads/yves/curlyx_curlym
Home: https://github.com/Perl/perl5
Commit: ef9ae0a6f52a5ad7bda2cb0df1d290c11fc73246
https://github.com/Perl/perl5/commit/ef9ae0a6f52a5ad7bda2cb0df1d290c11fc73246
Author: Yves Orton <[email protected]>
Date: 2023-01-09 (Mon, 09 Jan 2023)
Changed paths:
M t/re/re_tests
Log Message:
-----------
t/re/re_rests - extend test to show more buffers
This is a tricky test, showing more buffers makes it a bit easier
to understand if you break it. (Guess what I did?)
Commit: 740668fc8a1699cffbf253654a3264444f508133
https://github.com/Perl/perl5/commit/740668fc8a1699cffbf253654a3264444f508133
Author: Yves Orton <[email protected]>
Date: 2023-01-09 (Mon, 09 Jan 2023)
Changed paths:
M mg.c
M pp.c
M pp_ctl.c
M pp_hot.c
M regcomp.c
M regcomp_debug.c
M regexec.c
M regexp.h
Log Message:
-----------
regexec engine - wrap and replace RX_OFFS() with better abstractions
RX_OFFS() exposes a bit too much about how capture buffers are represented.
This adds RX_OFFS_START() and RX_OFFS_END() and RX_OFFS_VALID() to replace
most of the uses of the RX_OFFS() macro or direct access to the rx->off[]
array. (We add RX_OFFSp() for those rare cases that should have direct
access to the array.) This allows us to replace this logic with more
complicated macros in the future. Pretty much anything using RX_OFFS() is
going to be broken by future changes, so changing the define allows us to
track it down easily.
Not all use of the rx->offs[] array are converted; some uses are required
for the regex engine internals, but anything outside of the regex engine
should be using the replacement macros, and most things in the regex internals
should use it also.
Commit: 2ae676a0c311ebfbe78006c6819935ea939433bd
https://github.com/Perl/perl5/commit/2ae676a0c311ebfbe78006c6819935ea939433bd
Author: Yves Orton <[email protected]>
Date: 2023-01-09 (Mon, 09 Jan 2023)
Changed paths:
M regcomp.c
M regcomp.h
M regcomp_internal.h
M t/re/pat.t
M t/re/reg_mesg.t
Log Message:
-----------
regcomp.c - increase size of CURLY nodes so the min/max is a I32
This allows us to resolve a test inconsistency between CURLYX and CURLY
and CURLYM. We use I32 because the existing count logic uses -1 and
this keeps everything unsigned compatible.
Commit: 55527ee03c2e148c1c9d427d1fb10b06b48c31bc
https://github.com/Perl/perl5/commit/55527ee03c2e148c1c9d427d1fb10b06b48c31bc
Author: Yves Orton <[email protected]>
Date: 2023-01-09 (Mon, 09 Jan 2023)
Changed paths:
M regcomp_internal.h
M regcomp_study.c
Log Message:
-----------
regcomp_study.c - Add a way to disable CURLYX optimisations
Also break up the condition so there is one condition per line so
it is more readable, and fold repeated binary tests together. This
makes it more obvious what the expression is doing.
Commit: 1cdc955bb9f81ae6a27e6d58ac839548e31baa4d
https://github.com/Perl/perl5/commit/1cdc955bb9f81ae6a27e6d58ac839548e31baa4d
Author: Yves Orton <[email protected]>
Date: 2023-01-09 (Mon, 09 Jan 2023)
Changed paths:
M regcomp_debug.c
M regcomp_study.c
M t/re/pat_re_eval.t
Log Message:
-----------
regcomp_study.c - disable CURLYX optimizations when EVAL has been seen
anywhere
Historically we disabled CURLYX optimizations when they
*contained* an EVAL, on the assumption that the optimization might
affect how many times, etc, the eval was called. However, this is
also true for CURLYX with evals *afterwards*. If the CURLYN or CURLYM
optimization can prune off the search space, then an eval afterwards
will be affected. An when you take into account GOSUB, it means that
an eval in front might be affected by an optimization after it.
So for now we disable CURLYN and CURLYM in any pattern with an EVAL.
Commit: a7e8dae6f82a268f4c8d29abdb7fdca5b86d0d65
https://github.com/Perl/perl5/commit/a7e8dae6f82a268f4c8d29abdb7fdca5b86d0d65
Author: Yves Orton <[email protected]>
Date: 2023-01-09 (Mon, 09 Jan 2023)
Changed paths:
M regexec.c
Log Message:
-----------
regexec.c - rework CLOSE_CAPTURE() macro to take a rex argument
This allows it to be used in contexts where rex isn't set up under
this name.
Commit: cb3d6afa2c9af6173ef4bdf5a9571cbfae131228
https://github.com/Perl/perl5/commit/cb3d6afa2c9af6173ef4bdf5a9571cbfae131228
Author: Yves Orton <[email protected]>
Date: 2023-01-10 (Tue, 10 Jan 2023)
Changed paths:
M regcomp.c
M regcomp.h
Log Message:
-----------
regcomp.h - get rid of EXTRA_STEP defines
They are unused these days.
Commit: 91a0a58a64824121b602b67fa6e93844f6912a1f
https://github.com/Perl/perl5/commit/91a0a58a64824121b602b67fa6e93844f6912a1f
Author: Yves Orton <[email protected]>
Date: 2023-01-10 (Tue, 10 Jan 2023)
Changed paths:
M regcomp.c
Log Message:
-----------
regcomp.c - add whitespace to binary operation
The tight & is hard to read.
Commit: fcf5001d004d35c79f8930985b287f9c87847f1d
https://github.com/Perl/perl5/commit/fcf5001d004d35c79f8930985b287f9c87847f1d
Author: Yves Orton <[email protected]>
Date: 2023-01-10 (Tue, 10 Jan 2023)
Changed paths:
M regcomp_trie.c
Log Message:
-----------
regcomp_trie.c - use the indirect types so we are safe to changes
We shouldnt assume that a TRIEC is a regcomp_charclass. We have a per
opcode type exactly for this type of use, so lets use it.
Commit: ff43150a169745a295340ff18960efbbfa839be4
https://github.com/Perl/perl5/commit/ff43150a169745a295340ff18960efbbfa839be4
Author: Yves Orton <[email protected]>
Date: 2023-01-10 (Tue, 10 Jan 2023)
Changed paths:
M pod/perldebguts.pod
M pp_ctl.c
M regcomp.c
M regcomp.h
M regcomp.sym
M regcomp_debug.c
M regexec.c
M regexp.h
M regnodes.h
M t/re/pat.t
M t/re/pat_rt_report.t
M t/re/re_tests
Log Message:
-----------
regcomp.c - Resolve issues clearing buffers in CURLYX (MAJOR-CHANGE)
CURLYX doesn't reset capture buffers properly. It is possible
for multiple buffers to be defined at once with values from
different iterations of the loop, which doesn't make sense really.
An example is this:
"foobarfoo"=~/((foo)|(bar))+/
after this matches $1 should equal $2 and $3 should be undefined,
or $1 should equal $3 and $2 should be undefined. Prior to this
patch this would not be the case.
The solution that this patches uses is to introduce a form of
"layered transactional storage" for paren data. The existing
pair of start/end data for capture data is extended with a
start_new/end_new pair. When the vast majority of our code wants
to check if a given capture buffer is defined they first check
"start_new/end_new", if either is -1 then they fall back to
whatever is in start/end.
When a capture buffer is CLOSEd the data is written into the
start_new/end_new pair instead of the start/end pair. When a CURLYX
loop is executing and has matched something (at least one "A" in
/A*B/ -- thus actually in WHILEM) it "commits" the start_new/end_new
data by writing it into start/end. When we begin a new iteration of
the loop we clear the start_new/end_new pairs that are contained by
the loop, by setting them to -1. If the loop fails then we roll back
as we used to. If the loop succeeds we continue. When we hit an END
block we commit everything.
Consider the example above. We start off with everything set to -1.
$1 = (-1,-1):(-1,-1)
$2 = (-1,-1):(-1,-1)
$3 = (-1,-1):(-1,-1)
In the first iteration we have matched "foo" and end up with this:
$1 = (-1,-1):( 0, 3)
$2 = (-1,-1):( 0, 3)
$3 = (-1,-1):(-1,-1)
We commit the results of $2 and $3, and then clear the new data in
the beginning of the next loop:
$1 = (-1,-1):( 0, 3)
$2 = ( 0, 3):(-1,-1)
$3 = (-1,-1):(-1,-1)
We then match "bar":
$1 = (-1,-1):( 0, 3)
$2 = ( 0, 3):(-1,-1)
$3 = (-1,-1):( 3, 7)
and then commit the result and clear the new data:
$1 = (-1,-1):( 0, 3)
$2 = (-1,-1):(-1,-1)
$3 = ( 3, 7):(-1,-1)
and then we match "foo" again:
$1 = (-1,-1):( 0, 3)
$2 = (-1,-1):( 7,10)
$3 = ( 3, 7):(-1,-1)
And we then commit. We do a regcppush here as normal.
$1 = (-1,-1):( 0, 3)
$2 = ( 7,10):( 7,10)
$3 = (-1,-1):(-1,-1)
We then clear it again, but since we don't match when we regcppop
we store the buffers back to the above layout. When we finally
hit the END buffer we also do a commit as well on all buffers, including
the 0th (for the full match).
Fixes GH Issue #18865, and adds tests for it and other things.
Commit: dd6d535886bf114b0fb8d221c60adb145b90e317
https://github.com/Perl/perl5/commit/dd6d535886bf114b0fb8d221c60adb145b90e317
Author: Yves Orton <[email protected]>
Date: 2023-01-10 (Tue, 10 Jan 2023)
Changed paths:
M MANIFEST
M t/re/regexp.t
A t/re/regexp_normal.t
Log Message:
-----------
t/re/regexp_normal.t - test "normalized" forms of patterns
This looks for discrepancies between different ways of writing
a pattern.
Commit: 99429446d08cb71cbcb3eb05d36d88e6a95a0c86
https://github.com/Perl/perl5/commit/99429446d08cb71cbcb3eb05d36d88e6a95a0c86
Author: Yves Orton <[email protected]>
Date: 2023-01-10 (Tue, 10 Jan 2023)
Changed paths:
M pod/perldebguts.pod
M regcomp.c
M regcomp.h
M regcomp.sym
M regcomp_debug.c
M regcomp_trie.c
M regexec.c
M regexp.h
M regnodes.h
M t/re/re_tests
Log Message:
-----------
regexec.c - teach BRANCH and BRANCHJ nodes to reset capture buffers
In /((a)(b)|(a))+/ we should not end up with $2 and $4 being set at
the same time. When a branch fails it should reset any capture buffers
that might be touched by its branch.
We change BRANCH and BRANCHJ to store the number of parens before the
branch, and the number of parens after the branch was completed. When
a BRANCH operation fails, we clear the buffers it contains before we
continue on.
It is a bit more complex than it should be because we have BRANCHJ
and BRANCH. (One of these days we should merge them together.)
This is also made somewhat more complex because TRIE nodes are actually
branches, and may need to track capture buffers also, at two levels.
The overall TRIE op, and for jump tries especially where we emulate
the behavior of branches. So we have to do the same clearing logic if
a trie branch fails as well.
Commit: 763cd5c248a89f33c5e55be34fb309fd0d6f196a
https://github.com/Perl/perl5/commit/763cd5c248a89f33c5e55be34fb309fd0d6f196a
Author: Yves Orton <[email protected]>
Date: 2023-01-10 (Tue, 10 Jan 2023)
Changed paths:
M pod/perldelta.pod
M pod/perlre.pod
M regcomp.c
M regcomp.h
M regcomp_debug.c
M regcomp_internal.h
M regcomp_study.c
M regexec.c
M regnodes.h
M t/re/pat_re_eval.t
M t/re/pat_rt_report.t
Log Message:
-----------
regcomp.c - add optimistic eval
Commit: 5d916aa46e10440e11d3f9403991c3e2e5d5d7de
https://github.com/Perl/perl5/commit/5d916aa46e10440e11d3f9403991c3e2e5d5d7de
Author: Yves Orton <[email protected]>
Date: 2023-01-10 (Tue, 10 Jan 2023)
Changed paths:
M regexec.c
Log Message:
-----------
regexec.c - fix accept in CURLYX
Revealed by forcing CURLYX optimisations off.
Compare: https://github.com/Perl/perl5/compare/fc396c82e1a0...5d916aa46e10