comparison src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @ 1951:899bbbdcb6ea

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
author ysr
date Fri, 05 Nov 2010 13:20:37 -0700
parents 8b10f48633dc
children 4df7f8cba524
comparison
equal deleted inserted replaced
1891:9de67bf4244d 1951:899bbbdcb6ea
1091 // the main marking bitmap in the sweeping phase or, if it's a permanent 1091 // the main marking bitmap in the sweeping phase or, if it's a permanent
1092 // generation and we're not in the sweeping phase, by checking the 1092 // generation and we're not in the sweeping phase, by checking the
1093 // perm_gen_verify_bit_map where we store the "deadness" information if 1093 // perm_gen_verify_bit_map where we store the "deadness" information if
1094 // we did not sweep the perm gen in the most recent previous GC cycle. 1094 // we did not sweep the perm gen in the most recent previous GC cycle.
1095 bool CompactibleFreeListSpace::obj_is_alive(const HeapWord* p) const { 1095 bool CompactibleFreeListSpace::obj_is_alive(const HeapWord* p) const {
1096 assert (block_is_obj(p), "The address should point to an object"); 1096 assert(block_is_obj(p), "The address should point to an object");
1097 assert(SafepointSynchronize::is_at_safepoint(), "Else races are possible");
1097 1098
1098 // If we're sweeping, we use object liveness information from the main bit map 1099 // If we're sweeping, we use object liveness information from the main bit map
1099 // for both perm gen and old gen. 1100 // for both perm gen and old gen.
1100 // We don't need to lock the bitmap (live_map or dead_map below), because 1101 // We don't need to lock the bitmap (live_map or dead_map below), because
1101 // EITHER we are in the middle of the sweeping phase, and the 1102 // EITHER we are in the middle of the sweeping phase, and the
1102 // main marking bit map (live_map below) is locked, 1103 // main marking bit map (live_map below) is locked,
1103 // OR we're in other phases and perm_gen_verify_bit_map (dead_map below) 1104 // OR we're in other phases and perm_gen_verify_bit_map (dead_map below)
1104 // is stable, because it's mutated only in the sweeping phase. 1105 // is stable, because it's mutated only in the sweeping phase.
1106 // NOTE: This method is also used by jmap where, if class unloading is
1107 // off, the results can return "false" for legitimate perm objects,
1108 // when we are not in the midst of a sweeping phase, which can result
1109 // in jmap not reporting certain perm gen objects. This will be moot
1110 // if/when the perm gen goes away in the future.
1105 if (_collector->abstract_state() == CMSCollector::Sweeping) { 1111 if (_collector->abstract_state() == CMSCollector::Sweeping) {
1106 CMSBitMap* live_map = _collector->markBitMap(); 1112 CMSBitMap* live_map = _collector->markBitMap();
1107 return live_map->isMarked((HeapWord*) p); 1113 return live_map->par_isMarked((HeapWord*) p);
1108 } else { 1114 } else {
1109 // If we're not currently sweeping and we haven't swept the perm gen in 1115 // If we're not currently sweeping and we haven't swept the perm gen in
1110 // the previous concurrent cycle then we may have dead but unswept objects 1116 // the previous concurrent cycle then we may have dead but unswept objects
1111 // in the perm gen. In this case, we use the "deadness" information 1117 // in the perm gen. In this case, we use the "deadness" information
1112 // that we had saved in perm_gen_verify_bit_map at the last sweep. 1118 // that we had saved in perm_gen_verify_bit_map at the last sweep.