[Git][ghc/ghc][master] 3 commits: nonmoving: Clear bitmap after initializing block size

Marge Bot gitlab at gitlab.haskell.org
Fri May 1 01:34:53 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
2aa67611 by Ben Gamari at 2020-04-30T21:34:44-04:00
nonmoving: Clear bitmap after initializing block size

Previously nonmovingInitSegment would clear the bitmap before
initializing the segment's block size. This is broken since
nonmovingClearBitmap looks at the segment's block size to determine how
much bitmap to clear.

- - - - -
54dad3cf by Ben Gamari at 2020-04-30T21:34:44-04:00
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.

- - - - -
99ff8145 by Ben Gamari at 2020-04-30T21:34:44-04:00
nonmoving: Eagerly flush all capabilities' update remembered sets

(cherry picked from commit 2fa79119570b358a4db61446396889b8260d7957)

- - - - -


3 changed files:

- rts/sm/GC.c
- rts/sm/NonMoving.c
- rts/sm/NonMovingSweep.c


Changes:

=====================================
rts/sm/GC.c
=====================================
@@ -738,11 +738,13 @@ GarbageCollect (uint32_t collect_gen,
     }
   } // for all generations
 
-  // Flush the update remembered set. See Note [Eager update remembered set
+  // Flush the update remembered sets. See Note [Eager update remembered set
   // flushing] in NonMovingMark.c
   if (RtsFlags.GcFlags.useNonmoving) {
       RELEASE_SM_LOCK;
-      nonmovingAddUpdRemSetBlocks(&gct->cap->upd_rem_set.queue);
+      for (n = 0; n < n_capabilities; n++) {
+          nonmovingAddUpdRemSetBlocks(&capabilities[n]->upd_rem_set.queue);
+      }
       ACQUIRE_SM_LOCK;
   }
 


=====================================
rts/sm/NonMoving.c
=====================================
@@ -402,10 +402,10 @@ static void nonmovingInitSegment(struct NonmovingSegment *seg, uint8_t log_block
     seg->link = NULL;
     seg->todo_link = NULL;
     seg->next_free = 0;
-    nonmovingClearBitmap(seg);
     bd->nonmoving_segment.log_block_size = log_block_size;
     bd->nonmoving_segment.next_free_snap = 0;
     bd->u.scan = nonmovingSegmentGetBlock(seg, 0);
+    nonmovingClearBitmap(seg);
 }
 
 // Add a segment to the free list.


=====================================
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;



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/014ef4a3d9ee30b8add9118950f1f5007143bd1c...99ff8145044288a8a58c8028516903937ba3935c

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/014ef4a3d9ee30b8add9118950f1f5007143bd1c...99ff8145044288a8a58c8028516903937ba3935c
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200430/972010dc/attachment-0001.html>


More information about the ghc-commits mailing list