comparison src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @ 3772:6747fd0512e0

7004681: G1: Extend marking verification to Full GCs Summary: Perform a heap verification after the first phase of G1's full GC using objects' mark words to determine liveness. The third parameter of the heap verification routines, which was used in G1 to determine which marking bitmap to use in liveness calculations, has been changed from a boolean to an enum with values defined for using the mark word, and the 'prev' and 'next' bitmaps. Reviewed-by: tonyp, ysr
author johnc
date Tue, 14 Jun 2011 11:01:10 -0700
parents 1216415d8e35
children 4dfb2df418f2
comparison
equal deleted inserted replaced
3771:842b840e67db 3772:6747fd0512e0
82 // The marking doesn't preserve the marks of biased objects. 82 // The marking doesn't preserve the marks of biased objects.
83 BiasedLocking::preserve_marks(); 83 BiasedLocking::preserve_marks();
84 84
85 mark_sweep_phase1(marked_for_unloading, clear_all_softrefs); 85 mark_sweep_phase1(marked_for_unloading, clear_all_softrefs);
86 86
87 if (VerifyDuringGC) {
88 G1CollectedHeap* g1h = G1CollectedHeap::heap();
89 g1h->checkConcurrentMark();
90 }
91
92 mark_sweep_phase2(); 87 mark_sweep_phase2();
93 88
94 // Don't add any more derived pointers during phase3 89 // Don't add any more derived pointers during phase3
95 COMPILER2_PRESENT(DerivedPointerTable::set_active(false)); 90 COMPILER2_PRESENT(DerivedPointerTable::set_active(false));
96 91
177 // Clean up unreferenced symbols in symbol table. 172 // Clean up unreferenced symbols in symbol table.
178 SymbolTable::unlink(); 173 SymbolTable::unlink();
179 174
180 assert(GenMarkSweep::_marking_stack.is_empty(), 175 assert(GenMarkSweep::_marking_stack.is_empty(),
181 "stack should be empty by now"); 176 "stack should be empty by now");
177
178 if (VerifyDuringGC) {
179 HandleMark hm; // handle scope
180 COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact);
181 gclog_or_tty->print(" VerifyDuringGC:(full)[Verifying ");
182 Universe::heap()->prepare_for_verify();
183 // Note: we can verify only the heap here. When an object is
184 // marked, the previous value of the mark word (including
185 // identity hash values, ages, etc) is preserved, and the mark
186 // word is set to markOop::marked_value - effectively removing
187 // any hash values from the mark word. These hash values are
188 // used when verifying the dictionaries and so removing them
189 // from the mark word can make verification of the dictionaries
190 // fail. At the end of the GC, the orginal mark word values
191 // (including hash values) are restored to the appropriate
192 // objects.
193 Universe::heap()->verify(/* allow dirty */ true,
194 /* silent */ false,
195 /* option */ VerifyOption_G1UseMarkWord);
196
197 G1CollectedHeap* g1h = G1CollectedHeap::heap();
198 gclog_or_tty->print_cr("]");
199 }
182 } 200 }
183 201
184 class G1PrepareCompactClosure: public HeapRegionClosure { 202 class G1PrepareCompactClosure: public HeapRegionClosure {
185 G1CollectedHeap* _g1h; 203 G1CollectedHeap* _g1h;
186 ModRefBarrierSet* _mrbs; 204 ModRefBarrierSet* _mrbs;