Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 5fa726eb82cb1530d131c957769b0e3d0ff4fe42
      
https://github.com/Perl/perl5/commit/5fa726eb82cb1530d131c957769b0e3d0ff4fe42
  Author: Richard Leach <richardle...@users.noreply.github.com>
  Date:   2023-08-29 (Tue, 29 Aug 2023)

  Changed paths:
    M op.c
    M opcode.h
    M peep.c
    M regen/opcodes

  Log Message:
  -----------
  OP_EMPTYAVHV: create ops in newANONHASH/newANONLIST rather than rpeep

The current implementation of the OP_EMPTYAVHV optimization does not
optimize instances of empty anonymous hashes/lists on the RHS of LOGOP
conditions, such as in `my $x = $y || {}`.

This commit addresses this by removing the peephole optimization in
favour of having EMPTYAVHV OPs produced directly whenever a call is
made to `newANONHASH` or `newANONLIST` with an empty child OP `o`.
The standard TARGMY optimization in `S_maybe_targlex` has been
slightly adapted to also optimize the `LVINTRO` case for this OP.

This commit also addresses some feedback nits from the last dev
cycle: EMPTYAVHV is no longer a LISTOP, now just a BASEOP, and it
does not use the OPf_SPECIAL flag. (Both were unnecessary carryovers
from the ANONHASH and ANONLIST OPs.)


Reply via email to