In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/d7a08570f1b66c1947fbca76061dfa2f85d0ade0?hp=f615be485d8c90f01432a39e678e01c615e2c15e>
- Log ----------------------------------------------------------------- commit d7a08570f1b66c1947fbca76061dfa2f85d0ade0 Author: Steffen Mueller <[email protected]> Date: Thu Feb 28 18:25:19 2013 +0100 PL_sv_objcount deprecation notice M pod/perldelta.pod commit ddf23d4a1ae98daa8608179f83aad311d03898ef Author: Steffen Mueller <[email protected]> Date: Thu Feb 28 18:23:32 2013 +0100 Prepare PL_sv_objcount removal This used to keep track of all objects. At least by now, that is for no particularly good reason. Just because it could avoid a bit of work during global destruction if no objects remained. Let's do less work at run-time instead. The interpreter global will remain for one deprecation cycle. M intrpvar.h M perl.c M sv.c ----------------------------------------------------------------------- Summary of changes: intrpvar.h | 4 +++- perl.c | 15 ++++++--------- pod/perldelta.pod | 6 ++++++ sv.c | 10 ---------- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/intrpvar.h b/intrpvar.h index 92d8e92..6865ab9 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -383,7 +383,9 @@ PERLVAR(I, forkprocess, int) /* so do_open |- can return proc# */ /* memory management */ PERLVAR(I, sv_count, IV) /* how many SV* are currently allocated */ -PERLVAR(I, sv_objcount, IV) /* how many objects are currently allocated */ +PERLVAR(I, sv_objcount, IV) /* DEPRECATED AND UNMAINTAINED. + * Will be removed in Perl 5.20. + * Used to be: how many objects are currently allocated. */ PERLVAR(I, sv_root, SV *) /* storage for SVs belonging to interp */ PERLVAR(I, sv_arenaroot, SV *) /* list of areas for garbage collection */ diff --git a/perl.c b/perl.c index a27962d..e9549d5 100644 --- a/perl.c +++ b/perl.c @@ -758,15 +758,12 @@ perl_destruct(pTHXx) PerlIO_destruct(aTHX); - if (PL_sv_objcount) { - /* - * Try to destruct global references. We do this first so that the - * destructors and destructees still exist. Some sv's might remain. - * Non-referenced objects are on their own. - */ - sv_clean_objs(); - PL_sv_objcount = 0; - } + /* + * Try to destruct global references. We do this first so that the + * destructors and destructees still exist. Some sv's might remain. + * Non-referenced objects are on their own. + */ + sv_clean_objs(); /* unhook hooks which will soon be, or use, destroyed data */ SvREFCNT_dec(PL_warnhook); diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 17db8f7..c692139 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -53,6 +53,12 @@ an updated module in the L</Modules and Pragmata> section. [ List each deprecation as a =head2 entry ] +=head2 PL_sv_objcount + +This interpreter-global variable used to track the total number of +Perl objects in the interpreter. It is no longer maintained and will +be removed altogether in Perl 5.20. + =head1 Performance Enhancements XXX Changes which enhance performance without changing behaviour go here. diff --git a/sv.c b/sv.c index 09b180f..f58389b 100644 --- a/sv.c +++ b/sv.c @@ -6513,8 +6513,6 @@ S_curse(pTHX_ SV * const sv, const bool check_refcnt) { SvOBJECT_off(sv); /* Curse the object. */ SvSTASH_set(sv,0); /* SvREFCNT_dec may try to read this */ SvREFCNT_dec(stash); /* possibly of changed persuasion */ - if (SvTYPE(sv) != SVt_PVIO) - --PL_sv_objcount;/* XXX Might want something more general */ } return TRUE; } @@ -9694,14 +9692,10 @@ Perl_sv_bless(pTHX_ SV *const sv, HV *const stash) if (SvREADONLY(tmpRef) && !SvIsCOW(tmpRef)) Perl_croak_no_modify(); if (SvOBJECT(tmpRef)) { - if (SvTYPE(tmpRef) != SVt_PVIO) - --PL_sv_objcount; SvREFCNT_dec(SvSTASH(tmpRef)); } } SvOBJECT_on(tmpRef); - if (SvTYPE(tmpRef) != SVt_PVIO) - ++PL_sv_objcount; SvUPGRADE(tmpRef, SVt_PVMG); SvSTASH_set(tmpRef, MUTABLE_HV(SvREFCNT_inc_simple(stash))); @@ -12437,9 +12431,6 @@ S_sv_dup_common(pTHX_ const SV *const sstr, CLONE_PARAMS *const param) } } - if (SvOBJECT(dstr) && SvTYPE(dstr) != SVt_PVIO) - ++PL_sv_objcount; - return dstr; } @@ -13136,7 +13127,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, Zero(&PL_body_roots, 1, PL_body_roots); PL_sv_count = 0; - PL_sv_objcount = 0; PL_sv_root = NULL; PL_sv_arenaroot = NULL; -- Perl5 Master Repository
