Branch: refs/heads/blead
Home: https://github.com/Perl/perl5
Commit: 75a310dd6d6a8cfcd7519613d66d46756b5265f0
https://github.com/Perl/perl5/commit/75a310dd6d6a8cfcd7519613d66d46756b5265f0
Author: Richard Leach <[email protected]>
Date: 2025-07-28 (Mon, 28 Jul 2025)
Changed paths:
M lib/B/Deparse.pm
M lib/B/Deparse.t
M op.c
M peep.c
M t/op/cond.t
M t/perf/opcount.t
Log Message:
-----------
op.c/peep.c - Optimise away empty else{} blocks
This is a replacement for https://github.com/Perl/perl5/pull/22745, which
aimed to prevent the associated `OP_STUB` from being created in
`Perl_newCONDOP` and subsequently removed in peep.c. However, doing that
turned out to be unavoidable, since it is not safe to omit the `OP_STUB`
if it is in scalar context, but `Perl_newCONDOP` runs before context is
applied.
This commit:
* Re-adds the logic in `Perl_op_scope` to not wrap a bare `OP_STUB` in an
`ENTER/LEAVE` pair.
* Removes any relevant `OP_STUB`s in non-scalar context in `Perl_rpeep`.
* Adds B::Deparse support
* Adds a test based on the failures seen in
https://github.com/Perl/perl5/issues/22866
Commit: e7778069bc401e5729ab4da6d5fa9821098030bf
https://github.com/Perl/perl5/commit/e7778069bc401e5729ab4da6d5fa9821098030bf
Author: Richard Leach <[email protected]>
Date: 2025-07-28 (Mon, 28 Jul 2025)
Changed paths:
M lib/B/Deparse.pm
M lib/B/Deparse.t
M op.h
M peep.c
M t/perf/opcount.t
Log Message:
-----------
op.h/op.c/peep.c - Optimise away empty if{} blocks
This commit optimises away the OP_STUB associated with an empty `true`
branch of an `OP_COND_EXPR`.
The `OPf_SPECIAL` flag has been brought into use on the `OP_COND_EXPR`
to indicate that it is the `else`, not the `if`, block that has been
optimised away. This is purely for the benefit of B::Deparse.
Compare: https://github.com/Perl/perl5/compare/613101d7fb08...e7778069bc40
To unsubscribe from these emails, change your notification settings at
https://github.com/Perl/perl5/settings/notifications