summaryrefslogtreecommitdiff
path: root/headers.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-02-23 00:19:37 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-02-23 00:19:37 +0300
commit0f831daec3acd2b934ba6ee31ff3406c90408134 (patch)
treec5edc1b6e495c55e02ad98fb7e4c911cc06a1c19 /headers.c
parent037991eba58acd89f8d368ca0e9fbdb3bc47d6a1 (diff)
downloadbdwgc-0f831daec3acd2b934ba6ee31ff3406c90408134.tar.gz
Omit register keyword in performance-critical code if C++ compiler used
Issue #206 (bdwgc). * headers.c (GC_next_used_block): Replace register keyword to REGISTER. * include/private/gc_hdrs.h [HASH_TL] (GET_BI, GET_HDR_ADDR, GET_HDR, SET_HDR): Likewise. * mark.c (GC_push_all_eager): Likewise. * mark.c [WRAP_MARK_SOME && PARALLEL_MARK] (GC_push_conditional_eager): Likewise. * include/private/gc_priv.h (REGISTER): New macro (defined before include gc_hdrs.h); add comment.
Diffstat (limited to 'headers.c')
-rw-r--r--headers.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/headers.c b/headers.c
index bdc8311d..16bc8b06 100644
--- a/headers.c
+++ b/headers.c
@@ -341,12 +341,13 @@ void GC_apply_to_all_blocks(void (*fn)(struct hblk *h, word client_data),
/* Return 0 if there is none. */
GC_INNER struct hblk * GC_next_used_block(struct hblk *h)
{
- register bottom_index * bi;
- register word j = ((word)h >> LOG_HBLKSIZE) & (BOTTOM_SZ-1);
+ REGISTER bottom_index * bi;
+ REGISTER word j = ((word)h >> LOG_HBLKSIZE) & (BOTTOM_SZ-1);
GET_BI(h, bi);
if (bi == GC_all_nils) {
- register word hi = (word)h >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE);
+ REGISTER word hi = (word)h >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE);
+
bi = GC_all_bottom_indices;
while (bi != 0 && bi -> key < hi) bi = bi -> asc_link;
j = 0;