On Sun, Mar 5, 2023 at 5:22 PM Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
wrote:
> Usually RPEEP and friends does a great job. Sometimes, however, it gets
> in the way.
>
> Sometimes if I want to understand how a piece of code compiles, I look
> at the output of `perl -MO=Concise ...` and look at the optree. The
> output is a fully-optimised one though, and optimisations like
> multideref and multiconcat can make the output very nontrivially
> different from what I had expected to see.
>
This is why I wrote Devel::Nopeep. You are right in that rpeep
unfortunately does some necessary fixups and disabling it can cause
problems. (IIRC you recently started to break out the optimisations versus
the fixups which was a good start to making this possible?)
Anyway, ages ago I wrote Devel::Nopeep exactly for this, maybe this gets
you what you want in a lot of cases, maybe it doesn't:
mhorsfall@tworivers:~$ perl -MO=Concise -e 'my $z = $x->{key}[123]'
6 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
5 <2> sassign vKS/2 ->6
- <1> ex-aelem sK/2 ->4
3 <+> multideref($x->{"key"}[123]) sK ->4
- <0> ex-gv s ->3
4 <0> padsv[$z:1,2] sRM*/LVINTRO ->5
-e syntax OK
mhorsfall@tworivers:~$ perl -MDevel::Nopeep -MO=Concise -e 'my $z =
$x->{key}[123]'
d <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
c <2> sassign vKS/2 ->d
a <2> aelem sK/2 ->b
8 <1> rv2av[t3] sKR/1 ->9
7 <2> helem sKM/DREFAV,2 ->8
5 <1> rv2hv sKR/1 ->6
4 <1> rv2sv sKM/DREFHV,1 ->5
3 <#> gv[*x] s ->4
6 <$> const[PV "key"] s/BARE ->7
9 <$> const[IV 123] s ->a
b <0> padsv[$z:1,2] sRM*/LVINTRO ->c
-e syntax OK
-- Matthew Horsfall (alh)
Thread Previous