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.
/* 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;
/* Set bottom_indx to point to the bottom index for address p */
# define GET_BI(p, bottom_indx) \
do { \
- register word hi = \
- (word)(p) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE); \
- register bottom_index * _bi = GC_top_index[TL_HASH(hi)]; \
+ REGISTER word hi = (word)(p) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE); \
+ REGISTER bottom_index * _bi = GC_top_index[TL_HASH(hi)]; \
while (_bi -> key != hi && _bi != GC_all_nils) \
_bi = _bi -> hash_link; \
(bottom_indx) = _bi; \
} while (0)
# define GET_HDR_ADDR(p, ha) \
do { \
- register bottom_index * bi; \
+ REGISTER bottom_index * bi; \
GET_BI(p, bi); \
(ha) = &HDR_FROM_BI(bi, p); \
} while (0)
# define GET_HDR(p, hhdr) \
do { \
- register hdr ** _ha; \
+ REGISTER hdr ** _ha; \
GET_HDR_ADDR(p, _ha); \
(hhdr) = *_ha; \
} while (0)
# define SET_HDR(p, hhdr) \
do { \
- register hdr ** _ha; \
+ REGISTER hdr ** _ha; \
GET_HDR_ADDR(p, _ha); \
*_ha = (hhdr); \
} while (0)
/* The corresponding variable definition must start with GC_INNER. */
#endif /* !GC_INNER */
+#ifdef __cplusplus
+ /* Register storage specifier is deprecated in C++11. */
+# define REGISTER /* empty */
+#else
+ /* Used only for several local variables in the performance-critical */
+ /* functions. Should not be used for new code. */
+# define REGISTER register
+#endif
+
#ifndef HEADERS_H
# include "gc_hdrs.h"
#endif
{
word * b = (word *)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1));
word * t = (word *)(((word) top) & ~(ALIGNMENT-1));
- register word *p;
- register word *lim;
- register ptr_t greatest_ha = (ptr_t)GC_greatest_plausible_heap_addr;
- register ptr_t least_ha = (ptr_t)GC_least_plausible_heap_addr;
+ REGISTER word *p;
+ REGISTER word *lim;
+ REGISTER ptr_t greatest_ha = (ptr_t)GC_greatest_plausible_heap_addr;
+ REGISTER ptr_t least_ha = (ptr_t)GC_least_plausible_heap_addr;
# define GC_greatest_plausible_heap_addr greatest_ha
# define GC_least_plausible_heap_addr least_ha
lim = t - 1 /* longword */;
for (p = b; (word)p <= (word)lim;
p = (word *)(((ptr_t)p) + ALIGNMENT)) {
- register word q = *p;
+ REGISTER word q = *p;
+
GC_PUSH_ONE_STACK(q, p);
}
# undef GC_greatest_plausible_heap_addr
{
word * b = (word *)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1));
word * t = (word *)(((word) top) & ~(ALIGNMENT-1));
- register word *p;
- register word *lim;
- register ptr_t greatest_ha = (ptr_t)GC_greatest_plausible_heap_addr;
- register ptr_t least_ha = (ptr_t)GC_least_plausible_heap_addr;
+ REGISTER word *p;
+ REGISTER word *lim;
+ REGISTER ptr_t greatest_ha = (ptr_t)GC_greatest_plausible_heap_addr;
+ REGISTER ptr_t least_ha = (ptr_t)GC_least_plausible_heap_addr;
# define GC_greatest_plausible_heap_addr greatest_ha
# define GC_least_plausible_heap_addr least_ha
lim = t - 1;
for (p = b; (word)p <= (word)lim; p = (word *)((ptr_t)p + ALIGNMENT)) {
- register word q = *p;
+ REGISTER word q = *p;
+
GC_PUSH_ONE_HEAP(q, p, GC_mark_stack_top);
}
# undef GC_greatest_plausible_heap_addr