提交 385dacb7 编写于 作者: Y ysr

6997298: fatal error: must own lock CMS_markBitMap_lock during heap dump

Summary: Since we are at a stop-world pause, the existing CMS-phase checks are sufficient for safety, and the locking check can be safely elided. Elaborated documentation comment to the case where class unloading and verification are disabled, and the query happens when we aren't in the sweeping phase, where the answer "false" would be (almost everywhere) too pessimistic.
Reviewed-by: jmasa, johnc, tonyp
上级 555f46d6
......@@ -1093,7 +1093,8 @@ bool CompactibleFreeListSpace::block_is_obj(const HeapWord* p) const {
// perm_gen_verify_bit_map where we store the "deadness" information if
// we did not sweep the perm gen in the most recent previous GC cycle.
bool CompactibleFreeListSpace::obj_is_alive(const HeapWord* p) const {
assert (block_is_obj(p), "The address should point to an object");
assert(block_is_obj(p), "The address should point to an object");
assert(SafepointSynchronize::is_at_safepoint(), "Else races are possible");
// If we're sweeping, we use object liveness information from the main bit map
// for both perm gen and old gen.
......@@ -1102,9 +1103,14 @@ bool CompactibleFreeListSpace::obj_is_alive(const HeapWord* p) const {
// main marking bit map (live_map below) is locked,
// OR we're in other phases and perm_gen_verify_bit_map (dead_map below)
// is stable, because it's mutated only in the sweeping phase.
// NOTE: This method is also used by jmap where, if class unloading is
// off, the results can return "false" for legitimate perm objects,
// when we are not in the midst of a sweeping phase, which can result
// in jmap not reporting certain perm gen objects. This will be moot
// if/when the perm gen goes away in the future.
if (_collector->abstract_state() == CMSCollector::Sweeping) {
CMSBitMap* live_map = _collector->markBitMap();
return live_map->isMarked((HeapWord*) p);
return live_map->par_isMarked((HeapWord*) p);
} else {
// If we're not currently sweeping and we haven't swept the perm gen in
// the previous concurrent cycle then we may have dead but unswept objects
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册