From: Vishal Bhatia Date: Wed, 25 Aug 1999 00:31:33 +0000 (+0900) Subject: add arenas for managing allocations of remaining xpv*v structures X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=932e9ff92dfdad82564fe7085f2cb398e628fac3;p=p5sagit%2Fp5-mst-13.2.git add arenas for managing allocations of remaining xpv*v structures Message-ID: Subject: [PATCH 5.005_60] removing extra ref count (compiler) p4raw-id: //depot/perl@4198 --- diff --git a/embed.h b/embed.h index bf92164..c332e05 100644 --- a/embed.h +++ b/embed.h @@ -938,14 +938,39 @@ #define more_xiv S_more_xiv #define more_xnv S_more_xnv #define more_xpv S_more_xpv +#define more_xpviv S_more_xpviv +#define more_xpvnv S_more_xpvnv +#define more_xpvcv S_more_xpvcv +#define more_xpvav S_more_xpvav +#define more_xpvhv S_more_xpvhv +#define more_xpvmg S_more_xpvmg +#define more_xpvlv S_more_xpvlv +#define more_xpvbm S_more_xpvbm #define more_xrv S_more_xrv #define new_xiv S_new_xiv #define new_xnv S_new_xnv #define new_xpv S_new_xpv +#define new_xpv S_new_xpv +#define new_xpviv S_new_xpviv +#define new_xpvnv S_new_xpvnv +#define new_xpvcv S_new_xpvcv +#define new_xpvav S_new_xpvav +#define new_xpvhv S_new_xpvhv +#define new_xpvmg S_new_xpvmg +#define new_xpvlv S_new_xpvlv +#define new_xpvbm S_new_xpvbm #define new_xrv S_new_xrv #define del_xiv S_del_xiv #define del_xnv S_del_xnv #define del_xpv S_del_xpv +#define del_xpviv S_del_xpviv +#define del_xpvnv S_del_xpvnv +#define del_xpvcv S_del_xpvcv +#define del_xpvav S_del_xpvav +#define del_xpvhv S_del_xpvhv +#define del_xpvmg S_del_xpvmg +#define del_xpvlv S_del_xpvlv +#define del_xpvbm S_del_xpvbm #define del_xrv S_del_xrv #define sv_unglob S_sv_unglob #define not_a_number S_not_a_number @@ -2264,14 +2289,39 @@ #define more_xiv() S_more_xiv(aTHX) #define more_xnv() S_more_xnv(aTHX) #define more_xpv() S_more_xpv(aTHX) +#define more_xpviv() S_more_xpviv(aTHX) +#define more_xpvnv() S_more_xpvnv(aTHX) +#define more_xpvcv() S_more_xpvcv(aTHX) +#define more_xpvav() S_more_xpvav(aTHX) +#define more_xpvhv() S_more_xpvhv(aTHX) +#define more_xpvmg() S_more_xpvmg(aTHX) +#define more_xpvlv() S_more_xpvlv(aTHX) +#define more_xpvbm() S_more_xpvbm(aTHX) #define more_xrv() S_more_xrv(aTHX) #define new_xiv() S_new_xiv(aTHX) #define new_xnv() S_new_xnv(aTHX) #define new_xpv() S_new_xpv(aTHX) +#define new_xpv() S_new_xpv(aTHX) +#define new_xpviv() S_new_xpviv(aTHX) +#define new_xpvnv() S_new_xpvnv(aTHX) +#define new_xpvcv() S_new_xpvcv(aTHX) +#define new_xpvav() S_new_xpvav(aTHX) +#define new_xpvhv() S_new_xpvhv(aTHX) +#define new_xpvmg() S_new_xpvmg(aTHX) +#define new_xpvlv() S_new_xpvlv(aTHX) +#define new_xpvbm() S_new_xpvbm(aTHX) #define new_xrv() S_new_xrv(aTHX) #define del_xiv(a) S_del_xiv(aTHX_ a) #define del_xnv(a) S_del_xnv(aTHX_ a) #define del_xpv(a) S_del_xpv(aTHX_ a) +#define del_xpviv(a) S_del_xpviv(aTHX_ a) +#define del_xpvnv(a) S_del_xpvnv(aTHX_ a) +#define del_xpvcv(a) S_del_xpvcv(aTHX_ a) +#define del_xpvav(a) S_del_xpvav(aTHX_ a) +#define del_xpvhv(a) S_del_xpvhv(aTHX_ a) +#define del_xpvmg(a) S_del_xpvmg(aTHX_ a) +#define del_xpvlv(a) S_del_xpvlv(aTHX_ a) +#define del_xpvbm(a) S_del_xpvbm(aTHX_ a) #define del_xrv(a) S_del_xrv(aTHX_ a) #define sv_unglob(a) S_sv_unglob(aTHX_ a) #define not_a_number(a) S_not_a_number(aTHX_ a) @@ -4427,6 +4477,22 @@ #define more_xnv S_more_xnv #define S_more_xpv CPerlObj::S_more_xpv #define more_xpv S_more_xpv +#define S_more_xpviv CPerlObj::S_more_xpviv +#define more_xpviv S_more_xpviv +#define S_more_xpvnv CPerlObj::S_more_xpvnv +#define more_xpvnv S_more_xpvnv +#define S_more_xpvcv CPerlObj::S_more_xpvcv +#define more_xpvcv S_more_xpvcv +#define S_more_xpvav CPerlObj::S_more_xpvav +#define more_xpvav S_more_xpvav +#define S_more_xpvhv CPerlObj::S_more_xpvhv +#define more_xpvhv S_more_xpvhv +#define S_more_xpvmg CPerlObj::S_more_xpvmg +#define more_xpvmg S_more_xpvmg +#define S_more_xpvlv CPerlObj::S_more_xpvlv +#define more_xpvlv S_more_xpvlv +#define S_more_xpvbm CPerlObj::S_more_xpvbm +#define more_xpvbm S_more_xpvbm #define S_more_xrv CPerlObj::S_more_xrv #define more_xrv S_more_xrv #define S_new_xiv CPerlObj::S_new_xiv @@ -4435,6 +4501,24 @@ #define new_xnv S_new_xnv #define S_new_xpv CPerlObj::S_new_xpv #define new_xpv S_new_xpv +#define S_new_xpv CPerlObj::S_new_xpv +#define new_xpv S_new_xpv +#define S_new_xpviv CPerlObj::S_new_xpviv +#define new_xpviv S_new_xpviv +#define S_new_xpvnv CPerlObj::S_new_xpvnv +#define new_xpvnv S_new_xpvnv +#define S_new_xpvcv CPerlObj::S_new_xpvcv +#define new_xpvcv S_new_xpvcv +#define S_new_xpvav CPerlObj::S_new_xpvav +#define new_xpvav S_new_xpvav +#define S_new_xpvhv CPerlObj::S_new_xpvhv +#define new_xpvhv S_new_xpvhv +#define S_new_xpvmg CPerlObj::S_new_xpvmg +#define new_xpvmg S_new_xpvmg +#define S_new_xpvlv CPerlObj::S_new_xpvlv +#define new_xpvlv S_new_xpvlv +#define S_new_xpvbm CPerlObj::S_new_xpvbm +#define new_xpvbm S_new_xpvbm #define S_new_xrv CPerlObj::S_new_xrv #define new_xrv S_new_xrv #define S_del_xiv CPerlObj::S_del_xiv @@ -4443,6 +4527,22 @@ #define del_xnv S_del_xnv #define S_del_xpv CPerlObj::S_del_xpv #define del_xpv S_del_xpv +#define S_del_xpviv CPerlObj::S_del_xpviv +#define del_xpviv S_del_xpviv +#define S_del_xpvnv CPerlObj::S_del_xpvnv +#define del_xpvnv S_del_xpvnv +#define S_del_xpvcv CPerlObj::S_del_xpvcv +#define del_xpvcv S_del_xpvcv +#define S_del_xpvav CPerlObj::S_del_xpvav +#define del_xpvav S_del_xpvav +#define S_del_xpvhv CPerlObj::S_del_xpvhv +#define del_xpvhv S_del_xpvhv +#define S_del_xpvmg CPerlObj::S_del_xpvmg +#define del_xpvmg S_del_xpvmg +#define S_del_xpvlv CPerlObj::S_del_xpvlv +#define del_xpvlv S_del_xpvlv +#define S_del_xpvbm CPerlObj::S_del_xpvbm +#define del_xpvbm S_del_xpvbm #define S_del_xrv CPerlObj::S_del_xrv #define del_xrv S_del_xrv #define S_sv_unglob CPerlObj::S_sv_unglob diff --git a/embed.pl b/embed.pl index 35a53cb..cea3fd2 100755 --- a/embed.pl +++ b/embed.pl @@ -1966,14 +1966,39 @@ s |SV* |more_sv s |void |more_xiv s |void |more_xnv s |void |more_xpv +s |void |more_xpviv +s |void |more_xpvnv +s |void |more_xpvcv +s |void |more_xpvav +s |void |more_xpvhv +s |void |more_xpvmg +s |void |more_xpvlv +s |void |more_xpvbm s |void |more_xrv s |XPVIV* |new_xiv s |XPVNV* |new_xnv s |XPV* |new_xpv +s |XPV* |new_xpv +s |XPVIV* |new_xpviv +s |XPVNV* |new_xpvnv +s |XPVCV* |new_xpvcv +s |XPVAV* |new_xpvav +s |XPVHV* |new_xpvhv +s |XPVMG* |new_xpvmg +s |XPVLV* |new_xpvlv +s |XPVBM* |new_xpvbm s |XRV* |new_xrv s |void |del_xiv |XPVIV* p s |void |del_xnv |XPVNV* p s |void |del_xpv |XPV* p +s |void |del_xpviv |XPVIV* p +s |void |del_xpvnv |XPVNV* p +s |void |del_xpvcv |XPVCV* p +s |void |del_xpvav |XPVAV* p +s |void |del_xpvhv |XPVHV* p +s |void |del_xpvmg |XPVMG* p +s |void |del_xpvlv |XPVLV* p +s |void |del_xpvbm |XPVBM* p s |void |del_xrv |XRV* p s |void |sv_unglob |SV* sv s |void |not_a_number |SV *sv diff --git a/embedvar.h b/embedvar.h index 5394d4d..fcaa0d4 100644 --- a/embedvar.h +++ b/embedvar.h @@ -429,6 +429,14 @@ #define PL_xiv_root (PERL_GET_INTERP->Ixiv_root) #define PL_xnv_root (PERL_GET_INTERP->Ixnv_root) #define PL_xpv_root (PERL_GET_INTERP->Ixpv_root) +#define PL_xpvav_root (PERL_GET_INTERP->Ixpvav_root) +#define PL_xpvbm_root (PERL_GET_INTERP->Ixpvbm_root) +#define PL_xpvcv_root (PERL_GET_INTERP->Ixpvcv_root) +#define PL_xpvhv_root (PERL_GET_INTERP->Ixpvhv_root) +#define PL_xpviv_root (PERL_GET_INTERP->Ixpviv_root) +#define PL_xpvlv_root (PERL_GET_INTERP->Ixpvlv_root) +#define PL_xpvmg_root (PERL_GET_INTERP->Ixpvmg_root) +#define PL_xpvnv_root (PERL_GET_INTERP->Ixpvnv_root) #define PL_xrv_root (PERL_GET_INTERP->Ixrv_root) #define PL_yychar (PERL_GET_INTERP->Iyychar) #define PL_yydebug (PERL_GET_INTERP->Iyydebug) @@ -698,6 +706,14 @@ #define PL_xiv_root (vTHX->Ixiv_root) #define PL_xnv_root (vTHX->Ixnv_root) #define PL_xpv_root (vTHX->Ixpv_root) +#define PL_xpvav_root (vTHX->Ixpvav_root) +#define PL_xpvbm_root (vTHX->Ixpvbm_root) +#define PL_xpvcv_root (vTHX->Ixpvcv_root) +#define PL_xpvhv_root (vTHX->Ixpvhv_root) +#define PL_xpviv_root (vTHX->Ixpviv_root) +#define PL_xpvlv_root (vTHX->Ixpvlv_root) +#define PL_xpvmg_root (vTHX->Ixpvmg_root) +#define PL_xpvnv_root (vTHX->Ixpvnv_root) #define PL_xrv_root (vTHX->Ixrv_root) #define PL_yychar (vTHX->Iyychar) #define PL_yydebug (vTHX->Iyydebug) @@ -969,6 +985,14 @@ #define PL_Ixiv_root PL_xiv_root #define PL_Ixnv_root PL_xnv_root #define PL_Ixpv_root PL_xpv_root +#define PL_Ixpvav_root PL_xpvav_root +#define PL_Ixpvbm_root PL_xpvbm_root +#define PL_Ixpvcv_root PL_xpvcv_root +#define PL_Ixpvhv_root PL_xpvhv_root +#define PL_Ixpviv_root PL_xpviv_root +#define PL_Ixpvlv_root PL_xpvlv_root +#define PL_Ixpvmg_root PL_xpvmg_root +#define PL_Ixpvnv_root PL_xpvnv_root #define PL_Ixrv_root PL_xrv_root #define PL_Iyychar PL_yychar #define PL_Iyydebug PL_yydebug diff --git a/ext/B/B/C.pm b/ext/B/B/C.pm index 3230ebd..b9e005b 100644 --- a/ext/B/B/C.pm +++ b/ext/B/B/C.pm @@ -375,7 +375,7 @@ sub B::NULL::save { #if ($$sv == 0) { # warn "NULL::save for sv = 0 called from @{[(caller(1))[3]]}\n"; #} - $svsect->add(sprintf("0, %u, 0x%x", $sv->REFCNT + 1, $sv->FLAGS)); + $svsect->add(sprintf("0, %u, 0x%x", $sv->REFCNT , $sv->FLAGS)); return savesym($sv, sprintf("&sv_list[%d]", $svsect->index)); } @@ -385,7 +385,7 @@ sub B::IV::save { return $sym if defined $sym; $xpvivsect->add(sprintf("0, 0, 0, %d", $sv->IVX)); $svsect->add(sprintf("&xpviv_list[%d], %lu, 0x%x", - $xpvivsect->index, $sv->REFCNT + 1, $sv->FLAGS)); + $xpvivsect->index, $sv->REFCNT , $sv->FLAGS)); return savesym($sv, sprintf("&sv_list[%d]", $svsect->index)); } @@ -397,7 +397,7 @@ sub B::NV::save { $val .= '.00' if $val =~ /^-?\d+$/; $xpvnvsect->add(sprintf("0, 0, 0, %d, %s", $sv->IVX, $val)); $svsect->add(sprintf("&xpvnv_list[%d], %lu, 0x%x", - $xpvnvsect->index, $sv->REFCNT + 1, $sv->FLAGS)); + $xpvnvsect->index, $sv->REFCNT , $sv->FLAGS)); return savesym($sv, sprintf("&sv_list[%d]", $svsect->index)); } @@ -413,7 +413,7 @@ sub B::PVLV::save { $pvsym, $len, $pvmax, $sv->IVX, $sv->NVX, $sv->TARGOFF, $sv->TARGLEN, cchar($sv->TYPE))); $svsect->add(sprintf("&xpvlv_list[%d], %lu, 0x%x", - $xpvlvsect->index, $sv->REFCNT + 1, $sv->FLAGS)); + $xpvlvsect->index, $sv->REFCNT , $sv->FLAGS)); if (!$pv_copy_on_grow) { $init->add(sprintf("xpvlv_list[%d].xpv_pv = savepvn(%s, %u);", $xpvlvsect->index, cstring($pv), $len)); @@ -431,7 +431,7 @@ sub B::PVIV::save { my ($pvsym, $pvmax) = savepv($pv); $xpvivsect->add(sprintf("%s, %u, %u, %d", $pvsym, $len, $pvmax, $sv->IVX)); $svsect->add(sprintf("&xpviv_list[%d], %u, 0x%x", - $xpvivsect->index, $sv->REFCNT + 1, $sv->FLAGS)); + $xpvivsect->index, $sv->REFCNT , $sv->FLAGS)); if (!$pv_copy_on_grow) { $init->add(sprintf("xpviv_list[%d].xpv_pv = savepvn(%s, %u);", $xpvivsect->index, cstring($pv), $len)); @@ -452,7 +452,7 @@ sub B::PVNV::save { $xpvnvsect->add(sprintf("%s, %u, %u, %d, %s", $pvsym, $len, $pvmax, $sv->IVX, $val)); $svsect->add(sprintf("&xpvnv_list[%d], %lu, 0x%x", - $xpvnvsect->index, $sv->REFCNT + 1, $sv->FLAGS)); + $xpvnvsect->index, $sv->REFCNT , $sv->FLAGS)); if (!$pv_copy_on_grow) { $init->add(sprintf("xpvnv_list[%d].xpv_pv = savepvn(%s,%u);", $xpvnvsect->index, cstring($pv), $len)); @@ -470,7 +470,7 @@ sub B::BM::save { $len, $len + 258, $sv->IVX, $sv->NVX, $sv->USEFUL, $sv->PREVIOUS, $sv->RARE)); $svsect->add(sprintf("&xpvbm_list[%d], %lu, 0x%x", - $xpvbmsect->index, $sv->REFCNT + 1, $sv->FLAGS)); + $xpvbmsect->index, $sv->REFCNT , $sv->FLAGS)); $sv->save_magic; $init->add(sprintf("xpvbm_list[%d].xpv_pv = savepvn(%s, %u);", $xpvbmsect->index, cstring($pv), $len), @@ -488,7 +488,7 @@ sub B::PV::save { my ($pvsym, $pvmax) = savepv($pv); $xpvsect->add(sprintf("%s, %u, %u", $pvsym, $len, $pvmax)); $svsect->add(sprintf("&xpv_list[%d], %lu, 0x%x", - $xpvsect->index, $sv->REFCNT + 1, $sv->FLAGS)); + $xpvsect->index, $sv->REFCNT , $sv->FLAGS)); if (!$pv_copy_on_grow) { $init->add(sprintf("xpv_list[%d].xpv_pv = savepvn(%s, %u);", $xpvsect->index, cstring($pv), $len)); @@ -506,7 +506,7 @@ sub B::PVMG::save { $xpvmgsect->add(sprintf("%s, %u, %u, %d, %s, 0, 0", $pvsym, $len, $pvmax, $sv->IVX, $sv->NVX)); $svsect->add(sprintf("&xpvmg_list[%d], %lu, 0x%x", - $xpvmgsect->index, $sv->REFCNT + 1, $sv->FLAGS)); + $xpvmgsect->index, $sv->REFCNT , $sv->FLAGS)); if (!$pv_copy_on_grow) { $init->add(sprintf("xpvmg_list[%d].xpv_pv = savepvn(%s, %u);", $xpvmgsect->index, cstring($pv), $len)); @@ -560,7 +560,7 @@ sub B::RV::save { $rv =~ s/^\([AGHS]V\s*\*\)\s*(\&sv_list.*)$/$1/; $xrvsect->add($rv); $svsect->add(sprintf("&xrv_list[%d], %lu, 0x%x", - $xrvsect->index, $sv->REFCNT + 1, $sv->FLAGS)); + $xrvsect->index, $sv->REFCNT , $sv->FLAGS)); return savesym($sv, sprintf("&sv_list[%d]", $svsect->index)); } @@ -712,7 +712,7 @@ sub B::CV::save { $$stash, $$cv) if $debug_cv; } $symsect->add(sprintf("svix%d\t(XPVCV*)&xpvcv_list[%u], %lu, 0x%x", - $sv_ix, $xpvcv_ix, $cv->REFCNT + 1, $cv->FLAGS)); + $sv_ix, $xpvcv_ix, $cv->REFCNT +1 , $cv->FLAGS)); return $sym; } @@ -819,7 +819,7 @@ sub B::AV::save { $xpvavsect->add(sprintf("0, -1, -1, 0, 0.0, 0, Nullhv, 0, 0, 0x%x", $avflags)); $svsect->add(sprintf("&xpvav_list[%d], %lu, 0x%x", - $xpvavsect->index, $av->REFCNT + 1, $av->FLAGS)); + $xpvavsect->index, $av->REFCNT , $av->FLAGS)); my $sv_list_index = $svsect->index; my $fill = $av->FILL; $av->save_magic; @@ -885,7 +885,7 @@ sub B::HV::save { $xpvhvsect->add(sprintf("0, 0, %d, 0, 0.0, 0, Nullhv, %d, 0, 0, 0", $hv->MAX, $hv->RITER)); $svsect->add(sprintf("&xpvhv_list[%d], %lu, 0x%x", - $xpvhvsect->index, $hv->REFCNT + 1, $hv->FLAGS)); + $xpvhvsect->index, $hv->REFCNT , $hv->FLAGS)); my $sv_list_index = $svsect->index; my @contents = $hv->ARRAY; if (@contents) { @@ -921,7 +921,7 @@ sub B::IO::save { cstring($io->BOTTOM_NAME), $io->SUBPROCESS, cchar($io->IoTYPE), $io->IoFLAGS)); $svsect->add(sprintf("&xpvio_list[%d], %lu, 0x%x", - $xpviosect->index, $io->REFCNT + 1, $io->FLAGS)); + $xpviosect->index, $io->REFCNT , $io->FLAGS)); $sym = savesym($io, sprintf("(IO*)&sv_list[%d]", $svsect->index)); my ($field, $fsym); foreach $field (qw(TOP_GV FMT_GV BOTTOM_GV)) { diff --git a/intrpvar.h b/intrpvar.h index 669e6f9..e5b2691 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -222,6 +222,14 @@ PERLVAR(Ixiv_root, IV *) /* free xiv list--shared by interpreters */ PERLVAR(Ixnv_root, NV *) /* free xnv list--shared by interpreters */ PERLVAR(Ixrv_root, XRV *) /* free xrv list--shared by interpreters */ PERLVAR(Ixpv_root, XPV *) /* free xpv list--shared by interpreters */ +PERLVAR(Ixpviv_root, XPVIV *) /* free xpviv list--shared by interpreters */ +PERLVAR(Ixpvnv_root, XPVNV *) /* free xpvnv list--shared by interpreters */ +PERLVAR(Ixpvcv_root, XPVCV *) /* free xpvcv list--shared by interpreters */ +PERLVAR(Ixpvav_root, XPVAV *) /* free xpvav list--shared by interpreters */ +PERLVAR(Ixpvhv_root, XPVHV *) /* free xpvhv list--shared by interpreters */ +PERLVAR(Ixpvmg_root, XPVMG *) /* free xpvmg list--shared by interpreters */ +PERLVAR(Ixpvlv_root, XPVLV *) /* free xpvlv list--shared by interpreters */ +PERLVAR(Ixpvbm_root, XPVBM *) /* free xpvbm list--shared by interpreters */ PERLVAR(Ihe_root, HE *) /* free he list--shared by interpreters */ PERLVAR(Inice_chunk, char *) /* a nice chunk of memory to reuse */ PERLVAR(Inice_chunk_size, U32) /* how nice the chunk of memory is */ diff --git a/objXSUB.h b/objXSUB.h index 6614162..7a8e0aa 100644 --- a/objXSUB.h +++ b/objXSUB.h @@ -524,6 +524,22 @@ #define PL_xnv_root (*Perl_Ixnv_root_ptr(aTHXo)) #undef PL_xpv_root #define PL_xpv_root (*Perl_Ixpv_root_ptr(aTHXo)) +#undef PL_xpvav_root +#define PL_xpvav_root (*Perl_Ixpvav_root_ptr(aTHXo)) +#undef PL_xpvbm_root +#define PL_xpvbm_root (*Perl_Ixpvbm_root_ptr(aTHXo)) +#undef PL_xpvcv_root +#define PL_xpvcv_root (*Perl_Ixpvcv_root_ptr(aTHXo)) +#undef PL_xpvhv_root +#define PL_xpvhv_root (*Perl_Ixpvhv_root_ptr(aTHXo)) +#undef PL_xpviv_root +#define PL_xpviv_root (*Perl_Ixpviv_root_ptr(aTHXo)) +#undef PL_xpvlv_root +#define PL_xpvlv_root (*Perl_Ixpvlv_root_ptr(aTHXo)) +#undef PL_xpvmg_root +#define PL_xpvmg_root (*Perl_Ixpvmg_root_ptr(aTHXo)) +#undef PL_xpvnv_root +#define PL_xpvnv_root (*Perl_Ixpvnv_root_ptr(aTHXo)) #undef PL_xrv_root #define PL_xrv_root (*Perl_Ixrv_root_ptr(aTHXo)) #undef PL_yychar diff --git a/proto.h b/proto.h index 74958d3..e4fe09c 100644 --- a/proto.h +++ b/proto.h @@ -913,14 +913,39 @@ STATIC SV* S_more_sv(pTHX); STATIC void S_more_xiv(pTHX); STATIC void S_more_xnv(pTHX); STATIC void S_more_xpv(pTHX); +STATIC void S_more_xpviv(pTHX); +STATIC void S_more_xpvnv(pTHX); +STATIC void S_more_xpvcv(pTHX); +STATIC void S_more_xpvav(pTHX); +STATIC void S_more_xpvhv(pTHX); +STATIC void S_more_xpvmg(pTHX); +STATIC void S_more_xpvlv(pTHX); +STATIC void S_more_xpvbm(pTHX); STATIC void S_more_xrv(pTHX); STATIC XPVIV* S_new_xiv(pTHX); STATIC XPVNV* S_new_xnv(pTHX); STATIC XPV* S_new_xpv(pTHX); +STATIC XPV* S_new_xpv(pTHX); +STATIC XPVIV* S_new_xpviv(pTHX); +STATIC XPVNV* S_new_xpvnv(pTHX); +STATIC XPVCV* S_new_xpvcv(pTHX); +STATIC XPVAV* S_new_xpvav(pTHX); +STATIC XPVHV* S_new_xpvhv(pTHX); +STATIC XPVMG* S_new_xpvmg(pTHX); +STATIC XPVLV* S_new_xpvlv(pTHX); +STATIC XPVBM* S_new_xpvbm(pTHX); STATIC XRV* S_new_xrv(pTHX); STATIC void S_del_xiv(pTHX_ XPVIV* p); STATIC void S_del_xnv(pTHX_ XPVNV* p); STATIC void S_del_xpv(pTHX_ XPV* p); +STATIC void S_del_xpviv(pTHX_ XPVIV* p); +STATIC void S_del_xpvnv(pTHX_ XPVNV* p); +STATIC void S_del_xpvcv(pTHX_ XPVCV* p); +STATIC void S_del_xpvav(pTHX_ XPVAV* p); +STATIC void S_del_xpvhv(pTHX_ XPVHV* p); +STATIC void S_del_xpvmg(pTHX_ XPVMG* p); +STATIC void S_del_xpvlv(pTHX_ XPVLV* p); +STATIC void S_del_xpvbm(pTHX_ XPVBM* p); STATIC void S_del_xrv(pTHX_ XRV* p); STATIC void S_sv_unglob(pTHX_ SV* sv); STATIC void S_not_a_number(pTHX_ SV *sv); diff --git a/sv.c b/sv.c index 6327ef0..ba5833f 100644 --- a/sv.c +++ b/sv.c @@ -475,6 +475,321 @@ S_more_xpv(pTHX) xpv->xpv_pv = 0; } +STATIC XPVIV* +S_new_xpviv(pTHX) +{ + XPVIV* xpviv; + LOCK_SV_MUTEX; + if (!PL_xpviv_root) + more_xpviv(); + xpviv = PL_xpviv_root; + PL_xpviv_root = (XPVIV*)xpviv->xpv_pv; + UNLOCK_SV_MUTEX; + return xpviv; +} + +STATIC void +S_del_xpviv(pTHX_ XPVIV *p) +{ + LOCK_SV_MUTEX; + p->xpv_pv = (char*)PL_xpviv_root; + PL_xpviv_root = p; + UNLOCK_SV_MUTEX; +} + + +STATIC void +S_more_xpviv(pTHX) +{ + register XPVIV* xpviv; + register XPVIV* xpvivend; + New(714, PL_xpviv_root, 1008/sizeof(XPVIV), XPVIV); + xpviv = PL_xpviv_root; + xpvivend = &xpviv[1008 / sizeof(XPVIV) - 1]; + while (xpviv < xpvivend) { + xpviv->xpv_pv = (char*)(xpviv + 1); + xpviv++; + } + xpviv->xpv_pv = 0; +} + + +STATIC XPVNV* +S_new_xpvnv(pTHX) +{ + XPVNV* xpvnv; + LOCK_SV_MUTEX; + if (!PL_xpvnv_root) + more_xpvnv(); + xpvnv = PL_xpvnv_root; + PL_xpvnv_root = (XPVNV*)xpvnv->xpv_pv; + UNLOCK_SV_MUTEX; + return xpvnv; +} + +STATIC void +S_del_xpvnv(pTHX_ XPVNV *p) +{ + LOCK_SV_MUTEX; + p->xpv_pv = (char*)PL_xpvnv_root; + PL_xpvnv_root = p; + UNLOCK_SV_MUTEX; +} + + +STATIC void +S_more_xpvnv(pTHX) +{ + register XPVNV* xpvnv; + register XPVNV* xpvnvend; + New(715, PL_xpvnv_root, 1008/sizeof(XPVNV), XPVNV); + xpvnv = PL_xpvnv_root; + xpvnvend = &xpvnv[1008 / sizeof(XPVNV) - 1]; + while (xpvnv < xpvnvend) { + xpvnv->xpv_pv = (char*)(xpvnv + 1); + xpvnv++; + } + xpvnv->xpv_pv = 0; +} + + + +STATIC XPVCV* +S_new_xpvcv(pTHX) +{ + XPVCV* xpvcv; + LOCK_SV_MUTEX; + if (!PL_xpvcv_root) + more_xpvcv(); + xpvcv = PL_xpvcv_root; + PL_xpvcv_root = (XPVCV*)xpvcv->xpv_pv; + UNLOCK_SV_MUTEX; + return xpvcv; +} + +STATIC void +S_del_xpvcv(pTHX_ XPVCV *p) +{ + LOCK_SV_MUTEX; + p->xpv_pv = (char*)PL_xpvcv_root; + PL_xpvcv_root = p; + UNLOCK_SV_MUTEX; +} + + +STATIC void +S_more_xpvcv(pTHX) +{ + register XPVCV* xpvcv; + register XPVCV* xpvcvend; + New(716, PL_xpvcv_root, 1008/sizeof(XPVCV), XPVCV); + xpvcv = PL_xpvcv_root; + xpvcvend = &xpvcv[1008 / sizeof(XPVCV) - 1]; + while (xpvcv < xpvcvend) { + xpvcv->xpv_pv = (char*)(xpvcv + 1); + xpvcv++; + } + xpvcv->xpv_pv = 0; +} + + + +STATIC XPVAV* +S_new_xpvav(pTHX) +{ + XPVAV* xpvav; + LOCK_SV_MUTEX; + if (!PL_xpvav_root) + more_xpvav(); + xpvav = PL_xpvav_root; + PL_xpvav_root = (XPVAV*)xpvav->xav_array; + UNLOCK_SV_MUTEX; + return xpvav; +} + +STATIC void +S_del_xpvav(pTHX_ XPVAV *p) +{ + LOCK_SV_MUTEX; + p->xav_array = (char*)PL_xpvav_root; + PL_xpvav_root = p; + UNLOCK_SV_MUTEX; +} + + +STATIC void +S_more_xpvav(pTHX) +{ + register XPVAV* xpvav; + register XPVAV* xpvavend; + New(717, PL_xpvav_root, 1008/sizeof(XPVAV), XPVAV); + xpvav = PL_xpvav_root; + xpvavend = &xpvav[1008 / sizeof(XPVAV) - 1]; + while (xpvav < xpvavend) { + xpvav->xav_array = (char*)(xpvav + 1); + xpvav++; + } + xpvav->xav_array = 0; +} + + + +STATIC XPVHV* +S_new_xpvhv(pTHX) +{ + XPVHV* xpvhv; + LOCK_SV_MUTEX; + if (!PL_xpvhv_root) + more_xpvhv(); + xpvhv = PL_xpvhv_root; + PL_xpvhv_root = (XPVHV*)xpvhv->xhv_array; + UNLOCK_SV_MUTEX; + return xpvhv; +} + +STATIC void +S_del_xpvhv(pTHX_ XPVHV *p) +{ + LOCK_SV_MUTEX; + p->xhv_array = (char*)PL_xpvhv_root; + PL_xpvhv_root = p; + UNLOCK_SV_MUTEX; +} + + +STATIC void +S_more_xpvhv(pTHX) +{ + register XPVHV* xpvhv; + register XPVHV* xpvhvend; + New(718, PL_xpvhv_root, 1008/sizeof(XPVHV), XPVHV); + xpvhv = PL_xpvhv_root; + xpvhvend = &xpvhv[1008 / sizeof(XPVHV) - 1]; + while (xpvhv < xpvhvend) { + xpvhv->xhv_array = (char*)(xpvhv + 1); + xpvhv++; + } + xpvhv->xhv_array = 0; +} + + +STATIC XPVMG* +S_new_xpvmg(pTHX) +{ + XPVMG* xpvmg; + LOCK_SV_MUTEX; + if (!PL_xpvmg_root) + more_xpvmg(); + xpvmg = PL_xpvmg_root; + PL_xpvmg_root = (XPVMG*)xpvmg->xpv_pv; + UNLOCK_SV_MUTEX; + return xpvmg; +} + +STATIC void +S_del_xpvmg(pTHX_ XPVMG *p) +{ + LOCK_SV_MUTEX; + p->xpv_pv = (char*)PL_xpvmg_root; + PL_xpvmg_root = p; + UNLOCK_SV_MUTEX; +} + + +STATIC void +S_more_xpvmg(pTHX) +{ + register XPVMG* xpvmg; + register XPVMG* xpvmgend; + New(719, PL_xpvmg_root, 1008/sizeof(XPVMG), XPVMG); + xpvmg = PL_xpvmg_root; + xpvmgend = &xpvmg[1008 / sizeof(XPVMG) - 1]; + while (xpvmg < xpvmgend) { + xpvmg->xpv_pv = (char*)(xpvmg + 1); + xpvmg++; + } + xpvmg->xpv_pv = 0; +} + + + +STATIC XPVLV* +S_new_xpvlv(pTHX) +{ + XPVLV* xpvlv; + LOCK_SV_MUTEX; + if (!PL_xpvlv_root) + more_xpvlv(); + xpvlv = PL_xpvlv_root; + PL_xpvlv_root = (XPVLV*)xpvlv->xpv_pv; + UNLOCK_SV_MUTEX; + return xpvlv; +} + +STATIC void +S_del_xpvlv(pTHX_ XPVLV *p) +{ + LOCK_SV_MUTEX; + p->xpv_pv = (char*)PL_xpvlv_root; + PL_xpvlv_root = p; + UNLOCK_SV_MUTEX; +} + + +STATIC void +S_more_xpvlv(pTHX) +{ + register XPVLV* xpvlv; + register XPVLV* xpvlvend; + New(720, PL_xpvlv_root, 1008/sizeof(XPVLV), XPVLV); + xpvlv = PL_xpvlv_root; + xpvlvend = &xpvlv[1008 / sizeof(XPVLV) - 1]; + while (xpvlv < xpvlvend) { + xpvlv->xpv_pv = (char*)(xpvlv + 1); + xpvlv++; + } + xpvlv->xpv_pv = 0; +} + + +STATIC XPVBM* +S_new_xpvbm(pTHX) +{ + XPVBM* xpvbm; + LOCK_SV_MUTEX; + if (!PL_xpvbm_root) + more_xpvbm(); + xpvbm = PL_xpvbm_root; + PL_xpvbm_root = (XPVBM*)xpvbm->xpv_pv; + UNLOCK_SV_MUTEX; + return xpvbm; +} + +STATIC void +S_del_xpvbm(pTHX_ XPVBM *p) +{ + LOCK_SV_MUTEX; + p->xpv_pv = (char*)PL_xpvbm_root; + PL_xpvbm_root = p; + UNLOCK_SV_MUTEX; +} + + +STATIC void +S_more_xpvbm(pTHX) +{ + register XPVBM* xpvbm; + register XPVBM* xpvbmend; + New(721, PL_xpvbm_root, 1008/sizeof(XPVBM), XPVBM); + xpvbm = PL_xpvbm_root; + xpvbmend = &xpvbm[1008 / sizeof(XPVBM) - 1]; + while (xpvbm < xpvbmend) { + xpvbm->xpv_pv = (char*)(xpvbm + 1); + xpvbm++; + } + xpvbm->xpv_pv = 0; +} + #ifdef PURIFY #define new_XIV() (void*)safemalloc(sizeof(XPVIV)) #define del_XIV(p) Safefree((char*)p) @@ -521,32 +836,73 @@ S_my_safemalloc(MEM_SIZE size) # define my_safefree(s) Safefree(s) #endif -#define new_XPVIV() (void*)my_safemalloc(sizeof(XPVIV)) -#define del_XPVIV(p) my_safefree((char*)p) - -#define new_XPVNV() (void*)my_safemalloc(sizeof(XPVNV)) -#define del_XPVNV(p) my_safefree((char*)p) - -#define new_XPVMG() (void*)my_safemalloc(sizeof(XPVMG)) -#define del_XPVMG(p) my_safefree((char*)p) - -#define new_XPVLV() (void*)my_safemalloc(sizeof(XPVLV)) -#define del_XPVLV(p) my_safefree((char*)p) +#ifdef PURIFY +#define new_XPVIV() (void*)safemalloc(sizeof(XPVIV)) +#define del_XPVIV(p) Safefree((char*)p) +#else +#define new_XPVIV() (void*)new_xpviv() +#define del_XPVIV(p) del_xpviv((XPVIV *)p) +#endif -#define new_XPVAV() (void*)my_safemalloc(sizeof(XPVAV)) -#define del_XPVAV(p) my_safefree((char*)p) +#ifdef PURIFY +#define new_XPVNV() (void*)safemalloc(sizeof(XPVNV)) +#define del_XPVNV(p) Safefree((char*)p) +#else +#define new_XPVNV() (void*)new_xpvnv() +#define del_XPVNV(p) del_xpvnv((XPVNV *)p) +#endif + + +#ifdef PURIFY +#define new_XPVCV() (void*)safemalloc(sizeof(XPVCV)) +#define del_XPVCV(p) Safefree((char*)p) +#else +#define new_XPVCV() (void*)new_xpvcv() +#define del_XPVCV(p) del_xpvcv((XPVCV *)p) +#endif + +#ifdef PURIFY +#define new_XPVAV() (void*)safemalloc(sizeof(XPVAV)) +#define del_XPVAV(p) Safefree((char*)p) +#else +#define new_XPVAV() (void*)new_xpvav() +#define del_XPVAV(p) del_xpvav((XPVAV *)p) +#endif + +#ifdef PURIFY +#define new_XPVHV() (void*)safemalloc(sizeof(XPVHV)) +#define del_XPVHV(p) Safefree((char*)p) +#else +#define new_XPVHV() (void*)new_xpvhv() +#define del_XPVHV(p) del_xpvhv((XPVHV *)p) +#endif -#define new_XPVHV() (void*)my_safemalloc(sizeof(XPVHV)) -#define del_XPVHV(p) my_safefree((char*)p) +#ifdef PURIFY +#define new_XPVMG() (void*)safemalloc(sizeof(XPVMG)) +#define del_XPVMG(p) Safefree((char*)p) +#else +#define new_XPVMG() (void*)new_xpvmg() +#define del_XPVMG(p) del_xpvmg((XPVMG *)p) +#endif -#define new_XPVCV() (void*)my_safemalloc(sizeof(XPVCV)) -#define del_XPVCV(p) my_safefree((char*)p) +#ifdef PURIFY +#define new_XPVLV() (void*)safemalloc(sizeof(XPVLV)) +#define del_XPVLV(p) Safefree((char*)p) +#else +#define new_XPVLV() (void*)new_xpvlv() +#define del_XPVLV(p) del_xpvlv((XPVLV *)p) +#endif #define new_XPVGV() (void*)my_safemalloc(sizeof(XPVGV)) #define del_XPVGV(p) my_safefree((char*)p) -#define new_XPVBM() (void*)my_safemalloc(sizeof(XPVBM)) -#define del_XPVBM(p) my_safefree((char*)p) +#ifdef PURIFY +#define new_XPVBM() (void*)safemalloc(sizeof(XPVBM)) +#define del_XPVBM(p) Safefree((char*)p) +#else +#define new_XPVBM() (void*)new_xpvbm() +#define del_XPVBM(p) del_xpvbm((XPVBM *)p) +#endif #define new_XPVFM() (void*)my_safemalloc(sizeof(XPVFM)) #define del_XPVFM(p) my_safefree((char*)p)