Skip to content

Commit

Permalink
Rename MARK_BITS_SZ internal macro to HB_MARKS_SZ
Browse files Browse the repository at this point in the history
(refactoring)

* docs/tree.md (A picture): Rename MARK_BITS_SZ to HB_MARKS_SZ.
* include/private/gc_priv.h (MARK_BITS_SZ, hblkhdr.hb_marks):
Likewise.
* reclaim.c [!NO_DEBUGGING && !USE_MARK_BYTES && !MARK_BIT_PER_OBJ]
(GC_n_set_marks): Likewise.
* include/private/gc_priv.h [USE_MARK_BYTES] (MARK_BITS_SZ): Refine
comment.
  • Loading branch information
ivmai committed Jun 19, 2024
1 parent 9f77ab6 commit 6992ccf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ contributed originally by Dave Barrett.
--- +----------------------+
^ | |
| | | * if hdr is free, hb_sz is the size
MARK_BITS_SZ| char/word hb_marks[] | of a heap chunk (struct hblk) of at
HB_MARKS_SZ | char/word hb_marks[] | of a heap chunk (struct hblk) of at
| | | least MININCR*HBLKSIZE bytes (below);
v | | otherwise, size of each object in chunk.
--- +----------------------+
Expand Down
21 changes: 10 additions & 11 deletions include/private/gc_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1193,17 +1193,16 @@ struct hblkhdr {
/* same object due to a race. */
# else
size_t hb_n_marks; /* Without parallel marking, the count */
/* is accurate. */
# endif
# endif /* is accurate. */
# ifdef USE_MARK_BYTES
# define MARK_BITS_SZ (MARK_BITS_PER_HBLK + 1)
/* Unlike the other case, this is in units of bytes. */
/* Since we force double-word alignment, we need at most one */
/* mark bit per 2 words. But we do allocate and set one */
/* extra mark bit to avoid an explicit check for the */
/* partial object at the end of each block. */
# define HB_MARKS_SZ (MARK_BITS_PER_HBLK + 1)
/* Unlike the other case, this is in units of bytes. Since we */
/* force certain alignment, we need at most one mark bit per */
/* a granule. But we do allocate and set one extra mark bit to */
/* avoid an explicit check for the partial object at the end of */
/* each block. */
union {
char _hb_marks[MARK_BITS_SZ];
char _hb_marks[HB_MARKS_SZ];
/* The i'th byte is 1 if the object */
/* starting at granule i or object i is */
/* marked, 0 otherwise. */
Expand All @@ -1214,8 +1213,8 @@ struct hblkhdr {
} _mark_byte_union;
# define hb_marks _mark_byte_union._hb_marks
# else
# define MARK_BITS_SZ (MARK_BITS_PER_HBLK/CPP_WORDSZ + 1)
word hb_marks[MARK_BITS_SZ];
# define HB_MARKS_SZ (MARK_BITS_PER_HBLK / CPP_WORDSZ + 1)
word hb_marks[HB_MARKS_SZ];
# endif /* !USE_MARK_BYTES */
};

Expand Down
2 changes: 1 addition & 1 deletion reclaim.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ unsigned GC_n_set_marks(const hdr *hhdr)
}
# else

for (i = 0; i < MARK_BITS_SZ; i++) {
for (i = 0; i < HB_MARKS_SZ; i++) {
result += count_ones(hhdr -> hb_marks[i]);
}
# endif
Expand Down

0 comments on commit 6992ccf

Please sign in to comment.