summaryrefslogtreecommitdiff
path: root/embed.fnc
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2010-07-04 20:51:35 +0100
committerDavid Mitchell <davem@iabyn.com>2010-07-14 23:06:16 +0100
commit044d8c24fa9214cf0fe9c6fc8a44e03f3f5374d7 (patch)
treefb7c4f1cf47a56b809c8e3be0d96e72b5e6d1cf8 /embed.fnc
parentfd2c61bcfdb4c097be4d3934b00729bb46787824 (diff)
downloadperl-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 'embed.fnc')
-rw-r--r--embed.fnc4
1 files changed, 0 insertions, 4 deletions
diff --git a/embed.fnc b/embed.fnc
index 85beec1a1e..a1e8ecdcb7 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -2134,10 +2134,6 @@ Apo |void |hv_eiter_set |NN HV *hv|NULLOK HE *eiter
Ap |void |hv_name_set |NN HV *hv|NULLOK const char *name|U32 len|U32 flags
: Used in dump.c and hv.c
poM |AV** |hv_backreferences_p |NN HV *hv
-#if defined(PERL_IN_DUMP_C) || defined(PERL_IN_HV_C) || defined(PERL_IN_SV_C)
-: Only used in sv.c
-poM |void |hv_kill_backrefs |NN HV *hv
-#endif
Apd |void |hv_clear_placeholders |NN HV *hv
ApoR |I32* |hv_placeholders_p |NN HV *hv
ApoR |I32 |hv_placeholders_get |NN const HV *hv