S_del_body is sufficiently small that inlining it is a space win.
[p5sagit/p5-mst-13.2.git] / op.c
diff --git a/op.c b/op.c
index f165c25..814b07d 100644 (file)
--- a/op.c
+++ b/op.c
@@ -1595,14 +1595,7 @@ S_apply_attrs_my(pTHX_ HV *stash, OP *target, OP *attrs, OP **imopsp)
                                    dup_attrlist(attrs)));
 
     /* Fake up a method call to import */
-    meth = newSVpvn("import", 6);
-    SvUPGRADE(meth, SVt_PVIV);
-    (void)SvIOK_on(meth);
-    {
-       U32 hash;
-       PERL_HASH(hash, SvPVX_const(meth), SvCUR(meth));
-       SvUV_set(meth, hash);
-    }
+    meth = newSVpvn_share("import", 6, 0);
     imop = convert(OP_ENTERSUB, OPf_STACKED|OPf_SPECIAL|OPf_WANT_VOID,
                   append_elem(OP_LIST,
                               prepend_elem(OP_LIST, pack, list(arg)),
@@ -3050,14 +3043,7 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg)
            pack = newSVOP(OP_CONST, 0, newSVsv(((SVOP*)idop)->op_sv));
 
            /* Fake up a method call to VERSION */
-           meth = newSVpvn("VERSION",7);
-           sv_upgrade(meth, SVt_PVIV);
-           (void)SvIOK_on(meth);
-           {
-               U32 hash;
-               PERL_HASH(hash, SvPVX_const(meth), SvCUR(meth));
-               SvUV_set(meth, hash);
-           }
+           meth = newSVpvn_share("VERSION", 7, 0);
            veop = convert(OP_ENTERSUB, OPf_STACKED|OPf_SPECIAL,
                            append_elem(OP_LIST,
                                        prepend_elem(OP_LIST, pack, list(version)),
@@ -3078,14 +3064,8 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg)
        pack = newSVOP(OP_CONST, 0, newSVsv(((SVOP*)idop)->op_sv));
 
        /* Fake up a method call to import/unimport */
-       meth = aver ? newSVpvn("import",6) : newSVpvn("unimport", 8);
-       SvUPGRADE(meth, SVt_PVIV);
-       (void)SvIOK_on(meth);
-       {
-           U32 hash;
-           PERL_HASH(hash, SvPVX_const(meth), SvCUR(meth));
-           SvUV_set(meth, hash);
-       }
+       meth = aver
+           ? newSVpvn_share("import",6, 0) : newSVpvn_share("unimport", 8, 0);
        imop = convert(OP_ENTERSUB, OPf_STACKED|OPf_SPECIAL,
                       append_elem(OP_LIST,
                                   prepend_elem(OP_LIST, pack, list(arg)),
@@ -3094,7 +3074,7 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg)
 
     /* Fake up the BEGIN {}, which does its thing immediately. */
     newATTRSUB(floor,
-       newSVOP(OP_CONST, 0, newSVpvn("BEGIN", 5)),
+       newSVOP(OP_CONST, 0, newSVpvn_share("BEGIN", 5, 0)),
        Nullop,
        Nullop,
        append_elem(OP_LINESEQ,
@@ -4252,6 +4232,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
     STRLEN ps_len;
     register CV *cv=0;
     SV *const_sv;
+    I32 gv_fetch_flags;
 
     const char * const name = o ? SvPVx_nolen_const(cSVOPo->op_sv) : Nullch;
 
@@ -4271,13 +4252,13 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
     }
     else
        aname = Nullch;
-    gv = name ? gv_fetchsv(cSVOPo->op_sv,
-                          GV_ADDMULTI | ((block || attrs) ? 0 : GV_NOINIT),
-                          SVt_PVCV)
+
+    gv_fetch_flags = (block || attrs || (CvFLAGS(PL_compcv) & CVf_BUILTIN_ATTRS))
+       ? GV_ADDMULTI : GV_ADDMULTI | GV_NOINIT;
+    gv = name ? gv_fetchsv(cSVOPo->op_sv, gv_fetch_flags, SVt_PVCV)
        : gv_fetchpv(aname ? aname
                     : (PL_curstash ? "__ANON__" : "__ANON__::__ANON__"),
-                    GV_ADDMULTI | ((block || attrs) ? 0 : GV_NOINIT),
-                    SVt_PVCV);
+                    gv_fetch_flags, SVt_PVCV);
 
     if (o)
        SAVEFREEOP(o);
@@ -4314,7 +4295,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
     }
 #endif
 
-    if (!block || !ps || *ps || attrs)
+    if (!block || !ps || *ps || attrs || (CvFLAGS(PL_compcv) & CVf_BUILTIN_ATTRS))
        const_sv = Nullsv;
     else
        const_sv = op_const_sv(block, Nullcv);