Branch: refs/heads/davem/cond_null
Home: https://github.com/Perl/perl5
Commit: f85d7b8113ae544524d7c6b8ded72474f6f9df11
https://github.com/Perl/perl5/commit/f85d7b8113ae544524d7c6b8ded72474f6f9df11
Author: David Mitchell <[email protected]>
Date: 2026-02-15 (Sun, 15 Feb 2026)
Changed paths:
M peep.c
Log Message:
-----------
rpeep(): refactor: simplify LOGOP handling
(should be no functional changes)
In the main loop of the peephole optimiser, add the label
'generic_logop' in preparation for further refactroring/fixing in the
next few commits.
Use it now to make the 'case OP_GREPWHILE' go directly to the generic
processing rather than falling through to the OP_COND_EXPR branch. In
turn, that branch no longer has to check that its actually an
OP_COND_EXPR.
Commit: ec7474c6196ea2c0b24c023f3e4c3a44d24dc2df
https://github.com/Perl/perl5/commit/ec7474c6196ea2c0b24c023f3e4c3a44d24dc2df
Author: David Mitchell <[email protected]>
Date: 2026-02-15 (Sun, 15 Feb 2026)
Changed paths:
M peep.c
M t/perf/benchmarks
Log Message:
-----------
fix performance regression in empty ? :
Some recent commits optimised away the stub op in expressions such as
@a = $c ? () : @b;
Unfortunately at the same time as eliminating the stub op, the change
made rpeep() skip following op_other to remove any OP_NULLs from that
branch. This commit restores the old behaviour and adds some benchmarks
for (?:)
In particular: before this commit, the code above generated:
4 <#> gvsv[*c] s
5 <|> cond_expr(other->6) lK/1
6 <1> null lKP/1
7 <1> ex-list lK
goto 8
d <#> gv[*b] s
e <1> rv2av[t5] lK/1
8 <0> pushmark s
....
and now generates:
5 <|> cond_expr(other->6) lK/1
b <#> gv[*b] s
c <1> rv2av[t5] lK/1
6 <0> pushmark s
....
as displayed with Concise,-exec.
Commit: dedf26f6d4d331d56d8fc2d9ca6836322a81287a
https://github.com/Perl/perl5/commit/dedf26f6d4d331d56d8fc2d9ca6836322a81287a
Author: David Mitchell <[email protected]>
Date: 2026-02-15 (Sun, 15 Feb 2026)
Changed paths:
M peep.c
M t/perf/opcount.t
Log Message:
-----------
optimise codeblocks of any/all functions
The recently-added any/all experimental list functions weren't
having the code in their code block passed through the peephole
optimiser. So for example with
use feature 'keyword_any';
@a = any { $x[0] } @b;
the aelem op in the code block wasn't being optimised into an aelemfast.
The fix is trivial - just make sure that the op_other for the
OP_ANYWHILE op is passed to the peephole optimiser. Also add tests.
Do a similar thing for OP_HELEMEXISTSOR; but since this op isn't
generated by Perl code, I haven't added tests for it.
Commit: 061c57c2893af546e10fab2c761fbd922aebcd1e
https://github.com/Perl/perl5/commit/061c57c2893af546e10fab2c761fbd922aebcd1e
Author: David Mitchell <[email protected]>
Date: 2026-02-15 (Sun, 15 Feb 2026)
Changed paths:
M peep.c
Log Message:
-----------
rpeep(): refactor: simplify catch() handling.
OP_ENTERTRYCATCH's op_other points to an OP_CATCH which has an op_other
pointing to the code in the catch {} block. To ensure that this block
gets passed through the peephole optimiser, just add OP_CATCH to the
list of known LOGOPs which have an op_other needing processing, rather
than special-casing OP_ENTERTRYCATCH to peephole op_other->op_other.
This is infinitesimally less efficient, but makes the code easier to
follow, with one less special case.
Commit: 2b8c9eaaa51bfff868c0116f7fde34bcbb60389c
https://github.com/Perl/perl5/commit/2b8c9eaaa51bfff868c0116f7fde34bcbb60389c
Author: David Mitchell <[email protected]>
Date: 2026-02-15 (Sun, 15 Feb 2026)
Changed paths:
M peep.c
Log Message:
-----------
rpeep(): refactor: tidy op_other handling.
In the branches handling LOGOPs and op_other,
* use an explicit 'goto generic_logop' rather than relying on
/* FALLTHROUGH */;
* make OP_ENTERTRY use 'goto generic_logop' rather than having
its own DEFER() call;
* move the OP_ENTERTRY and OP_ENTERTRYCATCH cases earlier so that
they are with the other LOGOPs.
Shouldn't be any functional changes.
Commit: 6faed1d461a954cef81fce455195122d8ee2286c
https://github.com/Perl/perl5/commit/6faed1d461a954cef81fce455195122d8ee2286c
Author: David Mitchell <[email protected]>
Date: 2026-02-15 (Sun, 15 Feb 2026)
Changed paths:
M peep.c
Log Message:
-----------
rpeep(): assert that some LOGOPs are done
In general, rpeep() needs to follow the op_other pointer of LOGOPs
to optimise the 'other' branch of logical ops. However, some ops don't
need doing, because their op_other doesn't point to general user code,
but to a fixed op which will have already been processed. For example,
OP_SUBSTCONT->op_other always points to its parent OP_SUBST.
Previously these ops were missing from the rpeep() main loop as nothing
needed doing for them. This commit adds them, both for completeness,
and also adds asserts that their op_other points to something which
doesn't need to be processed.
This commit serves two purposes:
* it makes it clear that the op hasn't just been forgotten (I had to
examine each missing LOGOP and try to work out why it wasn't in
rpeep() - future people hopefully won't have to repeat this exercise);
* if any of the asserts fail, it is indication that my understanding of
that op wasn't complete, and that there may in fact be cases where the
op_other *should* be followed.
Commit: 1aa97811c21ec49238a753e58a3b53dabaff4ca1
https://github.com/Perl/perl5/commit/1aa97811c21ec49238a753e58a3b53dabaff4ca1
Author: David Mitchell <[email protected]>
Date: 2026-02-15 (Sun, 15 Feb 2026)
Changed paths:
M peep.c
Log Message:
-----------
rpeep(): refactor: simplify deleting bare if blks
There's some code in rpeep() structured a bit like:
case OP_COND_EXPR:
...
if (the true branch is a bare stub op) {
delete the branch;
}
elsif (the true branch is a bare enter/scope and stub branch) {
delete the branch;
}
This commit changes/simplifies that code to:
if ( the true branch is a bare stub op
|| the true branch is a bare enter/scope and stub branch)
{
delete the branch;
}
Commit: 46b82baa4eafe3c6933d4c7cd629446fd2eccc82
https://github.com/Perl/perl5/commit/46b82baa4eafe3c6933d4c7cd629446fd2eccc82
Author: David Mitchell <[email protected]>
Date: 2026-02-15 (Sun, 15 Feb 2026)
Changed paths:
M peep.c
Log Message:
-----------
rpeep(): remove spurious flag setting on LOGOPs
the main loop in rpeep() does
o->op_opt = 1
on each op just before it processes it, to indicate that the op has been
processed and peephole-optimised.
For some reason, just the OP_AND/OP_OR/etc ops set it again.
This appears superfluous, and changing it to assert(o->op_opt)
didn't trigger any test suite failures, so this commit removes it
altogether.
Commit: 17fc0d70ac0bbac96f494053be2248f6828a8d59
https://github.com/Perl/perl5/commit/17fc0d70ac0bbac96f494053be2248f6828a8d59
Author: David Mitchell <[email protected]>
Date: 2026-02-15 (Sun, 15 Feb 2026)
Changed paths:
M dump.c
Log Message:
-----------
op_dump(): display OTHER on newish LOGOPs
Some recently-added OPs of class LOGOP weren't having their op_other
field displayed by op_dump().
Compare: https://github.com/Perl/perl5/compare/e903581dedfe...17fc0d70ac0b
To unsubscribe from these emails, change your notification settings at
https://github.com/Perl/perl5/settings/notifications