Branch: refs/heads/davem/deparse_fixes
Home: https://github.com/Perl/perl5
Commit: d6c08401f717786f75da88e76c10d4ab19f3f8dc
https://github.com/Perl/perl5/commit/d6c08401f717786f75da88e76c10d4ab19f3f8dc
Author: David Mitchell <[email protected]>
Date: 2026-02-02 (Mon, 02 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: 343fa126634a966a3902915863d9665b2687e23d
https://github.com/Perl/perl5/commit/343fa126634a966a3902915863d9665b2687e23d
Author: David Mitchell <[email protected]>
Date: 2026-02-02 (Mon, 02 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: af19fc254c84e55ad2d19b3c3110ee29a4687512
https://github.com/Perl/perl5/commit/af19fc254c84e55ad2d19b3c3110ee29a4687512
Author: David Mitchell <[email protected]>
Date: 2026-02-02 (Mon, 02 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: 1c978666f18cf07e4626db226197339c88b338cd
https://github.com/Perl/perl5/commit/1c978666f18cf07e4626db226197339c88b338cd
Author: David Mitchell <[email protected]>
Date: 2026-02-02 (Mon, 02 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: 0db213599c1f6adc773390e4ed134a7dce32aa45
https://github.com/Perl/perl5/commit/0db213599c1f6adc773390e4ed134a7dce32aa45
Author: David Mitchell <[email protected]>
Date: 2026-02-02 (Mon, 02 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: e0dc1c0008332b090d6f1a780fb04bad6b63bb68
https://github.com/Perl/perl5/commit/e0dc1c0008332b090d6f1a780fb04bad6b63bb68
Author: David Mitchell <[email protected]>
Date: 2026-02-02 (Mon, 02 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: c3fc57a64012830d3836a65cbfd4955d90a399e6
https://github.com/Perl/perl5/commit/c3fc57a64012830d3836a65cbfd4955d90a399e6
Author: David Mitchell <[email protected]>
Date: 2026-02-02 (Mon, 02 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: ef1d63c3e30f4679906ebc74184fb38dbc46cc22
https://github.com/Perl/perl5/commit/ef1d63c3e30f4679906ebc74184fb38dbc46cc22
Author: David Mitchell <[email protected]>
Date: 2026-02-02 (Mon, 02 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: 0cd652bbead702ea7a5244b1a0e6f6ac16016153
https://github.com/Perl/perl5/commit/0cd652bbead702ea7a5244b1a0e6f6ac16016153
Author: David Mitchell <[email protected]>
Date: 2026-02-02 (Mon, 02 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: 8efb3400d525d5d31552a0e37ec79243bb771faf
https://github.com/Perl/perl5/commit/8efb3400d525d5d31552a0e37ec79243bb771faf
Author: David Mitchell <[email protected]>
Date: 2026-02-02 (Mon, 02 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: bed80a86c178467856931d6cf474180507be302b
https://github.com/Perl/perl5/commit/bed80a86c178467856931d6cf474180507be302b
Author: David Mitchell <[email protected]>
Date: 2026-02-02 (Mon, 02 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: 64fb9889d5022f65957302cabe5240af164ff216
https://github.com/Perl/perl5/commit/64fb9889d5022f65957302cabe5240af164ff216
Author: David Mitchell <[email protected]>
Date: 2026-02-02 (Mon, 02 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 commit changes it does that it *always* lists such
unexpected successes.
Compare: https://github.com/Perl/perl5/compare/d6c08401f717%5E...64fb9889d502
To unsubscribe from these emails, change your notification settings at
https://github.com/Perl/perl5/settings/notifications