comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 3293:1f4413413144

7039089: G1: changeset for 7037276 broke heap verification, and related cleanups Summary: In G1 heap verification, we no longer scan perm to G1-collected heap refs as part of process_strong_roots() but rather in a separate explicit oop iteration over the perm gen. This preserves the original perm card-marks. Added a new assertion in younger_refs_iterate() to catch a simple subcase where the user may have forgotten a prior save_marks() call, as happened in the case of G1's attempt to iterate perm to G1 refs when verifying the heap before exit. The assert was deliberately weakened for ParNew+CMS and will be fixed for that combination in a future CR. Also made some (non-G1) cleanups related to code and comments obsoleted by the migration of Symbols to the native heap. Reviewed-by: iveresov, jmasa, tonyp
author ysr
date Tue, 26 Apr 2011 21:17:24 -0700
parents b52782ae3880
children 063382f9b575
comparison
equal deleted inserted replaced
3292:c303b3532d4a 3293:1f4413413144
2803 2803
2804 void G1CollectedHeap::verify(bool allow_dirty, 2804 void G1CollectedHeap::verify(bool allow_dirty,
2805 bool silent, 2805 bool silent,
2806 bool use_prev_marking) { 2806 bool use_prev_marking) {
2807 if (SafepointSynchronize::is_at_safepoint() || ! UseTLAB) { 2807 if (SafepointSynchronize::is_at_safepoint() || ! UseTLAB) {
2808 if (!silent) { gclog_or_tty->print("roots "); } 2808 if (!silent) { gclog_or_tty->print("Roots (excluding permgen) "); }
2809 VerifyRootsClosure rootsCl(use_prev_marking); 2809 VerifyRootsClosure rootsCl(use_prev_marking);
2810 CodeBlobToOopClosure blobsCl(&rootsCl, /*do_marking=*/ false); 2810 CodeBlobToOopClosure blobsCl(&rootsCl, /*do_marking=*/ false);
2811 process_strong_roots(true, // activate StrongRootsScope 2811 // We apply the relevant closures to all the oops in the
2812 false, 2812 // system dictionary, the string table and the code cache.
2813 SharedHeap::SO_AllClasses, 2813 const int so = SharedHeap::SO_AllClasses | SharedHeap::SO_Strings | SharedHeap::SO_CodeCache;
2814 process_strong_roots(true, // activate StrongRootsScope
2815 true, // we set "collecting perm gen" to true,
2816 // so we don't reset the dirty cards in the perm gen.
2817 SharedHeap::ScanningOption(so), // roots scanning options
2814 &rootsCl, 2818 &rootsCl,
2815 &blobsCl, 2819 &blobsCl,
2816 &rootsCl); 2820 &rootsCl);
2821 // Since we used "collecting_perm_gen" == true above, we will not have
2822 // checked the refs from perm into the G1-collected heap. We check those
2823 // references explicitly below. Whether the relevant cards are dirty
2824 // is checked further below in the rem set verification.
2825 if (!silent) { gclog_or_tty->print("Permgen roots "); }
2826 perm_gen()->oop_iterate(&rootsCl);
2817 bool failures = rootsCl.failures(); 2827 bool failures = rootsCl.failures();
2818 rem_set()->invalidate(perm_gen()->used_region(), false);
2819 if (!silent) { gclog_or_tty->print("HeapRegionSets "); } 2828 if (!silent) { gclog_or_tty->print("HeapRegionSets "); }
2820 verify_region_sets(); 2829 verify_region_sets();
2821 if (!silent) { gclog_or_tty->print("HeapRegions "); } 2830 if (!silent) { gclog_or_tty->print("HeapRegions "); }
2822 if (GCParallelVerificationEnabled && ParallelGCThreads > 1) { 2831 if (GCParallelVerificationEnabled && ParallelGCThreads > 1) {
2823 assert(check_heap_region_claim_values(HeapRegion::InitialClaimValue), 2832 assert(check_heap_region_claim_values(HeapRegion::InitialClaimValue),