Skip to content

Commit

Permalink
Caller.pm - Deal with new opcodes
Browse files Browse the repository at this point in the history
This patch is by Richard Leach, who added the new opcodes to perl 5.37.
I am just pushing it because I already had it applied to a git repo
of Devel::Caller.

This fixes Perl/perl5#20114
  • Loading branch information
demerphq committed Jan 27, 2023
1 parent 162c091 commit 6105e69
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/Devel/Caller.pm
Expand Up @@ -83,10 +83,28 @@ sub called_with {
$op = $op->sibling;
}

if ($op->name =~ "pad(sv|av|hv)") {
if ($op->name =~ /padsv_store/) {
# A padsv_store is a 5.37 optimization that combines a padsv and
# an sassign into a single op. The new op steals the targ slot
# of the original padsv.
#
# https://github.com/Perl/perl5/commit/9fdd7fc
print "Copying from pad\n" if $DEBUG;
if ($want_names) {
push @return, $padn->ARRAYelt( $op->targ )->PVX;
}
else {
push @return, $padv->ARRAYelt( $op->targ )->object_2svref;
}
next;
}
elsif ($op->name =~ "pad(sv|av|hv)") {
if ($op->next->next->name eq "sassign") {
print "sassign in two ops, this is the target skipping\n" if $DEBUG;
next;
} elsif ($op->next->name eq "padsv_store") {
print "padsv_store in one op, this is the target, skipping\n" if $DEBUG;
next;
}

print "Copying from pad\n" if $DEBUG;
Expand Down Expand Up @@ -145,6 +163,9 @@ sub called_with {
if ($op->next->next->name eq "sassign") {
print "sassign in two ops, this is the target, skipping\n" if $DEBUG;
next;
} elsif ($op->next->name eq "padsv_store") {
print "padsv_store in one op, this is the target, skipping\n" if $DEBUG;
next;
}

push @return, $want_names ? undef : $op->sv;
Expand Down

0 comments on commit 6105e69

Please sign in to comment.