diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-11-29 09:08:08 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-11-29 09:11:32 -0800 |
commit | db9306af4ddf47b54fb142041f8f950b1ec18f08 (patch) | |
tree | 2d966d7a75b8edd8f159f089f96b4e9f061395ee /scope.h | |
parent | af5aa9e378e68e5202ada6a61d269e74cc9fe298 (diff) | |
download | perl-db9306af4ddf47b54fb142041f8f950b1ec18f08.tar.gz |
Clear method caches when unwinding local *foo=sub{}
local *foo=sub{} is done in two stages:
• First the local *foo localises the GP (the glob pointer, or list of
slots), setting a flag on the GV.
• Then scalar assignment sees the flag on the GV on the LHS and loca-
lises a single slot.
The slot localisation only stores on the savestack a pointer into the
GP struct and the old value. There is no reference to the GV.
To restore a method properly, we have to have a reference to the GV
when the slot localisation is undone.
So in this commit I have added a new save type, SAVEt_GVSLOT. It is
like SAVEt_GENERIC_SV, except it pushes the GV as well. Currently
it is used only for CVs, but I will need it for HVs and maybe
AVs as well.
It is possible for the unwinding of the slot localisation to affect
only a GV other than the one that is pushed, if glob assignments have
taken place since the local *foo. So we have to check whether the
pointer is inside the GP and use PL_sub_generation++ if it is not.
Diffstat (limited to 'scope.h')
-rw-r--r-- | scope.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -59,6 +59,7 @@ #define SAVEt_GVSV 49 #define SAVEt_FREECOPHH 50 #define SAVEt_CLEARPADRANGE 51 +#define SAVEt_GVSLOT 52 #define SAVEf_SETMAGIC 1 #define SAVEf_KEEPOLDELEM 2 |