cvs commit: ponie/src/pmc perl5pv.pmc perl5pvav.pmc perl5pvbm.pmc perl5pvcv.pmc perl5pvhv.pmc perl5pviv.pmc perl5pvlv.pmc perl5pvmg.pmc perl5pvnv.pmc

[email protected] (Nicholas Clark) 6 May 2005 15:27:28 -0000
Newsgroups perl.ponie.changes
Message-ID <[email protected]>
cvsuser     05/05/06 08:27:28

  Modified:    perl     embedvar.h hv.c intrpvar.h perl.h perlapi.h sv.c
               src/pmc  perl5pv.pmc perl5pvav.pmc perl5pvbm.pmc
                        perl5pvcv.pmc perl5pvhv.pmc perl5pviv.pmc
                        perl5pvlv.pmc perl5pvmg.pmc perl5pvnv.pmc
  Log:
  Assimilate changes 24404 and 24405 from blead. Seems to give a 2.5% speedup
  on make test
  
  Revision  Changes    Path
  1.15      +4 -0      ponie/perl/embedvar.h
  
  Index: embedvar.h
  ===================================================================
  RCS file: /cvs/public/ponie/perl/embedvar.h,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- embedvar.h	4 May 2005 09:44:01 -0000	1.14
  +++ embedvar.h	6 May 2005 15:27:27 -0000	1.15
  @@ -359,6 +359,8 @@
   #define PL_psig_name		(vTHX->Ipsig_name)
   #define PL_psig_pend		(vTHX->Ipsig_pend)
   #define PL_psig_ptr		(vTHX->Ipsig_ptr)
  +#define PL_pte_arenaroot	(vTHX->Ipte_arenaroot)
  +#define PL_pte_root		(vTHX->Ipte_root)
   #define PL_ptr_table		(vTHX->Iptr_table)
   #define PL_reentrant_buffer	(vTHX->Ireentrant_buffer)
   #define PL_reentrant_retint	(vTHX->Ireentrant_retint)
  @@ -662,6 +664,8 @@
   #define PL_Ipsig_name		PL_psig_name
   #define PL_Ipsig_pend		PL_psig_pend
   #define PL_Ipsig_ptr		PL_psig_ptr
  +#define PL_Ipte_arenaroot	PL_pte_arenaroot
  +#define PL_Ipte_root		PL_pte_root
   #define PL_Iptr_table		PL_ptr_table
   #define PL_Ireentrant_buffer	PL_reentrant_buffer
   #define PL_Ireentrant_retint	PL_reentrant_retint
  
  
  
  1.16      +2 -2      ponie/perl/hv.c
  
  Index: hv.c
  ===================================================================
  RCS file: /cvs/public/ponie/perl/hv.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- hv.c	1 May 2005 17:35:10 -0000	1.15
  +++ hv.c	6 May 2005 15:27:27 -0000	1.16
  @@ -61,12 +61,12 @@
       register HE* he;
       register HE* heend;
       XPV *ptr;
  -    New(54, ptr, 1008/sizeof(XPV), XPV);
  +    New(54, ptr, PERL_ARENA_SIZE/sizeof(XPV), XPV);
       ptr->xpv_pv = (char*)PL_he_arenaroot;
       PL_he_arenaroot = ptr;
   
       he = (HE*)ptr;
  -    heend = &he[1008 / sizeof(HE) - 1];
  +    heend = &he[PERL_ARENA_SIZE / sizeof(HE) - 1];
       PL_he_root = ++he;
       while (he < heend) {
   	HeNEXT(he) = (HE*)(he + 1);
  
  
  
  1.12      +2 -0      ponie/perl/intrpvar.h
  
  Index: intrpvar.h
  ===================================================================
  RCS file: /cvs/public/ponie/perl/intrpvar.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- intrpvar.h	3 May 2005 22:16:29 -0000	1.11
  +++ intrpvar.h	6 May 2005 15:27:27 -0000	1.12
  @@ -261,6 +261,7 @@
   PERLVAR(Ixpvlv_root,	XPVLV *)	/* free xpvlv list */
   PERLVAR(Ixpvbm_root,	XPVBM *)	/* free xpvbm list */
   PERLVAR(Ihe_root,	HE *)		/* free he list */
  +PERLVAR(Ipte_root,	struct ptr_tbl_ent *)	/* free ptr_tbl_ent list */
   PERLVAR(Inice_chunk,	char *)		/* a nice chunk of memory to reuse */
   PERLVAR(Inice_chunk_size,	U32)	/* how nice the chunk of memory is */
   
  @@ -440,6 +441,7 @@
   PERLVAR(Ixpvlv_arenaroot,XPVLV*)	/* list of allocated xpvlv areas */
   PERLVAR(Ixpvbm_arenaroot,XPVBM*)	/* list of allocated xpvbm areas */
   PERLVAR(Ihe_arenaroot,	XPV*)		/* list of allocated he areas */
  +PERLVAR(Ipte_arenaroot,	XPV*)		/* list of allocated he areas */
   
        /* 5.6.0 stopped here */
   
  
  
  
  1.14      +9 -0      ponie/perl/perl.h
  
  Index: perl.h
  ===================================================================
  RCS file: /cvs/public/ponie/perl/perl.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- perl.h	3 May 2005 22:16:29 -0000	1.13
  +++ perl.h	6 May 2005 15:27:27 -0000	1.14
  @@ -687,6 +687,15 @@
   
   #endif /* PERL_CORE */
   
  +
  +#if defined(PERL_CORE) || defined (PONIE_CORE)
  +/* The old value was hard coded at 1008. (4096-16) seems to be a bit faster,
  +   at least on FreeBSD.  YMMV, so experiment.  */
  +#ifndef PERL_ARENA_SIZE
  +#define PERL_ARENA_SIZE 4080
  +#endif
  +#endif
  +
   /* Cannot include embed.h here on Win32 as win32.h has not 
      yet been included and defines some config variables e.g. HAVE_INTERP_INTERN
    */
  
  
  
  1.15      +4 -0      ponie/perl/perlapi.h
  
  Index: perlapi.h
  ===================================================================
  RCS file: /cvs/public/ponie/perl/perlapi.h,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- perlapi.h	4 May 2005 09:44:01 -0000	1.14
  +++ perlapi.h	6 May 2005 15:27:27 -0000	1.15
  @@ -483,6 +483,10 @@
   #define PL_psig_pend		(*Perl_Ipsig_pend_ptr(aTHX))
   #undef  PL_psig_ptr
   #define PL_psig_ptr		(*Perl_Ipsig_ptr_ptr(aTHX))
  +#undef  PL_pte_arenaroot
  +#define PL_pte_arenaroot	(*Perl_Ipte_arenaroot_ptr(aTHX))
  +#undef  PL_pte_root
  +#define PL_pte_root		(*Perl_Ipte_root_ptr(aTHX))
   #undef  PL_ptr_table
   #define PL_ptr_table		(*Perl_Iptr_table_ptr(aTHX))
   #undef  PL_reentrant_buffer
  
  
  
  1.88      +52 -4     ponie/perl/sv.c
  
  Index: sv.c
  ===================================================================
  RCS file: /cvs/public/ponie/perl/sv.c,v
  retrieving revision 1.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- sv.c	4 May 2005 16:44:29 -0000	1.87
  +++ sv.c	6 May 2005 15:27:27 -0000	1.88
  @@ -501,6 +501,13 @@
       PL_he_arenaroot = 0;
       PL_he_root = 0;
   
  +    for (arena = (XPV*)PL_pte_arenaroot; arena; arena = arenanext) {
  +	arenanext = (XPV*)arena->xpv_pv;
  +	Safefree(arena);
  +    }
  +    PL_pte_arenaroot = 0;
  +    PL_pte_root = 0;
  +
       if (PL_nice_chunk)
   	Safefree(PL_nice_chunk);
       PL_nice_chunk = Nullch;
  @@ -9188,6 +9195,45 @@
   
   #define PTR_TABLE_HASH(ptr) (PTR2UV(ptr) >> 4)
   
  +STATIC void
  +S_more_pte(pTHX)
  +{
  +    register struct ptr_tbl_ent* pte;
  +    register struct ptr_tbl_ent* pteend;
  +    XPV *ptr;
  +    New(54, ptr, PERL_ARENA_SIZE/sizeof(XPV), XPV);
  +    ptr->xpv_pv = (char*)PL_pte_arenaroot;
  +    PL_pte_arenaroot = ptr;
  +
  +    pte = (struct ptr_tbl_ent*)ptr;
  +    pteend = &pte[PERL_ARENA_SIZE / sizeof(struct ptr_tbl_ent) - 1];
  +    PL_pte_root = ++pte;
  +    while (pte < pteend) {
  +	pte->next = pte + 1;
  +	pte++;
  +    }
  +    pte->next = 0;
  +}
  +
  +STATIC struct ptr_tbl_ent*
  +S_new_pte(pTHX)
  +{
  +    struct ptr_tbl_ent* pte;
  +    if (!PL_pte_root)
  +	S_more_pte(aTHX);
  +    pte = PL_pte_root;
  +    PL_pte_root = pte->next;
  +    return pte;
  +}
  +
  +STATIC void
  +S_del_pte(pTHX_ struct ptr_tbl_ent*p)
  +{
  +    p->next = PL_pte_root;
  +    PL_pte_root = p;
  +}
  +
  +
   /* delete  */
   
   /* Return the pointer "newval" for this entry. Or NULL for not found.
  @@ -9207,7 +9253,7 @@
   	    void *result = current->newval;
   	    if (tbl->iteration_nesting == 0) {
   		*tblent = current->next;
  -		Safefree(current);
  +		S_del_pte(aTHX_ current);
   		--tbl->tbl_items;
   	    } else {
   		/* Someone is iterating over this ptr_table, so we can't
  @@ -9260,7 +9306,7 @@
   	    return;
   	}
       }
  -    Newz(0, tblent, 1, PTR_TBL_ENT_t);
  +    tblent = S_new_pte(aTHX);
       tblent->oldval = oldv;
       tblent->newval = newv;
       tblent->next = *otblent;
  @@ -9316,7 +9362,7 @@
   	for (entp = ary, ent = *ary; ent; ent = *entp) {
   	    if (!(ent->oldval)) {
   		*entp = ent->next;
  -		Safefree(ent);
  +		S_del_pte(aTHX_ ent);
   		if(--tbl->pending_deletes == 0)
   		    return;
   		continue;
  @@ -9352,7 +9398,7 @@
           if (entry) {
               oentry = entry;
               entry = entry->next;
  -            Safefree(oentry);
  +            S_del_pte(aTHX_ oentry);
           }
           if (!entry) {
               if (++riter > max) {
  @@ -10431,6 +10477,8 @@
       PL_xpvbm_root	= NULL;
       PL_he_arenaroot	= NULL;
       PL_he_root		= NULL;
  +    PL_pte_arenaroot	= NULL;
  +    PL_pte_root		= NULL;
       PL_nice_chunk	= NULL;
       PL_nice_chunk_size	= 0;
       PL_sv_count		= 0;
  
  
  
  1.7       +3 -3      ponie/src/pmc/perl5pv.pmc
  
  Index: perl5pv.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pv.pmc,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- perl5pv.pmc	1 May 2005 21:00:49 -0000	1.6
  +++ perl5pv.pmc	6 May 2005 15:27:27 -0000	1.7
  @@ -22,11 +22,11 @@
   {
       register XPV* xpv;
       register XPV* xpvend;
  -    New(713, xpv, 1008/sizeof(XPV), XPV);
  +    New(713, xpv, PERL_ARENA_SIZE/sizeof(XPV), XPV);
       xpv->xpv_pv = (char*)PL_xpv_arenaroot;
       PL_xpv_arenaroot = xpv;
   
  -    xpvend = &xpv[1008 / sizeof(XPV) - 1];
  +    xpvend = &xpv[PERL_ARENA_SIZE / sizeof(XPV) - 1];
       PL_xpv_root = ++xpv;
       while (xpv < xpvend) {
   	xpv->xpv_pv = (char*)(xpv + 1);
  
  
  
  1.7       +3 -3      ponie/src/pmc/perl5pvav.pmc
  
  Index: perl5pvav.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvav.pmc,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- perl5pvav.pmc	1 May 2005 21:00:49 -0000	1.6
  +++ perl5pvav.pmc	6 May 2005 15:27:27 -0000	1.7
  @@ -22,11 +22,11 @@
   {
       register XPVAV* xpvav;
       register XPVAV* xpvavend;
  -    New(717, xpvav, 1008/sizeof(XPVAV), XPVAV);
  +    New(717, xpvav, PERL_ARENA_SIZE/sizeof(XPVAV), XPVAV);
       xpvav->xav_array = (char*)PL_xpvav_arenaroot;
       PL_xpvav_arenaroot = xpvav;
   
  -    xpvavend = &xpvav[1008 / sizeof(XPVAV) - 1];
  +    xpvavend = &xpvav[PERL_ARENA_SIZE / sizeof(XPVAV) - 1];
       PL_xpvav_root = ++xpvav;
       while (xpvav < xpvavend) {
   	xpvav->xav_array = (char*)(xpvav + 1);
  
  
  
  1.7       +3 -3      ponie/src/pmc/perl5pvbm.pmc
  
  Index: perl5pvbm.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvbm.pmc,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- perl5pvbm.pmc	1 May 2005 21:00:49 -0000	1.6
  +++ perl5pvbm.pmc	6 May 2005 15:27:27 -0000	1.7
  @@ -22,11 +22,11 @@
   {
       register XPVBM* xpvbm;
       register XPVBM* xpvbmend;
  -    New(721, xpvbm, 1008/sizeof(XPVBM), XPVBM);
  +    New(721, xpvbm, PERL_ARENA_SIZE/sizeof(XPVBM), XPVBM);
       xpvbm->xpv_pv = (char*)PL_xpvbm_arenaroot;
       PL_xpvbm_arenaroot = xpvbm;
   
  -    xpvbmend = &xpvbm[1008 / sizeof(XPVBM) - 1];
  +    xpvbmend = &xpvbm[PERL_ARENA_SIZE / sizeof(XPVBM) - 1];
       PL_xpvbm_root = ++xpvbm;
       while (xpvbm < xpvbmend) {
   	xpvbm->xpv_pv = (char*)(xpvbm + 1);
  
  
  
  1.8       +3 -3      ponie/src/pmc/perl5pvcv.pmc
  
  Index: perl5pvcv.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvcv.pmc,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- perl5pvcv.pmc	1 May 2005 21:00:49 -0000	1.7
  +++ perl5pvcv.pmc	6 May 2005 15:27:27 -0000	1.8
  @@ -22,11 +22,11 @@
   {
       register XPVCV* xpvcv;
       register XPVCV* xpvcvend;
  -    New(716, xpvcv, 1008/sizeof(XPVCV), XPVCV);
  +    New(716, xpvcv, PERL_ARENA_SIZE/sizeof(XPVCV), XPVCV);
       xpvcv->xpv_pv = (char*)PL_xpvcv_arenaroot;
       PL_xpvcv_arenaroot = xpvcv;
   
  -    xpvcvend = &xpvcv[1008 / sizeof(XPVCV) - 1];
  +    xpvcvend = &xpvcv[PERL_ARENA_SIZE / sizeof(XPVCV) - 1];
       PL_xpvcv_root = ++xpvcv;
       while (xpvcv < xpvcvend) {
   	xpvcv->xpv_pv = (char*)(xpvcv + 1);
  
  
  
  1.8       +3 -3      ponie/src/pmc/perl5pvhv.pmc
  
  Index: perl5pvhv.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvhv.pmc,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- perl5pvhv.pmc	1 May 2005 21:00:49 -0000	1.7
  +++ perl5pvhv.pmc	6 May 2005 15:27:27 -0000	1.8
  @@ -22,11 +22,11 @@
   {
       register XPVHV* xpvhv;
       register XPVHV* xpvhvend;
  -    New(718, xpvhv, 1008/sizeof(XPVHV), XPVHV);
  +    New(718, xpvhv, PERL_ARENA_SIZE/sizeof(XPVHV), XPVHV);
       xpvhv->xhv_array = (char*)PL_xpvhv_arenaroot;
       PL_xpvhv_arenaroot = xpvhv;
   
  -    xpvhvend = &xpvhv[1008 / sizeof(XPVHV) - 1];
  +    xpvhvend = &xpvhv[PERL_ARENA_SIZE / sizeof(XPVHV) - 1];
       PL_xpvhv_root = ++xpvhv;
       while (xpvhv < xpvhvend) {
   	xpvhv->xhv_array = (char*)(xpvhv + 1);
  
  
  
  1.8       +3 -3      ponie/src/pmc/perl5pviv.pmc
  
  Index: perl5pviv.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pviv.pmc,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- perl5pviv.pmc	1 May 2005 21:00:49 -0000	1.7
  +++ perl5pviv.pmc	6 May 2005 15:27:27 -0000	1.8
  @@ -22,11 +22,11 @@
   {
       register XPVIV* xpviv;
       register XPVIV* xpvivend;
  -    New(714, xpviv, 1008/sizeof(XPVIV), XPVIV);
  +    New(714, xpviv, PERL_ARENA_SIZE/sizeof(XPVIV), XPVIV);
       xpviv->xpv_pv = (char*)PL_xpviv_arenaroot;
       PL_xpviv_arenaroot = xpviv;
   
  -    xpvivend = &xpviv[1008 / sizeof(XPVIV) - 1];
  +    xpvivend = &xpviv[PERL_ARENA_SIZE / sizeof(XPVIV) - 1];
       PL_xpviv_root = ++xpviv;
       while (xpviv < xpvivend) {
   	xpviv->xpv_pv = (char*)(xpviv + 1);
  
  
  
  1.7       +3 -3      ponie/src/pmc/perl5pvlv.pmc
  
  Index: perl5pvlv.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvlv.pmc,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- perl5pvlv.pmc	1 May 2005 21:00:49 -0000	1.6
  +++ perl5pvlv.pmc	6 May 2005 15:27:27 -0000	1.7
  @@ -22,11 +22,11 @@
   {
       register XPVLV* xpvlv;
       register XPVLV* xpvlvend;
  -    New(720, xpvlv, 1008/sizeof(XPVLV), XPVLV);
  +    New(720, xpvlv, PERL_ARENA_SIZE/sizeof(XPVLV), XPVLV);
       xpvlv->xpv_pv = (char*)PL_xpvlv_arenaroot;
       PL_xpvlv_arenaroot = xpvlv;
   
  -    xpvlvend = &xpvlv[1008 / sizeof(XPVLV) - 1];
  +    xpvlvend = &xpvlv[PERL_ARENA_SIZE / sizeof(XPVLV) - 1];
       PL_xpvlv_root = ++xpvlv;
       while (xpvlv < xpvlvend) {
   	xpvlv->xpv_pv = (char*)(xpvlv + 1);
  
  
  
  1.8       +3 -3      ponie/src/pmc/perl5pvmg.pmc
  
  Index: perl5pvmg.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvmg.pmc,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- perl5pvmg.pmc	1 May 2005 21:00:49 -0000	1.7
  +++ perl5pvmg.pmc	6 May 2005 15:27:27 -0000	1.8
  @@ -22,11 +22,11 @@
   {
       register XPVMG* xpvmg;
       register XPVMG* xpvmgend;
  -    New(719, xpvmg, 1008/sizeof(XPVMG), XPVMG);
  +    New(719, xpvmg, PERL_ARENA_SIZE/sizeof(XPVMG), XPVMG);
       xpvmg->xpv_pv = (char*)PL_xpvmg_arenaroot;
       PL_xpvmg_arenaroot = xpvmg;
   
  -    xpvmgend = &xpvmg[1008 / sizeof(XPVMG) - 1];
  +    xpvmgend = &xpvmg[PERL_ARENA_SIZE / sizeof(XPVMG) - 1];
       PL_xpvmg_root = ++xpvmg;
       while (xpvmg < xpvmgend) {
   	xpvmg->xpv_pv = (char*)(xpvmg + 1);
  
  
  
  1.8       +3 -3      ponie/src/pmc/perl5pvnv.pmc
  
  Index: perl5pvnv.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvnv.pmc,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- perl5pvnv.pmc	1 May 2005 21:00:49 -0000	1.7
  +++ perl5pvnv.pmc	6 May 2005 15:27:27 -0000	1.8
  @@ -22,11 +22,11 @@
   {
       register XPVNV* xpvnv;
       register XPVNV* xpvnvend;
  -    New(715, xpvnv, 1008/sizeof(XPVNV), XPVNV);
  +    New(715, xpvnv, PERL_ARENA_SIZE/sizeof(XPVNV), XPVNV);
       xpvnv->xpv_pv = (char*)PL_xpvnv_arenaroot;
       PL_xpvnv_arenaroot = xpvnv;
   
  -    xpvnvend = &xpvnv[1008 / sizeof(XPVNV) - 1];
  +    xpvnvend = &xpvnv[PERL_ARENA_SIZE / sizeof(XPVNV) - 1];
       PL_xpvnv_root = ++xpvnv;
       while (xpvnv < xpvnvend) {
   	xpvnv->xpv_pv = (char*)(xpvnv + 1);