diff options
author | David Mitchell <davem@iabyn.com> | 2010-07-04 20:51:35 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2010-07-14 23:06:16 +0100 |
commit | 044d8c24fa9214cf0fe9c6fc8a44e03f3f5374d7 (patch) | |
tree | fb7c4f1cf47a56b809c8e3be0d96e72b5e6d1cf8 /proto.h | |
parent | fd2c61bcfdb4c097be4d3934b00729bb46787824 (diff) | |
download | perl-044d8c24fa9214cf0fe9c6fc8a44e03f3f5374d7.tar.gz |
process xhv_backreferences early in S_hfreeentries
When deleting a stash, make the algorithm
GvSTASH($_) = NULL for (@xhv_backreferences);
delete xhv_backreferences;
free each stash entry;
Previously the algorithm was
hide xhv_backreferences as ordinary backref magic;
free each stash entry:
this may trigger a sv_del_backref() for each GV being freed
delete @xhv_backreferences
The new method is:
* more efficient: one scan through @xhv_backreferences rather than lots of
calls to sv_del_backref(), removing elements one by one;
* makes the code simpler; the 'hide xhv_backreferences as backref magic'
hack no longer needs to be done
* removes a bug whereby GVs that had a refcnt > 1 (the usual case) were
left with a GvSTASH pointing to the freed stash; it's now NULL instead. I
couldn't think of a test for this.
There are two drawbacks:
* If the GV gets freed at the same time as the stash, the freeing code
sees the GV with a GVSTASH of NULL rather than still pointing to the
stash.
* As far as I can see, the only difference this currently makes is that
mro_method_changed_in() is no longer called by sv_clear(), but since we're
blowing away the whole stash anyway, method resolution doesn't really
bother us any more.
At some point in the future I might set GvSTASH to %__ANON__ rather than
NULL.
Diffstat (limited to 'proto.h')
-rw-r--r-- | proto.h | 7 |
1 files changed, 0 insertions, 7 deletions
@@ -6459,13 +6459,6 @@ PERL_CALLCONV AV** Perl_hv_backreferences_p(pTHX_ HV *hv) #define PERL_ARGS_ASSERT_HV_BACKREFERENCES_P \ assert(hv) -#if defined(PERL_IN_DUMP_C) || defined(PERL_IN_HV_C) || defined(PERL_IN_SV_C) -PERL_CALLCONV void Perl_hv_kill_backrefs(pTHX_ HV *hv) - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_HV_KILL_BACKREFS \ - assert(hv) - -#endif PERL_CALLCONV void Perl_hv_clear_placeholders(pTHX_ HV *hv) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_HV_CLEAR_PLACEHOLDERS \ |