This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove the CvLVALUE check from pp_leavesub
authorFather Chrysostomos <sprout@cpan.org>
Wed, 22 Jun 2011 15:32:36 +0000 (08:32 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 22 Jun 2011 19:29:20 +0000 (12:29 -0700)
As of bb3abb0, this can no longer happen.

pp_hot.c

index 1b1117e..e9a34fd 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2672,6 +2672,7 @@ PP(pp_leavesublv)
 
     POPBLOCK(cx,newpm);
     cxstack_ix++; /* temporarily protect top context */
+    assert(CvLVALUE(cx->blk_sub.cv));
 
     TAINT_NOT;
 
@@ -2703,17 +2704,6 @@ PP(pp_leavesublv)
        }
     }
     else if (CxLVAL(cx)) {     /* Leave it as it is if we can. */
-       /* Here we go for robustness, not for speed, so we change all
-        * the refcounts so the caller gets a live guy. Cannot set
-        * TEMP, so sv_2mortal is out of question. */
-       if (!CvLVALUE(cx->blk_sub.cv)) {
-           LEAVE;
-           cxstack_ix--;
-           POPSUB(cx,sv);
-           PL_curpm = newpm;
-           LEAVESUB(sv);
-           DIE(aTHX_ "Can't modify non-lvalue subroutine call");
-       }
        if (gimme == G_SCALAR) {
            MARK = newsp + 1;
            EXTEND_MORTAL(1);