--- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Tue Jun 14 10:33:43 2011 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Tue Jun 14 11:01:10 2011 -0700
@@ -84,11 +84,6 @@
mark_sweep_phase1(marked_for_unloading, clear_all_softrefs);
- if (VerifyDuringGC) {
- G1CollectedHeap* g1h = G1CollectedHeap::heap();
- g1h->checkConcurrentMark();
- }
-
mark_sweep_phase2();
// Don't add any more derived pointers during phase3
@@ -179,6 +174,29 @@
assert(GenMarkSweep::_marking_stack.is_empty(),
"stack should be empty by now");
+
+ if (VerifyDuringGC) {
+ HandleMark hm; // handle scope
+ COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact);
+ gclog_or_tty->print(" VerifyDuringGC:(full)[Verifying ");
+ Universe::heap()->prepare_for_verify();
+ // Note: we can verify only the heap here. When an object is
+ // marked, the previous value of the mark word (including
+ // identity hash values, ages, etc) is preserved, and the mark
+ // word is set to markOop::marked_value - effectively removing
+ // any hash values from the mark word. These hash values are
+ // used when verifying the dictionaries and so removing them
+ // from the mark word can make verification of the dictionaries
+ // fail. At the end of the GC, the orginal mark word values
+ // (including hash values) are restored to the appropriate
+ // objects.
+ Universe::heap()->verify(/* allow dirty */ true,
+ /* silent */ false,
+ /* option */ VerifyOption_G1UseMarkWord);
+
+ G1CollectedHeap* g1h = G1CollectedHeap::heap();
+ gclog_or_tty->print_cr("]");
+ }
}
class G1PrepareCompactClosure: public HeapRegionClosure {