Use leavesublv for all CORE subs
authorFather Chrysostomos <sprout@cpan.org>
Sun, 28 Aug 2011 13:34:48 +0000 (06:34 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 29 Aug 2011 04:03:52 +0000 (21:03 -0700)
and not just lock, vec and substr.  Using a regular leavesub op causes
the return values to be copied.  There is no need for that, so this
commit changes them all to use leavesublv.

gv.c

diff --git a/gv.c b/gv.c
index 25548eb..e269753 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -1400,9 +1400,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
                   new ATTRSUB. */
            (void)core_prototype((SV *)cv, name, code, &opnum);
            if (ampable) {
-               if (opnum == OP_VEC || opnum == OP_LOCK
-                || opnum == OP_SUBSTR)
-                   CvLVALUE_on(cv);
+               CvLVALUE_on(cv);
                newATTRSUB(oldsavestack_ix,
                           newSVOP(
                                 OP_CONST, 0,
@@ -1417,7 +1415,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
                           )
                );
                assert(GvCV(gv) == cv);
-               if (opnum == OP_LOCK)
+               if (opnum != OP_VEC && opnum != OP_SUBSTR)
                    CvLVALUE_off(cv); /* Now *that* was a neat trick. */
                LEAVE;
                PL_parser = oldparser;