summaryrefslogtreecommitdiff
path: root/scope.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-03-12 19:14:13 +0000
committerDavid Mitchell <davem@iabyn.com>2014-03-12 20:19:03 +0000
commit5d9574c10ca04dcefc1cac5441cb321f7bb4cc37 (patch)
tree66acefea54382fa30b9c1c2b73c99d578f65c027 /scope.h
parent85c8e3067c12431ded3d5289a8ec16cf2e33ebaf (diff)
downloadperl-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.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/scope.h b/scope.h
index 996230c4e8..0dce9d6453 100644
--- a/scope.h
+++ b/scope.h
@@ -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))