This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Avoid vivifying stuff when looking up barewords
authorFather Chrysostomos <sprout@cpan.org>
Sat, 30 Aug 2014 03:18:23 +0000 (20:18 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 30 Aug 2014 04:50:43 +0000 (21:50 -0700)
commit211a4342c9ab2a1353f618cb96de02610eaa1989
tree57e83e8ad42d795ee4b26c23367b0c91af3651f3
parentcff06bc4e9340e61387bd9505055ed3a19aa25ef
Avoid vivifying stuff when looking up barewords

Till now, when a bareword was looked up to see whether it was a sub-
routine, an rv2cv op was created (to allow PL_check hooks to override
the process), which was then asked for its GV.

Afterwards, the GV was downgraded back to nothing if possible.

So a lot of the time a GV was autovivified and then discarded.  This
has been the case since f74617600 (5.12).

If we know there is a good chance that the rv2cv op is about to be
deleted, we can avoid that by passing a flag to the new op.

Also f74617600 actually changed the behaviour by vivifying stashes
that used not be vivified:

sub foo { print shift, "\n" }
SUPER::foo bar if 0;
foo SUPER;

Output in 5.10:

    SUPER

Output as of this commit:

    SUPER

Output in 5.12 to 5.21.3:

    Can't locate object method "foo" via package "SUPER" at - line 3.
op.c
op.h
t/op/stash.t
toke.c