Skip to content
Snippets Groups Projects
Commit 78f6f6fd authored by Ben Gamari's avatar Ben Gamari Committed by Marge Bot
Browse files

nonmoving: Drop dead debugging utilities

These are largely superceded by support in the ghc-utils GDB extension.
parent eaa835bb
No related branches found
No related tags found
No related merge requests found
......@@ -1207,131 +1207,6 @@ void nonmovingPrintSegment(struct NonmovingSegment *seg)
debugBelch("End of segment\n\n");
}
void locate_object(P_ obj)
{
// Search allocators
for (int alloca_idx = 0; alloca_idx < NONMOVING_ALLOCA_CNT; ++alloca_idx) {
struct NonmovingAllocator *alloca = &nonmovingHeap.allocators[alloca_idx];
for (uint32_t cap_n = 0; cap_n < getNumCapabilities(); ++cap_n) {
Capability *cap = getCapability(cap_n);
struct NonmovingSegment *seg = cap->current_segments[alloca_idx];
if (obj >= (P_)seg && obj < (((P_)seg) + NONMOVING_SEGMENT_SIZE_W)) {
debugBelch("%p is in current segment of capability %d of allocator %d at %p\n", obj, cap_n, alloca_idx, (void*)seg);
return;
}
}
int seg_idx = 0;
struct NonmovingSegment *seg = alloca->active;
while (seg) {
if (obj >= (P_)seg && obj < (((P_)seg) + NONMOVING_SEGMENT_SIZE_W)) {
debugBelch("%p is in active segment %d of allocator %d at %p\n", obj, seg_idx, alloca_idx, (void*)seg);
return;
}
seg_idx++;
seg = seg->link;
}
seg_idx = 0;
seg = alloca->filled;
while (seg) {
if (obj >= (P_)seg && obj < (((P_)seg) + NONMOVING_SEGMENT_SIZE_W)) {
debugBelch("%p is in filled segment %d of allocator %d at %p\n", obj, seg_idx, alloca_idx, (void*)seg);
return;
}
seg_idx++;
seg = seg->link;
}
}
struct NonmovingSegment *seg = nonmovingHeap.free;
int seg_idx = 0;
while (seg) {
if (obj >= (P_)seg && obj < (((P_)seg) + NONMOVING_SEGMENT_SIZE_W)) {
debugBelch("%p is in free segment %d at %p\n", obj, seg_idx, (void*)seg);
return;
}
seg_idx++;
seg = seg->link;
}
// Search nurseries
for (uint32_t nursery_idx = 0; nursery_idx < n_nurseries; ++nursery_idx) {
for (bdescr* nursery_block = nurseries[nursery_idx].blocks; nursery_block; nursery_block = nursery_block->link) {
if (obj >= nursery_block->start && obj <= nursery_block->start + nursery_block->blocks*BLOCK_SIZE_W) {
debugBelch("%p is in nursery %d\n", obj, nursery_idx);
return;
}
}
}
// Search generations
for (uint32_t g = 0; g < RtsFlags.GcFlags.generations - 1; ++g) {
generation *gen = &generations[g];
for (bdescr *blk = gen->blocks; blk; blk = blk->link) {
if (obj >= blk->start && obj < blk->free) {
debugBelch("%p is in generation %" FMT_Word32 " blocks\n", obj, g);
return;
}
}
for (bdescr *blk = gen->old_blocks; blk; blk = blk->link) {
if (obj >= blk->start && obj < blk->free) {
debugBelch("%p is in generation %" FMT_Word32 " old blocks\n", obj, g);
return;
}
}
}
// Search large objects
for (uint32_t g = 0; g < RtsFlags.GcFlags.generations - 1; ++g) {
generation *gen = &generations[g];
for (bdescr *large_block = gen->large_objects; large_block; large_block = large_block->link) {
if ((P_)large_block->start == obj) {
debugBelch("%p is in large blocks of generation %d\n", obj, g);
return;
}
}
}
for (bdescr *large_block = nonmoving_large_objects; large_block; large_block = large_block->link) {
if ((P_)large_block->start == obj) {
debugBelch("%p is in nonmoving_large_objects\n", obj);
return;
}
}
for (bdescr *large_block = nonmoving_marked_large_objects; large_block; large_block = large_block->link) {
if ((P_)large_block->start == obj) {
debugBelch("%p is in nonmoving_marked_large_objects\n", obj);
return;
}
}
// Search workspaces FIXME only works in non-threaded runtime
#if !defined(THREADED_RTS)
for (uint32_t g = 0; g < RtsFlags.GcFlags.generations - 1; ++ g) {
gen_workspace *ws = &gct->gens[g];
for (bdescr *blk = ws->todo_bd; blk; blk = blk->link) {
if (obj >= blk->start && obj < blk->free) {
debugBelch("%p is in generation %" FMT_Word32 " todo bds\n", obj, g);
return;
}
}
for (bdescr *blk = ws->scavd_list; blk; blk = blk->link) {
if (obj >= blk->start && obj < blk->free) {
debugBelch("%p is in generation %" FMT_Word32 " scavd bds\n", obj, g);
return;
}
}
for (bdescr *blk = ws->todo_large_objects; blk; blk = blk->link) {
if (obj >= blk->start && obj < blk->free) {
debugBelch("%p is in generation %" FMT_Word32 " todo large bds\n", obj, g);
return;
}
}
}
#endif
}
void nonmovingPrintSweepList(void)
{
debugBelch("==== SWEEP LIST =====\n");
......@@ -1342,37 +1217,4 @@ void nonmovingPrintSweepList(void)
debugBelch("= END OF SWEEP LIST =\n");
}
void check_in_mut_list(StgClosure *p)
{
for (uint32_t cap_n = 0; cap_n < getNumCapabilities(); ++cap_n) {
for (bdescr *bd = getCapability(cap_n)->mut_lists[oldest_gen->no]; bd; bd = bd->link) {
for (StgPtr q = bd->start; q < bd->free; ++q) {
if (*((StgPtr**)q) == (StgPtr*)p) {
debugBelch("Object is in mut list of cap %d: %p\n", cap_n, getCapability(cap_n)->mut_lists[oldest_gen->no]);
return;
}
}
}
}
debugBelch("Object is not in a mut list\n");
}
void print_block_list(bdescr* bd)
{
while (bd) {
debugBelch("%p, ", (void*)bd);
bd = bd->link;
}
debugBelch("\n");
}
void print_thread_list(StgTSO* tso)
{
while (tso != END_TSO_QUEUE) {
printClosure((StgClosure*)tso);
tso = tso->global_link;
}
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment