summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-12-27 09:20:21 +0000
committerNicholas Clark <nick@ccl4.org>2008-12-27 21:12:13 +0000
commit553e831a35acc518a30a7514866e0d1440e894ef (patch)
tree208c9b76e487e0f48d08d920dcecc66498e2bf6d /hv.c
parent58d4c5dfb9bcf0d0f30468212e01c1f9c9d48ce3 (diff)
downloadperl-553e831a35acc518a30a7514866e0d1440e894ef.tar.gz
Optimisation of the use of the meta structure - don't create a hash if all we
are dealing with is data for the current MRO. Instead the direct pointer "owns" the (reference to the) data, with the hash pointer left as NULL to signal this.
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/hv.c b/hv.c
index d41b9788e1..562a06b975 100644
--- a/hv.c
+++ b/hv.c
@@ -1694,7 +1694,17 @@ S_hfreeentries(pTHX_ HV *hv)
iter->xhv_eiter = NULL; /* HvEITER(hv) = NULL */
if((meta = iter->xhv_mro_meta)) {
- if(meta->mro_linear_dfs) SvREFCNT_dec(meta->mro_linear_dfs);
+ if (meta->mro_linear_dfs) {
+ SvREFCNT_dec(MUTABLE_SV(meta->mro_linear_dfs));
+ meta->mro_linear_dfs = NULL;
+ /* This is just acting as a shortcut pointer. */
+ meta->mro_linear_c3 = NULL;
+ } else if (meta->mro_linear_c3) {
+ /* Only the current MRO is stored, so this owns the data.
+ */
+ SvREFCNT_dec(MUTABLE_SV(meta->mro_linear_c3));
+ meta->mro_linear_c3 = NULL;
+ }
if(meta->mro_nextmethod) SvREFCNT_dec(meta->mro_nextmethod);
SvREFCNT_dec(meta->isa);
Safefree(meta);