[Git][ghc/ghc][wip/T7275] rts: Further simplify

Ben Gamari gitlab at gitlab.haskell.org
Wed Dec 9 21:33:17 UTC 2020



Ben Gamari pushed to branch wip/T7275 at Glasgow Haskell Compiler / GHC


Commits:
a3a14e24 by Ben Gamari at 2020-12-09T16:33:03-05:00
rts: Further simplify

- - - - -


1 changed file:

- rts/ProfHeap.c


Changes:

=====================================
rts/ProfHeap.c
=====================================
@@ -1103,41 +1103,21 @@ heapCensusCompactList(Census *census, bdescr *bd)
     }
 }
 
-static void
-heapCensusPinnedBlock( Census *census, bdescr *bd )
-{
-    StgWord *p = (StgWord *) bd->start;
-    while (p < bd->free) {
-        if (*(StgWord *) p == 0) {
-            p++;
-            continue;
-        }
-
-        ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
-        const StgInfoTable *info = get_itbl((StgClosure *) p);
-        switch (info->type) {
-          case ARR_WORDS:
-            {
-              StgArrBytes *arr = (StgArrBytes *) p;
-              const size_t size = arr_words_sizeW(arr);
-              heapProfObject(census, (StgClosure *)p, size, /*prim*/ true);
-              p += size;
-              break;
-            }
-          default:
-            barf("heapCensusPinnedBlock: Unknown object: %p (info=%p, type=%d)", p, info, info->type);
-        }
-    }
-}
-
 /*
- * Take a census of the contents of a "normal" (e.g. not large, not pinned, not
- * compact) heap block.
+ * Take a census of the contents of a "normal" (e.g. not large, not compact)
+ * heap block. This can, however, handle PINNED blocks.
  */
 static void
-heapCensusNormalBlock(Census *census, bdescr *bd)
+heapCensusBlock(Census *census, bdescr *bd)
 {
     StgPtr p = bd->start;
+
+    // In the case of PINNED blocks there can be (zeroed) slop at the beginning
+    // due to object alignment.
+    if (bd->flags & BD_PINNED) {
+        while (p < bd->free && !*p) p++;
+    }
+
     while (p < bd->free) {
         const StgInfoTable *info = get_itbl((const StgClosure *)p);
         bool prim = false;
@@ -1331,11 +1311,6 @@ heapCensusChain( Census *census, bdescr *bd )
             continue;
         }
 
-        if (bd->flags & BF_PINNED) {
-            heapCensusPinnedBlock(census, bd);
-            continue;
-        }
-
         heapCensusNormalBlock(census, bd);
     }
 }



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a3a14e24af7ca67bbc87b85e5e081588455a5ebc

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a3a14e24af7ca67bbc87b85e5e081588455a5ebc
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/20201209/aec6ef34/attachment-0001.html>


More information about the ghc-commits mailing list