This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
S_return_lvalues: microöptimisation
authorFather Chrysostomos <sprout@cpan.org>
Sat, 9 Jul 2011 13:16:36 +0000 (06:16 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 9 Jul 2011 13:16:36 +0000 (06:16 -0700)
This jumps over an if() condition when we know it’s going to be true.

pp_ctl.c

index 554e47f..5fd7bf5 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2313,6 +2313,7 @@ S_return_lvalues(pTHX_ SV **mark, SV **sp, SV **newsp, I32 gimme,
                        SvREADONLY(TOPs) ? (TOPs == &PL_sv_undef) ? "undef"
                        : "a readonly value" : "a temporary");
                }
+               goto copy_sv;
            }
            else {
                /* sub:lvalue{} will take us here. */
@@ -2328,6 +2329,7 @@ S_return_lvalues(pTHX_ SV **mark, SV **sp, SV **newsp, I32 gimme,
            }
        }
        if (MARK < SP) {
+             copy_sv:
                if (cx->blk_sub.cv && CvDEPTH(cx->blk_sub.cv) > 1) {
                        *++newsp = SvREFCNT_inc(*SP);
                        FREETMPS;