This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Renaming of stashes should not be visible from Perl
authorFather Chrysostomos <sprout@cpan.org>
Wed, 27 Oct 2010 16:44:04 +0000 (09:44 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 27 Oct 2010 16:45:26 +0000 (09:45 -0700)
commit78b79c7758384edd69ba966d2f0571855acb1117
tree5804749f02e2f3d1440bc78bd3c684d31ff72202
parent13d356f324d3ac73ad7eb9e627a33e3fa89132ec
Renaming of stashes should not be visible from Perl

Change 35759254 made stashes get renamed when moved around. This had
an unintended consequence: Typeglobs, ref() return values, stringifi-
cation of blessed references and __PACKAGE__ are all affected by this.

This commit makes a new distinction between stashes’ names and effect-
ive names. Stash names are now unaffected when the stashes move
around. Only the effective names are affected. (The apparent presence
of any puns in the previous sentence is purely incidental and most
likely the result of the reader’s inferential propensity.)

To this end a new HvENAME_get macro is introduced, returning the first effective name (what HvNAME_get was returning). (Only one effective
name needs to be in effect at a time.) hv_add_name and hv_delete_name
have been renamed hv_add_ename and hv_delete_ename. hv_name_set is
modified to leave the effective names in place unless the name is
being set to NULL.

These names are now stored in HvAUX as follows: When xhv_name_count is
0, xhv_name is a HEK pointer, containing the name which is also the
effective name. When xhv_name_count is not zero, then xhv_name is a
pointer to an array of HEK pointers. If xhv_name_count is positive,
the first HEK is the name *and* one of the effective names. When
xhv_name_count is negative, the first HEK is the name and subsequent
HEKs are the effective names.
embed.fnc
embed.h
hv.c
hv.h
mro.c
proto.h
sv.c
t/op/stash.t