From: Gurusamy Sarathy Date: Fri, 14 Jan 2000 04:40:49 +0000 (+0000) Subject: minor optimization (avoid double sv_upgrade() for "our Foo $bar;") X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5faabd7d610b4ff8e7c072611a59259096c14bad;p=p5sagit%2Fp5-mst-13.2.git minor optimization (avoid double sv_upgrade() for "our Foo $bar;") p4raw-id: //depot/perl@4803 --- diff --git a/op.c b/op.c index b07a1fb..4baf03b 100644 --- a/op.c +++ b/op.c @@ -257,17 +257,17 @@ S_pad_findlex(pTHX_ char *name, PADOFFSET newoff, U32 seq, CV* startcv, SvNVX(namesv) = (NV)PL_curcop->cop_seq; SvIVX(namesv) = PAD_MAX; /* A ref, intro immediately */ SvFAKE_on(namesv); /* A ref, not a real var */ + if (SvFLAGS(sv) & SVpad_OUR) { /* An "our" variable */ + SvFLAGS(namesv) |= SVpad_OUR; + (void)SvUPGRADE(namesv, SVt_PVGV); + GvSTASH(namesv) = (HV*)SvREFCNT_inc((SV*)GvSTASH(sv)); + } if (SvOBJECT(sv)) { /* A typed var */ SvOBJECT_on(namesv); (void)SvUPGRADE(namesv, SVt_PVMG); SvSTASH(namesv) = (HV*)SvREFCNT_inc((SV*)SvSTASH(sv)); PL_sv_objcount++; } - if (SvFLAGS(sv) & SVpad_OUR) { /* An "our" variable */ - SvFLAGS(namesv) |= SVpad_OUR; - (void)SvUPGRADE(namesv, SVt_PVGV); - GvSTASH(namesv) = (HV*)SvREFCNT_inc((SV*)GvSTASH(sv)); - } if (CvANON(PL_compcv) || SvTYPE(PL_compcv) == SVt_PVFM) { /* "It's closures all the way down." */ CvCLONE_on(PL_compcv);