diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-04-25 18:35:25 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-04-30 21:34:44 -0400 |
commit | 54dad3cf1e04f16ea00fb6a41b378e948c8ebf0f (patch) | |
tree | 321683157de33aa3322a04970eb58797890d8cda /rts | |
parent | 2aa676114bca40d6124ba90d13242c7c102369e0 (diff) | |
download | haskell-54dad3cf1e04f16ea00fb6a41b378e948c8ebf0f.tar.gz |
nonmoving: Explicitly memoize block count
A profile cast doubt on whether the compiler hoisted the bound out the
loop as I would have expected here. It turns out it did but nevertheless
it seems clearer to just do this manually.
Diffstat (limited to 'rts')
-rw-r--r-- | rts/sm/NonMovingSweep.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/rts/sm/NonMovingSweep.c b/rts/sm/NonMovingSweep.c index 89efe8f1ad..1a7c97b7e6 100644 --- a/rts/sm/NonMovingSweep.c +++ b/rts/sm/NonMovingSweep.c @@ -31,12 +31,11 @@ enum SweepResult { GNUC_ATTR_HOT static enum SweepResult nonmovingSweepSegment(struct NonmovingSegment *seg) { + const nonmoving_block_idx blk_cnt = nonmovingSegmentBlockCount(seg); bool found_free = false; bool found_live = false; - for (nonmoving_block_idx i = 0; - i < nonmovingSegmentBlockCount(seg); - ++i) + for (nonmoving_block_idx i = 0; i < blk_cnt; ++i) { if (seg->bitmap[i] == nonmovingMarkEpoch) { found_live = true; |