diff options
author | David Mitchell <davem@iabyn.com> | 2011-06-21 14:40:12 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2011-06-25 09:28:17 +0100 |
commit | 69cb655bad9945c212e3b4016966ad8d90dfae8a (patch) | |
tree | 23b98249a9689bef994bf83a2fa6850e8ddb1565 /pp.c | |
parent | 1530afd8d16650b8c823c463ac078ead72dce7fd (diff) | |
download | perl-69cb655bad9945c212e3b4016966ad8d90dfae8a.tar.gz |
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;
}
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 55 |
1 files changed, 0 insertions, 55 deletions
@@ -2059,16 +2059,6 @@ PP(pp_lt) } } #endif -#ifndef NV_PRESERVES_UV -#ifdef PERL_PRESERVE_IVUV - else -#endif - if (SvROK(TOPs) && !SvAMAGIC(TOPs) && SvROK(TOPm1s) && !SvAMAGIC(TOPm1s)) { - SP--; - SETs(boolSV(SvRV(TOPs) < SvRV(TOPp1s))); - RETURN; - } -#endif { #if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan) dPOPTOPnnrl_nomg; @@ -2143,16 +2133,6 @@ PP(pp_gt) } } #endif -#ifndef NV_PRESERVES_UV -#ifdef PERL_PRESERVE_IVUV - else -#endif - if (SvROK(TOPs) && !SvAMAGIC(TOPs) && SvROK(TOPm1s) && !SvAMAGIC(TOPm1s)) { - SP--; - SETs(boolSV(SvRV(TOPs) > SvRV(TOPp1s))); - RETURN; - } -#endif { #if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan) dPOPTOPnnrl_nomg; @@ -2227,16 +2207,6 @@ PP(pp_le) } } #endif -#ifndef NV_PRESERVES_UV -#ifdef PERL_PRESERVE_IVUV - else -#endif - if (SvROK(TOPs) && !SvAMAGIC(TOPs) && SvROK(TOPm1s) && !SvAMAGIC(TOPm1s)) { - SP--; - SETs(boolSV(SvRV(TOPs) <= SvRV(TOPp1s))); - RETURN; - } -#endif { #if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan) dPOPTOPnnrl_nomg; @@ -2311,16 +2281,6 @@ PP(pp_ge) } } #endif -#ifndef NV_PRESERVES_UV -#ifdef PERL_PRESERVE_IVUV - else -#endif - if (SvROK(TOPs) && !SvAMAGIC(TOPs) && SvROK(TOPm1s) && !SvAMAGIC(TOPm1s)) { - SP--; - SETs(boolSV(SvRV(TOPs) >= SvRV(TOPp1s))); - RETURN; - } -#endif { #if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan) dPOPTOPnnrl_nomg; @@ -2339,13 +2299,6 @@ PP(pp_ne) { dVAR; dSP; tryAMAGICbin_MG(ne_amg,AMGf_set|AMGf_numeric); -#ifndef NV_PRESERVES_UV - if (SvROK(TOPs) && !SvAMAGIC(TOPs) && SvROK(TOPm1s) && !SvAMAGIC(TOPm1s)) { - SP--; - SETs(boolSV(SvRV(TOPs) != SvRV(TOPp1s))); - RETURN; - } -#endif #ifdef PERL_PRESERVE_IVUV SvIV_please_nomg(TOPs); if (SvIOK(TOPs)) { @@ -2416,14 +2369,6 @@ PP(pp_ncmp) { dVAR; dSP; dTARGET; tryAMAGICbin_MG(ncmp_amg, AMGf_numeric); -#ifndef NV_PRESERVES_UV - if (SvROK(TOPs) && !SvAMAGIC(TOPs) && SvROK(TOPm1s) && !SvAMAGIC(TOPm1s)) { - const UV right = PTR2UV(SvRV(POPs)); - const UV left = PTR2UV(SvRV(TOPs)); - SETi((left > right) - (left < right)); - RETURN; - } -#endif #ifdef PERL_PRESERVE_IVUV /* Fortunately it seems NaN isn't IOK */ SvIV_please_nomg(TOPs); |