summaryrefslogtreecommitdiff
path: root/inline.h
diff options
context:
space:
mode:
authorSteffen Mueller <smueller@cpan.org>2013-03-06 20:39:43 +0100
committerSteffen Mueller <smueller@cpan.org>2013-03-06 20:39:43 +0100
commit2439e03355dec26654acf614900c077433bc27e0 (patch)
tree9bd0e7345aad6371d1f45065e869d791fb604c0c /inline.h
parent8da3792e39c8a8877091f33438f7191493dbefea (diff)
downloadperl-2439e03355dec26654acf614900c077433bc27e0.tar.gz
(UN)LIKELY branch prediction hints in a few strategic places
This adds branch prediction hints to a few strategic places such as growing stack or strings, some exception handling, and a few hot functions such as sv_upgrade. This is not exhaustive by any means.
Diffstat (limited to 'inline.h')
-rw-r--r--inline.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/inline.h b/inline.h
index 6b5f93c777..6cdfe9f178 100644
--- a/inline.h
+++ b/inline.h
@@ -46,7 +46,7 @@ S_ReANY(const REGEXP * const re)
PERL_STATIC_INLINE SV *
S_SvREFCNT_inc(SV *sv)
{
- if (sv)
+ if (LIKELY(sv != NULL))
SvREFCNT(sv)++;
return sv;
}
@@ -59,13 +59,13 @@ S_SvREFCNT_inc_NN(SV *sv)
PERL_STATIC_INLINE void
S_SvREFCNT_inc_void(SV *sv)
{
- if (sv)
+ if (LIKELY(sv != NULL))
SvREFCNT(sv)++;
}
PERL_STATIC_INLINE void
S_SvREFCNT_dec(pTHX_ SV *sv)
{
- if (sv) {
+ if (LIKELY(sv != NULL)) {
U32 rc = SvREFCNT(sv);
if (rc > 1)
SvREFCNT(sv) = rc - 1;