diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-03-06 09:02:28 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-03-06 09:18:32 +0300 |
commit | ceafc1a74178917537deb61bc6369e3284da98c5 (patch) | |
tree | a2ae2b22ad58866dee3a545645cbe2ad52d8d39c /mark.c | |
parent | e925cb982bf546f6a4e3ac5c3a87b61d39acc3b4 (diff) | |
download | bdwgc-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 'mark.c')
-rw-r--r-- | mark.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -140,9 +140,14 @@ GC_INNER void GC_set_hdr_marks(hdr *hhdr) hhdr -> hb_marks[i] = 1; } # else - for (i = 0; i < divWORDSZ(n_marks + WORDSZ); ++i) { + /* Note that all bits are set even in case of MARK_BIT_PER_GRANULE, */ + /* instead of setting every n-th bit where n is MARK_BIT_OFFSET(sz). */ + /* This is done for a performance reason. */ + for (i = 0; i < divWORDSZ(n_marks); ++i) { hhdr -> hb_marks[i] = GC_WORD_MAX; } + /* Set the remaining bits near the end (plus one bit past the end). */ + hhdr -> hb_marks[i] = ((((word)1 << modWORDSZ(n_marks)) - 1) << 1) | 1; # endif # ifdef MARK_BIT_PER_OBJ hhdr -> hb_n_marks = n_marks; |