This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_return: optimise a couple of conditions
authorDavid Mitchell <davem@iabyn.com>
Thu, 11 Jun 2015 10:11:19 +0000 (11:11 +0100)
committerDavid Mitchell <davem@iabyn.com>
Fri, 19 Jun 2015 07:44:18 +0000 (08:44 +0100)
commitd40dc6b141019491ca18144b6a25c03e8882ffe8
tree5ce88a8cdfb4efd18d2c094dac50c99d387d283e
parenta375ceca5d834c83946967bb2d7972d7403acedb
pp_return: optimise a couple of conditions

Change:

    if (cxix < 0) {
        A; return;
    }
    if (cxix < cxstack_ix)
        B;

to

    if (cxix < cxstack_ix) {
        if (cxix < 0) {
            A; return;
        }
        B;
    }

This is functionally the same, since cxstack_ix is always positive at
this point, and makes for a quicker code path (one less test and branch)
in the reasonably common case of a return from a sub which doesn't
have any extra nested contexts to pop.
pp_ctl.c