diff options
author | David Mitchell <davem@iabyn.com> | 2014-03-12 19:14:13 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2014-03-12 20:19:03 +0000 |
commit | 5d9574c10ca04dcefc1cac5441cb321f7bb4cc37 (patch) | |
tree | 66acefea54382fa30b9c1c2b73c99d578f65c027 /scope.h | |
parent | 85c8e3067c12431ded3d5289a8ec16cf2e33ebaf (diff) | |
download | perl-5d9574c10ca04dcefc1cac5441cb321f7bb4cc37.tar.gz |
sprinkle LIKELY() on pp_hot.c scope.c and some *.h
I've gone through pp_hot.c and scope.c and added LIKELY() or UNLIKELY()
to all conditionals where I understand the code well enough to know that
a particular branch is or isn't likely to be taken very often.
I also processed some of the .h files which contain commonly used macros.
Diffstat (limited to 'scope.h')
-rw-r--r-- | scope.h | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -98,8 +98,8 @@ * macros */ #define SS_MAXPUSH 4 -#define SSCHECK(need) if (PL_savestack_ix + (I32)(need) + SS_MAXPUSH > PL_savestack_max) savestack_grow() -#define SSGROW(need) if (PL_savestack_ix + (I32)(need) + SS_MAXPUSH > PL_savestack_max) savestack_grow_cnt(need + SS_MAXPUSH) +#define SSCHECK(need) if (UNLIKELY(PL_savestack_ix + (I32)(need) + SS_MAXPUSH > PL_savestack_max)) savestack_grow() +#define SSGROW(need) if (UNLIKELY(PL_savestack_ix + (I32)(need) + SS_MAXPUSH > PL_savestack_max)) savestack_grow_cnt(need + SS_MAXPUSH) #define SSPUSHINT(i) (PL_savestack[PL_savestack_ix++].any_i32 = (I32)(i)) #define SSPUSHLONG(i) (PL_savestack[PL_savestack_ix++].any_long = (long)(i)) #define SSPUSHBOOL(p) (PL_savestack[PL_savestack_ix++].any_bool = (p)) @@ -130,7 +130,7 @@ ix += (need); \ PL_savestack_ix = ix; \ assert(ix <= PL_savestack_max); \ - if ((ix + SS_MAXPUSH) > PL_savestack_max) savestack_grow(); \ + if (UNLIKELY((ix + SS_MAXPUSH) > PL_savestack_max)) savestack_grow(); \ assert(PL_savestack_ix + SS_MAXPUSH <= PL_savestack_max); #define SS_ADD_INT(i) ((ssp++)->any_i32 = (I32)(i)) |