From: Nicholas Clark Date: Sat, 18 Jun 2005 16:33:41 +0000 (+0000) Subject: Squeeze a little more savings by moving pte and he arenas into the X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6f51351dc430b1cdbea64b49a24a0fc68a028a36;p=p5sagit%2Fp5-mst-13.2.git Squeeze a little more savings by moving pte and he arenas into the common arena free code. p4raw-id: //depot/perl@24895 --- diff --git a/hv.h b/hv.h index 6378a02..fc5bcde 100644 --- a/hv.h +++ b/hv.h @@ -14,6 +14,9 @@ typedef struct hek HEK; /* entry in hash value chain */ struct he { + /* Keep hent_next first in this structure, because sv_free_arenas take + advantage of this to share code between the he arenas and the SV + body arenas */ HE *hent_next; /* next entry in chain */ HEK *hent_hek; /* hash key */ SV *hent_val; /* scalar value that was hashed */ diff --git a/perl.h b/perl.h index c85543d..136d472 100644 --- a/perl.h +++ b/perl.h @@ -2820,6 +2820,9 @@ struct regnode_charclass_class; /* Used in S_* functions in regcomp.c */ typedef I32 CHECKPOINT; +/* Keep next first in this structure, because sv_free_arenas take + advantage of this to share code between the pte arenas and the SV + body arenas */ struct ptr_tbl_ent { struct ptr_tbl_ent* next; void* oldval; diff --git a/sv.c b/sv.c index 174f893..56e1d8e 100644 --- a/sv.c +++ b/sv.c @@ -537,6 +537,10 @@ Perl_sv_free_arenas(pTHX) (void**) &PL_xpvgv_arenaroot, (void**) &PL_xpvlv_arenaroot, (void**) &PL_xpvbm_arenaroot, + (void**) &PL_he_arenaroot, +#if defined(USE_ITHREADS) + (void**) &PL_pte_arenaroot, +#endif (void**) 0 }; void **roots[] = { @@ -551,6 +555,10 @@ Perl_sv_free_arenas(pTHX) (void**) &PL_xpvgv_root, (void**) &PL_xpvlv_root, (void**) &PL_xpvbm_root, + (void**) &PL_he_root, +#if defined(USE_ITHREADS) + (void**) &PL_pte_root, +#endif (void**) 0 }; @@ -579,30 +587,6 @@ Perl_sv_free_arenas(pTHX) *roots[i] = 0; } - { - HE *he; - HE *he_next; - for (he = PL_he_arenaroot; he; he = he_next) { - he_next = HeNEXT(he); - Safefree(he); - } - } - PL_he_arenaroot = 0; - PL_he_root = 0; - -#if defined(USE_ITHREADS) - { - struct ptr_tbl_ent *pte; - struct ptr_tbl_ent *pte_next; - for (pte = PL_pte_arenaroot; pte; pte = pte_next) { - pte_next = pte->next; - Safefree(pte); - } - } - PL_pte_arenaroot = 0; - PL_pte_root = 0; -#endif - if (PL_nice_chunk) Safefree(PL_nice_chunk); PL_nice_chunk = Nullch;