mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
6937142: G1: improvements to debugging output (S-M)
Various fixes to the G1 debugging output. Reviewed-by: johnc, iveresov
This commit is contained in:
parent
f5197d0d36
commit
9b4fc8fc23
5 changed files with 133 additions and 88 deletions
|
@ -767,7 +767,8 @@ void ConcurrentMark::checkpointRootsInitialPre() {
|
|||
_has_aborted = false;
|
||||
|
||||
if (G1PrintReachableAtInitialMark) {
|
||||
print_reachable(true, "before");
|
||||
print_reachable("at-cycle-start",
|
||||
true /* use_prev_marking */, true /* all */);
|
||||
}
|
||||
|
||||
// Initialise marking structures. This has to be done in a STW phase.
|
||||
|
@ -1979,19 +1980,21 @@ void ConcurrentMark::checkpointRootsFinalWork() {
|
|||
|
||||
#ifndef PRODUCT
|
||||
|
||||
class ReachablePrinterOopClosure: public OopClosure {
|
||||
class PrintReachableOopClosure: public OopClosure {
|
||||
private:
|
||||
G1CollectedHeap* _g1h;
|
||||
CMBitMapRO* _bitmap;
|
||||
outputStream* _out;
|
||||
bool _use_prev_marking;
|
||||
bool _all;
|
||||
|
||||
public:
|
||||
ReachablePrinterOopClosure(CMBitMapRO* bitmap,
|
||||
outputStream* out,
|
||||
bool use_prev_marking) :
|
||||
PrintReachableOopClosure(CMBitMapRO* bitmap,
|
||||
outputStream* out,
|
||||
bool use_prev_marking,
|
||||
bool all) :
|
||||
_g1h(G1CollectedHeap::heap()),
|
||||
_bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking) { }
|
||||
_bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking), _all(all) { }
|
||||
|
||||
void do_oop(narrowOop* p) { do_oop_work(p); }
|
||||
void do_oop( oop* p) { do_oop_work(p); }
|
||||
|
@ -2001,9 +2004,11 @@ public:
|
|||
const char* str = NULL;
|
||||
const char* str2 = "";
|
||||
|
||||
if (!_g1h->is_in_g1_reserved(obj))
|
||||
str = "outside G1 reserved";
|
||||
else {
|
||||
if (obj == NULL) {
|
||||
str = "";
|
||||
} else if (!_g1h->is_in_g1_reserved(obj)) {
|
||||
str = " O";
|
||||
} else {
|
||||
HeapRegion* hr = _g1h->heap_region_containing(obj);
|
||||
guarantee(hr != NULL, "invariant");
|
||||
bool over_tams = false;
|
||||
|
@ -2012,74 +2017,67 @@ public:
|
|||
} else {
|
||||
over_tams = hr->obj_allocated_since_next_marking(obj);
|
||||
}
|
||||
bool marked = _bitmap->isMarked((HeapWord*) obj);
|
||||
|
||||
if (over_tams) {
|
||||
str = "over TAMS";
|
||||
if (_bitmap->isMarked((HeapWord*) obj)) {
|
||||
str = " >";
|
||||
if (marked) {
|
||||
str2 = " AND MARKED";
|
||||
}
|
||||
} else if (_bitmap->isMarked((HeapWord*) obj)) {
|
||||
str = "marked";
|
||||
} else if (marked) {
|
||||
str = " M";
|
||||
} else {
|
||||
str = "#### NOT MARKED ####";
|
||||
str = " NOT";
|
||||
}
|
||||
}
|
||||
|
||||
_out->print_cr(" "PTR_FORMAT" contains "PTR_FORMAT" %s%s",
|
||||
_out->print_cr(" "PTR_FORMAT": "PTR_FORMAT"%s%s",
|
||||
p, (void*) obj, str, str2);
|
||||
}
|
||||
};
|
||||
|
||||
class ReachablePrinterClosure: public BitMapClosure {
|
||||
class PrintReachableObjectClosure : public ObjectClosure {
|
||||
private:
|
||||
CMBitMapRO* _bitmap;
|
||||
outputStream* _out;
|
||||
bool _use_prev_marking;
|
||||
bool _all;
|
||||
HeapRegion* _hr;
|
||||
|
||||
public:
|
||||
ReachablePrinterClosure(CMBitMapRO* bitmap,
|
||||
outputStream* out,
|
||||
bool use_prev_marking) :
|
||||
_bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking) { }
|
||||
|
||||
bool do_bit(size_t offset) {
|
||||
HeapWord* addr = _bitmap->offsetToHeapWord(offset);
|
||||
ReachablePrinterOopClosure oopCl(_bitmap, _out, _use_prev_marking);
|
||||
|
||||
_out->print_cr(" obj "PTR_FORMAT", offset %10d (marked)", addr, offset);
|
||||
oop(addr)->oop_iterate(&oopCl);
|
||||
_out->print_cr("");
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class ObjInRegionReachablePrinterClosure : public ObjectClosure {
|
||||
private:
|
||||
CMBitMapRO* _bitmap;
|
||||
outputStream* _out;
|
||||
bool _use_prev_marking;
|
||||
|
||||
public:
|
||||
ObjInRegionReachablePrinterClosure(CMBitMapRO* bitmap,
|
||||
outputStream* out,
|
||||
bool use_prev_marking) :
|
||||
_bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking) { }
|
||||
PrintReachableObjectClosure(CMBitMapRO* bitmap,
|
||||
outputStream* out,
|
||||
bool use_prev_marking,
|
||||
bool all,
|
||||
HeapRegion* hr) :
|
||||
_bitmap(bitmap), _out(out),
|
||||
_use_prev_marking(use_prev_marking), _all(all), _hr(hr) { }
|
||||
|
||||
void do_object(oop o) {
|
||||
ReachablePrinterOopClosure oopCl(_bitmap, _out, _use_prev_marking);
|
||||
bool over_tams;
|
||||
if (_use_prev_marking) {
|
||||
over_tams = _hr->obj_allocated_since_prev_marking(o);
|
||||
} else {
|
||||
over_tams = _hr->obj_allocated_since_next_marking(o);
|
||||
}
|
||||
bool marked = _bitmap->isMarked((HeapWord*) o);
|
||||
bool print_it = _all || over_tams || marked;
|
||||
|
||||
_out->print_cr(" obj "PTR_FORMAT" (over TAMS)", (void*) o);
|
||||
o->oop_iterate(&oopCl);
|
||||
_out->print_cr("");
|
||||
if (print_it) {
|
||||
_out->print_cr(" "PTR_FORMAT"%s",
|
||||
o, (over_tams) ? " >" : (marked) ? " M" : "");
|
||||
PrintReachableOopClosure oopCl(_bitmap, _out, _use_prev_marking, _all);
|
||||
o->oop_iterate(&oopCl);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class RegionReachablePrinterClosure : public HeapRegionClosure {
|
||||
class PrintReachableRegionClosure : public HeapRegionClosure {
|
||||
private:
|
||||
CMBitMapRO* _bitmap;
|
||||
outputStream* _out;
|
||||
bool _use_prev_marking;
|
||||
bool _all;
|
||||
|
||||
public:
|
||||
bool doHeapRegion(HeapRegion* hr) {
|
||||
|
@ -2094,22 +2092,35 @@ public:
|
|||
}
|
||||
_out->print_cr("** ["PTR_FORMAT", "PTR_FORMAT"] top: "PTR_FORMAT" "
|
||||
"TAMS: "PTR_FORMAT, b, e, t, p);
|
||||
_out->print_cr("");
|
||||
_out->cr();
|
||||
|
||||
ObjInRegionReachablePrinterClosure ocl(_bitmap, _out, _use_prev_marking);
|
||||
hr->object_iterate_mem_careful(MemRegion(p, t), &ocl);
|
||||
HeapWord* from = b;
|
||||
HeapWord* to = t;
|
||||
|
||||
if (to > from) {
|
||||
_out->print_cr("Objects in ["PTR_FORMAT", "PTR_FORMAT"]", from, to);
|
||||
_out->cr();
|
||||
PrintReachableObjectClosure ocl(_bitmap, _out,
|
||||
_use_prev_marking, _all, hr);
|
||||
hr->object_iterate_mem_careful(MemRegion(from, to), &ocl);
|
||||
_out->cr();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
RegionReachablePrinterClosure(CMBitMapRO* bitmap,
|
||||
outputStream* out,
|
||||
bool use_prev_marking) :
|
||||
_bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking) { }
|
||||
PrintReachableRegionClosure(CMBitMapRO* bitmap,
|
||||
outputStream* out,
|
||||
bool use_prev_marking,
|
||||
bool all) :
|
||||
_bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking), _all(all) { }
|
||||
};
|
||||
|
||||
void ConcurrentMark::print_reachable(bool use_prev_marking, const char* str) {
|
||||
gclog_or_tty->print_cr("== Doing reachable object dump... ");
|
||||
void ConcurrentMark::print_reachable(const char* str,
|
||||
bool use_prev_marking,
|
||||
bool all) {
|
||||
gclog_or_tty->cr();
|
||||
gclog_or_tty->print_cr("== Doing heap dump... ");
|
||||
|
||||
if (G1PrintReachableBaseFile == NULL) {
|
||||
gclog_or_tty->print_cr(" #### error: no base file defined");
|
||||
|
@ -2144,19 +2155,14 @@ void ConcurrentMark::print_reachable(bool use_prev_marking, const char* str) {
|
|||
out->print_cr("-- USING %s", (use_prev_marking) ? "PTAMS" : "NTAMS");
|
||||
out->cr();
|
||||
|
||||
RegionReachablePrinterClosure rcl(bitmap, out, use_prev_marking);
|
||||
out->print_cr("--- ITERATING OVER REGIONS WITH TAMS < TOP");
|
||||
out->print_cr("--- ITERATING OVER REGIONS");
|
||||
out->cr();
|
||||
PrintReachableRegionClosure rcl(bitmap, out, use_prev_marking, all);
|
||||
_g1h->heap_region_iterate(&rcl);
|
||||
out->cr();
|
||||
|
||||
ReachablePrinterClosure cl(bitmap, out, use_prev_marking);
|
||||
out->print_cr("--- ITERATING OVER MARKED OBJECTS ON THE BITMAP");
|
||||
out->cr();
|
||||
bitmap->iterate(&cl);
|
||||
out->cr();
|
||||
|
||||
gclog_or_tty->print_cr(" done");
|
||||
gclog_or_tty->flush();
|
||||
}
|
||||
|
||||
#endif // PRODUCT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue