diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-05-23 18:14:45 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-06-11 09:03:10 +0200 |
commit | a672f009fb8f223715e97dfcac7fb84e4bb2904b (patch) | |
tree | 0e82aea581c240cd9596c5f497837ec37f5f64cd /sv.c | |
parent | 258a58987ee2cc2be52e4eec4f8e68af1693368b (diff) | |
download | perl-a672f009fb8f223715e97dfcac7fb84e4bb2904b.tar.gz |
In Perl_sv_2[inu]v_flags(), use the non-caching code whenever SvVALID() is true
Previous the non-caching code was only used when SvVALID() was true on a PVGV.
However, PVLVs can also perform all the roles of a PVGV, so could conceivably
be acting as FBMs. As it's safe to test SvVALID() on any scalar SV, do so, as
the compiler can combine the flag test for SvVALID() with that for
SvGMAGICAL(), producing tighter object code.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -2267,7 +2267,7 @@ Perl_sv_2iv_flags(pTHX_ register SV *const sv, const I32 flags) dVAR; if (!sv) return 0; - if (SvGMAGICAL(sv) || (SvTYPE(sv) == SVt_PVGV && SvVALID(sv))) { + if (SvGMAGICAL(sv) || SvVALID(sv)) { /* FBMs use the space for SvIVX and SvNVX for other purposes, and use the same flag bit as SVf_IVisUV, so must not let them cache IVs. In practice they are extremely unlikely to actually get anywhere @@ -2356,7 +2356,7 @@ Perl_sv_2uv_flags(pTHX_ register SV *const sv, const I32 flags) dVAR; if (!sv) return 0; - if (SvGMAGICAL(sv) || (SvTYPE(sv) == SVt_PVGV && SvVALID(sv))) { + if (SvGMAGICAL(sv) || SvVALID(sv)) { /* FBMs use the space for SvIVX and SvNVX for other purposes, and use the same flag bit as SVf_IVisUV, so must not let them cache IVs. */ if (flags & SV_GMAGIC) @@ -2436,7 +2436,7 @@ Perl_sv_2nv_flags(pTHX_ register SV *const sv, const I32 flags) dVAR; if (!sv) return 0.0; - if (SvGMAGICAL(sv) || (SvTYPE(sv) == SVt_PVGV && SvVALID(sv))) { + if (SvGMAGICAL(sv) || SvVALID(sv)) { /* FBMs use the space for SvIVX and SvNVX for other purposes, and use the same flag bit as SVf_IVisUV, so must not let them cache NVs. */ if (flags & SV_GMAGIC) |