summaryrefslogtreecommitdiff
path: root/reclaim.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-03-06 09:02:28 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-03-06 09:18:32 +0300
commitceafc1a74178917537deb61bc6369e3284da98c5 (patch)
treea2ae2b22ad58866dee3a545645cbe2ad52d8d39c /reclaim.c
parente925cb982bf546f6a4e3ac5c3a87b61d39acc3b4 (diff)
downloadbdwgc-ceafc1a74178917537deb61bc6369e3284da98c5.tar.gz
Always set only one bit past end in GC_set_hdr_marks
* mark.c [!USE_MARK_BYTES] (GC_set_hdr_marks): Add comments; do not put bits beyond a single one past FINAL_MARK_BIT(sz). * reclaim.c [!USE_MARK_BYTES && MARK_BIT_PER_OBJ] (GC_n_set_marks): Do not ignore part of last hb_marks[] element passed to count_ones().
Diffstat (limited to 'reclaim.c')
-rw-r--r--reclaim.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/reclaim.c b/reclaim.c
index 9b50c85d..bb7905ac 100644
--- a/reclaim.c
+++ b/reclaim.c
@@ -525,15 +525,11 @@ unsigned GC_n_set_marks(hdr *hhdr)
word i;
# ifdef MARK_BIT_PER_OBJ
word n_objs = HBLK_OBJS(hhdr -> hb_sz);
- word n_mark_words;
+ word n_mark_words = divWORDSZ((n_objs > 0 ? n_objs : 1) + WORDSZ - 1);
- if (0 == n_objs) n_objs = 1;
- n_mark_words = divWORDSZ(n_objs + WORDSZ - 1);
- for (i = 0; i < n_mark_words - 1; i++) {
+ for (i = 0; i < n_mark_words; i++) {
result += count_ones(hhdr -> hb_marks[i]);
}
- result += count_ones((hhdr -> hb_marks[n_mark_words - 1])
- << (n_mark_words * WORDSZ - n_objs));
# else /* MARK_BIT_PER_GRANULE */
for (i = 0; i < MARK_BITS_SZ; i++) {
result += count_ones(hhdr -> hb_marks[i]);