remove unreachable code from various compare ops
authorDavid Mitchell <davem@iabyn.com>
Tue, 21 Jun 2011 13:40:12 +0000 (14:40 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sat, 25 Jun 2011 08:28:17 +0000 (09:28 +0100)
commit69cb655bad9945c212e3b4016966ad8d90dfae8a
tree23b98249a9689bef994bf83a2fa6850e8ddb1565
parent1530afd8d16650b8c823c463ac078ead72dce7fd
remove unreachable code from various compare ops

All the compare ops (such as pp_le), have an initial:

    tryAMAGICbin_MG(le_amg, AMGf_numeric);

The effect of the AMGf_numeric flag is that, if the le overloading fails,
but either of the args on the stack is a reference, then that arg is
replaced with a temporary non-ref arg that is either the result of
'0+' overloading, or is a UV with the numerical value of the ref's
address.  So by the time the main body of the op is called, neither arg
can be a ref.

Thus a whole bunch of nearly identical blocks can be removed, which *used*
to handle comparing refs:

    if (SvROK(TOPs) && !SvAMAGIC(TOPs) && SvROK(TOPm1s) && !SvAMAGIC(TOPm1s)) {
        SP--;
        SETs(boolSV(SvRV(TOPs) <= SvRV(TOPp1s)));
        RETURN;
    }
pp.c
pp_hot.c