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 /t | |
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 't')
-rw-r--r-- | t/mro/method_caching.t | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/t/mro/method_caching.t b/t/mro/method_caching.t index cbbd655f39..495e12fddc 100644 --- a/t/mro/method_caching.t +++ b/t/mro/method_caching.t @@ -37,7 +37,6 @@ my @testsubs = ( sub { is(MCTest::Derived->foo(0), 5); }, sub { { local *MCTest::Base::can = sub { "tomatoes" }; MCTest::Derived->can(0); } - local $::TODO = " "; is(MCTest::Derived->can("isa"), \&UNIVERSAL::isa, 'removing method when unwinding local *method=sub{}'); }, sub { sub peas { "peas" } |