minor optimization (avoid double sv_upgrade() for "our Foo $bar;")
Gurusamy Sarathy [Fri, 14 Jan 2000 04:40:49 +0000 (04:40 +0000)]
p4raw-id: //depot/perl@4803

op.c

diff --git a/op.c b/op.c
index b07a1fb..4baf03b 100644 (file)
--- 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);