summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorbulk88 (via RT) <perlbug-followup@perl.org>2012-11-22 16:33:34 -0800
committerSteffen Mueller <smueller@cpan.org>2012-11-23 08:44:44 +0100
commit716ae3b03e04a6b0ae19b882828eecf4ffc4c458 (patch)
tree68d3ee01bfa40b2c1fab5bc6ee1b15951320e8d8 /sv.h
parent3315335cdf1a9156473dc3b0a3f34ac9ec7faf4a (diff)
downloadperl-716ae3b03e04a6b0ae19b882828eecf4ffc4c458.tar.gz
av_exists: dont make a mortal never to use it
Make av_exists slightly smaller and faster by reducing the liveness of a mortal SV and using a NN SvTRUE_nomg. There were 3 cases, where this mortal would be created, yet a return happened and the mortal went unused and was wasted. So move the mortal creation point closer to where it is first used. Also var sv will never be null, so use a NN version of SvTRUE_nomg created in commit [perl #115870]. The retbool line isn't actually required for optimization reasons, but was created just in case something in the future changes or some unknown compiler does something inefficiently. For me with 32 bit x86 VC 2003, before av_exists was 0x1C2, after 0x1B8. Comment from committer: Includes SvTRUE_nomg_NN from [perl #115870].
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sv.h b/sv.h
index 35b360f4ed..fe29a419d0 100644
--- a/sv.h
+++ b/sv.h
@@ -1709,6 +1709,7 @@ Like sv_utf8_upgrade, but doesn't do magic on C<sv>.
#define SvTRUE(sv) ((sv) && (SvGMAGICAL(sv) ? sv_2bool(sv) : SvTRUE_common(sv, sv_2bool_nomg(sv))))
#define SvTRUE_nomg(sv) ((sv) && ( SvTRUE_common(sv, sv_2bool_nomg(sv))))
#define SvTRUE_NN(sv) (SvGMAGICAL(sv) ? sv_2bool(sv) : SvTRUE_common(sv, sv_2bool_nomg(sv)))
+#define SvTRUE_nomg_NN(sv) ( SvTRUE_common(sv, sv_2bool_nomg(sv)))
#define SvTRUE_common(sv,fallback) ( \
!SvOK(sv) \
? 0 \