Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 10a5c9138224597d018843f3b298a928555b67f0
      
https://github.com/Perl/perl5/commit/10a5c9138224597d018843f3b298a928555b67f0
  Author: Richard Leach <richardle...@users.noreply.github.com>
  Date:   2022-10-24 (Mon, 24 Oct 2022)

  Changed paths:
    M ext/Opcode/Opcode.pm
    M lib/B/Deparse.pm
    M lib/B/Op_private.pm
    M opcode.h
    M opnames.h
    M peep.c
    M pp.c
    M pp_proto.h
    M regen/op_private
    M regen/opcodes
    M t/perf/benchmarks
    M t/perf/opcount.t

  Log Message:
  -----------
  OP_EMPTYAVHV - optimized empty ANONLIST/ANONHASH

This commit introduces a new OP to replace cases of OP_ANONLIST and
OP_ANONHASH where there are zero elements, which is very common in
Perl code.

As an example, `my $x = {}` is currently implemented like this:
    ...
    6     <2> sassign vKS/2 ->7
    4        <@> anonhash sK* ->5
    3           <0> pushmark s ->4
    5        <0> padsv[$x:1,2] sRM*/LVINTRO ->6

The pushmark serves no meaningful purpose when there are zero
elements and the anonhash, besides undoing the pushmark,
performs work that is unnecessary for this special case.

The peephole optimizer, which also checks for applicability of a
related TARGMY optimization, transforms this example into:
    ...
    -     <1> ex-sassign vKS/2 ->4
    3        <@> emptyavhv[$x:1,2] vK*/LVINTRO,ANONHASH,TARGMY ->4
    -           <0> ex-pushmark s ->3
    -        <0> ex-padsv sRM*/LVINTRO ->-


  Commit: 8b4768d1bcec4110f56a34c3d7ca4586c58434d9
      
https://github.com/Perl/perl5/commit/8b4768d1bcec4110f56a34c3d7ca4586c58434d9
  Author: Richard Leach <richardle...@users.noreply.github.com>
  Date:   2022-10-24 (Mon, 24 Oct 2022)

  Changed paths:
    M ext/Opcode/Opcode.pm

  Log Message:
  -----------
  version bump to squash


Compare: https://github.com/Perl/perl5/compare/71a3dd321d7f...8b4768d1bcec

Reply via email to