summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeo Camarasu <teofilcamarasu@gmail.com>2023-05-03 16:19:29 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-05-12 19:27:23 -0400
commit5ad776abbb7c72d65d2ae27de5b2ec48b6e72cde (patch)
tree0e065bca1ee6c6abc361b17df93bac95ba807d08
parentaa84cff4f68e09cc33129ce3fe1bad5aff19e5d9 (diff)
downloadhaskell-5ad776abbb7c72d65d2ae27de5b2ec48b6e72cde.tar.gz
rts: Teach listAllBlocks about nonmoving heap
List all blocks on the non-moving heap. Resolves #22627
-rw-r--r--rts/sm/Storage.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index b7350d7481..cd60ebc0b5 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -42,7 +42,7 @@
#include "GC.h"
#include "Evac.h"
#include "NonMovingAllocate.h"
-#include "sm/NonMovingMark.h"
+#include "NonMovingMark.h"
#if defined(ios_HOST_OS) || defined(darwin_HOST_OS)
#include "Hash.h"
#endif
@@ -365,11 +365,20 @@ listGenBlocks (ListBlocksCb cb, void *user, generation* gen)
cb(user, gen->compact_blocks_in_import);
}
+static void
+listSegmentBlocks (ListBlocksCb cb, void *user, struct NonmovingSegment *seg)
+{
+ while (seg) {
+ cb(user, Bdescr((StgPtr) seg));
+ seg = seg->link;
+ }
+}
+
// Traverse all the different places that the rts stores blocks
// and call a callback on each of them.
void listAllBlocks (ListBlocksCb cb, void *user)
{
- uint32_t g, i;
+ uint32_t g, i, s;
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
for (i = 0; i < getNumCapabilities(); i++) {
cb(user, getCapability(i)->mut_lists[g]);
@@ -389,6 +398,24 @@ void listAllBlocks (ListBlocksCb cb, void *user)
}
cb(user, getCapability(i)->pinned_object_blocks);
cb(user, getCapability(i)->pinned_object_empty);
+
+ // list capabilities' current segments
+ if(RtsFlags.GcFlags.useNonmoving) {
+ for (s = 0; s < NONMOVING_ALLOCA_CNT; s++) {
+ listSegmentBlocks(cb, user, getCapability(i)->current_segments[s]);
+ }
+ }
+ }
+
+ // list blocks on the nonmoving heap
+ if(RtsFlags.GcFlags.useNonmoving) {
+ for(s = 0; s < NONMOVING_ALLOCA_CNT; s++) {
+ listSegmentBlocks(cb, user, nonmovingHeap.allocators[s].filled);
+ listSegmentBlocks(cb, user, nonmovingHeap.allocators[s].saved_filled);
+ listSegmentBlocks(cb, user, nonmovingHeap.allocators[s].active);
+ }
+ cb(user, nonmoving_large_objects);
+ cb(user, nonmoving_compact_objects);
}
}