[commit: ghc] master: rts: Use BITS_IN macro in bitmap calculations (3cd1305)
git at git.haskell.org
git at git.haskell.org
Tue Feb 6 19:22:01 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/3cd1305ffcc4a5e3269aeb2e0694dddb7ca480d0/ghc
>---------------------------------------------------------------
commit 3cd1305ffcc4a5e3269aeb2e0694dddb7ca480d0
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date: Tue Feb 6 13:29:50 2018 -0500
rts: Use BITS_IN macro in bitmap calculations
Reviewers: bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4386
>---------------------------------------------------------------
3cd1305ffcc4a5e3269aeb2e0694dddb7ca480d0
rts/sm/Compact.h | 12 ++++++------
rts/sm/GC.c | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/rts/sm/Compact.h b/rts/sm/Compact.h
index 6dcb50b..63abfc7 100644
--- a/rts/sm/Compact.h
+++ b/rts/sm/Compact.h
@@ -20,8 +20,8 @@ mark(StgPtr p, bdescr *bd)
{
uint32_t offset_within_block = p - bd->start; // in words
StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
- (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
- StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
+ (offset_within_block / BITS_IN(W_));
+ StgWord bit_mask = (StgWord)1 << (offset_within_block & (BITS_IN(W_) - 1));
*bitmap_word |= bit_mask;
}
@@ -30,8 +30,8 @@ unmark(StgPtr p, bdescr *bd)
{
uint32_t offset_within_block = p - bd->start; // in words
StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
- (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
- StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
+ (offset_within_block / BITS_IN(W_));
+ StgWord bit_mask = (StgWord)1 << (offset_within_block & (BITS_IN(W_) - 1));
*bitmap_word &= ~bit_mask;
}
@@ -40,8 +40,8 @@ is_marked(StgPtr p, bdescr *bd)
{
uint32_t offset_within_block = p - bd->start; // in words
StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
- (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
- StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
+ (offset_within_block / BITS_IN(W_));
+ StgWord bit_mask = (StgWord)1 << (offset_within_block & (BITS_IN(W_)- 1));
return (*bitmap_word & bit_mask);
}
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 197b466..54797ba 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -1372,7 +1372,7 @@ prepare_collected_gen (generation *gen)
bdescr *bitmap_bdescr;
StgWord *bitmap;
- bitmap_size = gen->n_old_blocks * BLOCK_SIZE / (sizeof(W_)*BITS_PER_BYTE);
+ bitmap_size = gen->n_old_blocks * BLOCK_SIZE / BITS_IN(W_);
if (bitmap_size > 0) {
bitmap_bdescr = allocGroup((StgWord)BLOCK_ROUND_UP(bitmap_size)
@@ -1390,7 +1390,7 @@ prepare_collected_gen (generation *gen)
// block descriptor.
for (bd=gen->old_blocks; bd != NULL; bd = bd->link) {
bd->u.bitmap = bitmap;
- bitmap += BLOCK_SIZE_W / (sizeof(W_)*BITS_PER_BYTE);
+ bitmap += BLOCK_SIZE_W / BITS_IN(W_);
// Also at this point we set the BF_MARKED flag
// for this block. The invariant is that
More information about the ghc-commits
mailing list