diff options
author | Steffen Mueller <smueller@cpan.org> | 2013-03-06 20:39:43 +0100 |
---|---|---|
committer | Steffen Mueller <smueller@cpan.org> | 2013-03-06 20:39:43 +0100 |
commit | 2439e03355dec26654acf614900c077433bc27e0 (patch) | |
tree | 9bd0e7345aad6371d1f45065e869d791fb604c0c /pp.h | |
parent | 8da3792e39c8a8877091f33438f7191493dbefea (diff) | |
download | perl-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 'pp.h')
-rw-r--r-- | pp.h | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -278,15 +278,15 @@ Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>. =cut */ -#define EXTEND(p,n) (void)(PL_stack_max - p < (int)(n) && \ +#define EXTEND(p,n) (void)(UNLIKELY(PL_stack_max - p < (int)(n)) && \ (sp = stack_grow(sp,p, (int) (n)))) /* Same thing, but update mark register too. */ -#define MEXTEND(p,n) STMT_START {if (PL_stack_max - p < (int)(n)) { \ - const int markoff = mark - PL_stack_base; \ - sp = stack_grow(sp,p,(int) (n)); \ - mark = PL_stack_base + markoff; \ - } } STMT_END +#define MEXTEND(p,n) STMT_START {if (UNLIKELY(PL_stack_max - p < (int)(n))) {\ + const int markoff = mark - PL_stack_base; \ + sp = stack_grow(sp,p,(int) (n)); \ + mark = PL_stack_base + markoff; \ + } } STMT_END #define PUSHs(s) (*++sp = (s)) #define PUSHTARG STMT_START { SvSETMAGIC(TARG); PUSHs(TARG); } STMT_END @@ -388,7 +388,7 @@ Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>. #define EXTEND_MORTAL(n) \ STMT_START { \ - if (PL_tmps_ix + (n) >= PL_tmps_max) \ + if (UNLIKELY(PL_tmps_ix + (n) >= PL_tmps_max)) \ tmps_grow(n); \ } STMT_END |