[perl #82111] de-pessimise some my @array = ...
authorDavid Mitchell <davem@iabyn.com>
Sat, 12 Mar 2011 22:01:26 +0000 (22:01 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sat, 12 Mar 2011 22:54:28 +0000 (22:54 +0000)
commitacdea6f0600816151724f1e3525a3e41433e2646
tree14beee47ca5d8594c82f860994601220de9ff1e4
parentfaa5b915472fb587460f0f9249bf16fecdf6f103
[perl #82111] de-pessimise some my @array = ...

Due to obscure closure and goto tricks, it's sometimes possible for the
array or hash in the LHS of 'my @a = ...' and 'my %h = ...' to be
non-empty. At compile-time, these conditions are detected and the assign
op is compiled with the OPpASSIGN_COMMON, making the assignment slower.

This commit speeds it up again by adding a run-time check to pp_aassign
to only do the OPpASSIGN_COMMON code-branch if the LHS isn't an empty
array or hash.

See also #70171.
pp_hot.c