Branch: refs/heads/davem/deparse_fixes
Home: https://github.com/Perl/perl5
Commit: fc6662657ebfa3ecf025185cff589d70557baf98
https://github.com/Perl/perl5/commit/fc6662657ebfa3ecf025185cff589d70557baf98
Author: David Mitchell <[email protected]>
Date: 2026-02-09 (Mon, 09 Feb 2026)
Changed paths:
M lib/B/Deparse.pm
M lib/B/Deparse.t
Log Message:
-----------
Deparse: fix blockless elsif
Recent work to optimise away empty branches of if/else etc,
unfortunately broke the deparsing of
if (C1)
X;
}
elsif (C2) {
Y;
}
I.e. where there is no final else after the elsif. The new code
assumed that the 'elsif' branch of the if/else was itself
an OP_COND; but in the absence of a final else, and OP_AND is used
instead.
Commit: 5a1e5f79a75e9eb502d17675dde61cec4a7fa7d8
https://github.com/Perl/perl5/commit/5a1e5f79a75e9eb502d17675dde61cec4a7fa7d8
Author: David Mitchell <[email protected]>
Date: 2026-02-09 (Mon, 09 Feb 2026)
Changed paths:
M lib/B/Deparse.pm
Log Message:
-----------
Deparse.pm: add some code comments and whitespace
Better explain how the optimised away if/else blocks are handled
and the difference between ?: and if/else.
Also, add a few blank lines for readability.
Commit: 6eba9deb6da8ce252309d5524893450fa4fd887f
https://github.com/Perl/perl5/commit/6eba9deb6da8ce252309d5524893450fa4fd887f
Author: David Mitchell <[email protected]>
Date: 2026-02-09 (Mon, 09 Feb 2026)
Changed paths:
M lib/B/Deparse.pm
M lib/B/Deparse.t
Log Message:
-----------
Deparse.pm: fix for loop with empty body
this:
for $foo (...) {}
was no longer being deparsed, since a recent change optimised away the
'stub' op making up the body.
This caused Deparse to not spot a valid block top op and mistake it
instead for a 'for' statement modifier. It would then panic because the
loop variable wasn't '$_'.
Also fix the panic - it was just doing confess() without any message.
Do a normal die() instead, with a helpful error message.
Commit: 06848a7536688e95192e7731661f3096efbab7ba
https://github.com/Perl/perl5/commit/06848a7536688e95192e7731661f3096efbab7ba
Author: David Mitchell <[email protected]>
Date: 2026-02-09 (Mon, 09 Feb 2026)
Changed paths:
M lib/B/Deparse.pm
Log Message:
-----------
Deparse.pm: fix multivar for with refalias
'for' was recently enhanced to support
for my ($x, \$y, $z) (...) { ... }
where the OP_ITER's targ contains both a count of the number of index
variables and a mask indicating which vars are refaliases.
This commit makes Deparse catch up.
Before this commit,
cd t; ./TEST -deparse op/for-many.t
was failing.
Commit: 8cd3b9aa66582fb13c217f94f44dcaca0fd250d7
https://github.com/Perl/perl5/commit/8cd3b9aa66582fb13c217f94f44dcaca0fd250d7
Author: David Mitchell <[email protected]>
Date: 2026-02-09 (Mon, 09 Feb 2026)
Changed paths:
M lib/B/Deparse.pm
M lib/B/Deparse.t
Log Message:
-----------
Deparse: fix handling empty continue block
Recent changes optimised away the stub op in empty blocks.
This was causing code like this:
{
f(234);
}
continue { }
to break the deparser:
Can't call method "name" on an undefined value at lib/B/Deparse.pm line
6987.
This was due to a long-standing thinko in is_lexical_subs() which was
doing:
my (@ops) = shift;
when it (presumably) should have been doing:
my (@ops) = @_;
The pre-existing effect of this thinko was that potentially it might not
spot a lexical sub declaration and thus change whether to wrap the block
in 'do {}'.
The effect after stub become ex-stub was that @_ was now empty and so
$ops[0] was now an undef value.
Commit: 1ee03a46a935e0b59acb50cf5914d0e55888199c
https://github.com/Perl/perl5/commit/1ee03a46a935e0b59acb50cf5914d0e55888199c
Author: David Mitchell <[email protected]>
Date: 2026-02-09 (Mon, 09 Feb 2026)
Changed paths:
M lib/B/Deparse.pm
M lib/B/Deparse.t
Log Message:
-----------
Deparse.pm: handle empty package block
Handle the recent change where stub ops are optimised out
Commit: 65fa00501fe23c4caecd4dfe6b3557daf3df9677
https://github.com/Perl/perl5/commit/65fa00501fe23c4caecd4dfe6b3557daf3df9677
Author: David Mitchell <[email protected]>
Date: 2026-02-09 (Mon, 09 Feb 2026)
Changed paths:
M Porting/deparse-skips.txt
M gv.c
Log Message:
-----------
./TEST -deparse: skip t/op/caller.t
Since v5.43.1-82-gc0053197fb,
Reapply "op.c: re-enable coderef-in-stash optimization"
t/op/caller.t no longer passes a round trip through Deparse. This commit
adds it to the list of test files expected to fail.
The issue is that when storing a CV directly in a stash rather than as
part of a new GV, the 'reify GV' code, which later converts the stash
entry from a CV to a GV-to-CV, will set the line/file of the GV to the
location where/when the reification took place, rather than to where the
sub was defined. This doesn't matter 99.999% of the time - I temporarily
hacked Perl_cvgv_from_hek() to always set the line number to 999999 and
no tests failed - but it fails a caller.t deparse round-trip test which
is using '#line' to modify what a BEGIN sub sees as its caller. The
deparsed file doesn't have the correct values in the '#line'.
I can't see any easy way to fix this - I don't think the original
line/file info is stored anywhere - so this commit just skips caller.t
for now.
I've also added some code comments to Perl_cvgv_from_hek() to explain
the implementation leakage.
Commit: 9b4ce3e4d818f1a9684578a5aeb9414cf16b57f9
https://github.com/Perl/perl5/commit/9b4ce3e4d818f1a9684578a5aeb9414cf16b57f9
Author: David Mitchell <[email protected]>
Date: 2026-02-09 (Mon, 09 Feb 2026)
Changed paths:
M ext/B/t/optree_samples.t
M lib/B/Op_private.pm
M op.c
M opcode.h
M perly.act
M perly.h
M perly.tab
M perly.y
M regen/embed.pl
M regen/op_private
Log Message:
-----------
add OPpSTATEMENT private flag for logops
The same ops, AND/OR/COND_EXPR, are used both for statements such
as:
if (...) { ... }
if (...) { ... } else { ... }
... if ...;
and expressions, such as:
... && ...
... ? ... : ...
This commit adds a new private OP flag, OPpSTATEMENT, and makes the
parser set it on such ops when they are derived from if/else etc rather
than from ?:,&&,|| etc.
The flags are currently unused after being set on the ops, but they will
be used by Deparse shortly to stop it from having to guess what form to
use. There are lots of spare private flag bits on those logops, so using
one of them just for a non-essential reason seems reasonable.
Commit: 1bd8ca0295387e971f58e498a582d6d3e5aec5c6
https://github.com/Perl/perl5/commit/1bd8ca0295387e971f58e498a582d6d3e5aec5c6
Author: David Mitchell <[email protected]>
Date: 2026-02-09 (Mon, 09 Feb 2026)
Changed paths:
M lib/B/Deparse.pm
M lib/B/Deparse.t
Log Message:
-----------
Deparse.pm: use OPpSTATEMENT to simplify if/else
Use the OPpSTATEMENT flag, added by the previous commit, to simplify
the deparsing of
if ($c) { foo() }
if ($c) { foo() } else { bar() }
foo() unless $c
etc
versus
$c && foo()
$c ? foo() : bar()
$c || foo()
etc
Previously it had to guess which of those two forms to use; now it uses
that flag, which simplifies the code and makes a couple of failing
round-trip test files pass under './TEST -deparse'.
Commit: 3461b134a44d03cbda00a610a07d208d65aaa8c5
https://github.com/Perl/perl5/commit/3461b134a44d03cbda00a610a07d208d65aaa8c5
Author: David Mitchell <[email protected]>
Date: 2026-02-09 (Mon, 09 Feb 2026)
Changed paths:
M t/test_pl.pod
M t/test_pl/examples.t
Log Message:
-----------
test_pl.pod: improve refcount_is() example
This commit:
- updates the POD in t/test_pl.pod to improve the documentation for the
refcount_is() test function. It makes it clear that the first argument
is a *reference* to the thing which is having it's reference count
compared.
- makes the example in that pod simpler.
- updates the tests in t/test_pl/examples.t which are supposed to test
that example code snippet in test_pl.pod. It's changed because: first,
the example code didn't match the test code, second, the example code
has changed; third, the old test code didn't survive a round-trip
through './TEST -deparse', since \(1+2) was being constant-folded to
\1, with a different reference count.
Commit: d6398e5446442767394aee9659712babc5355dd7
https://github.com/Perl/perl5/commit/d6398e5446442767394aee9659712babc5355dd7
Author: David Mitchell <[email protected]>
Date: 2026-02-09 (Mon, 09 Feb 2026)
Changed paths:
M Porting/deparse-skips.txt
Log Message:
-----------
update ./TEST -deparse skips
Update the list of skipped files in
Porting/deparse-skips.txt
New entries have been added due to:
- named params in signatures and classes not yet being deparsed correctly
- constant blessed hash ref not being correctly deparsed
Two entries have been removed since they now pass:
dist/Data-Dumper/t/trailing_comma.t
due to better deparsing of '&&' vs 'unless'
cpan/autodie/t/exceptions-smartmatch.t
I'm not sure why that file passes.
Commit: 1a0de88d73e303b7f4f42a5e8a4981618845e341
https://github.com/Perl/perl5/commit/1a0de88d73e303b7f4f42a5e8a4981618845e341
Author: David Mitchell <[email protected]>
Date: 2026-02-09 (Mon, 09 Feb 2026)
Changed paths:
M t/TEST
Log Message:
-----------
t/TEST -deparse: always list unexpected passes
't/TEST -deparse' - which uses Porting/deparse-skips.txt to decide which
files are expected to fail when run after a round-trip through Deparse -
normally lists any expected-fail test files which unexpectedly
succeeded.
However, it only lists them if at least one other test file failed. Or
to put it another way, if all files expected to pass actually pass, it
doesn't mention that some expected to fail passed too.
This commit changes it so that it *always* lists such unexpected
successes.
Compare: https://github.com/Perl/perl5/compare/5cafb2b08a1e...1a0de88d73e3
To unsubscribe from these emails, change your notification settings at
https://github.com/Perl/perl5/settings/notifications