2270 2271 #if defined(COMPILER2) || INCLUDE_JVMCI 2272 DerivedPointerTableDeactivate dpt_deact; 2273 #endif 2274 2275 // Clear any marks from a previous round 2276 verification_mark_bm()->clear_all(); 2277 assert(verification_mark_stack()->isEmpty(), "markStack should be empty"); 2278 verify_work_stacks_empty(); 2279 2280 GenCollectedHeap* gch = GenCollectedHeap::heap(); 2281 gch->ensure_parsability(false); // fill TLABs, but no need to retire them 2282 // Update the saved marks which may affect the root scans. 2283 gch->save_marks(); 2284 2285 if (CMSRemarkVerifyVariant == 1) { 2286 // In this first variant of verification, we complete 2287 // all marking, then check if the new marks-vector is 2288 // a subset of the CMS marks-vector. 2289 verify_after_remark_work_1(); 2290 } else if (CMSRemarkVerifyVariant == 2) { 2291 // In this second variant of verification, we flag an error 2292 // (i.e. an object reachable in the new marks-vector not reachable 2293 // in the CMS marks-vector) immediately, also indicating the 2294 // identify of an object (A) that references the unmarked object (B) -- 2295 // presumably, a mutation to A failed to be picked up by preclean/remark? 2296 verify_after_remark_work_2(); 2297 } else { 2298 warning("Unrecognized value " UINTX_FORMAT " for CMSRemarkVerifyVariant", 2299 CMSRemarkVerifyVariant); 2300 } 2301 return true; 2302 } 2303 2304 void CMSCollector::verify_after_remark_work_1() { 2305 ResourceMark rm; 2306 HandleMark hm; 2307 GenCollectedHeap* gch = GenCollectedHeap::heap(); 2308 2309 // Get a clear set of claim bits for the roots processing to work with. 2310 ClassLoaderDataGraph::clear_claimed_marks(); 2311 2312 // Mark from roots one level into CMS 2313 MarkRefsIntoClosure notOlder(_span, verification_mark_bm()); 2314 gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. 2315 2316 { 2317 StrongRootsScope srs(1); 2318 2319 gch->gen_process_roots(&srs, 2320 GenCollectedHeap::OldGen, | 2270 2271 #if defined(COMPILER2) || INCLUDE_JVMCI 2272 DerivedPointerTableDeactivate dpt_deact; 2273 #endif 2274 2275 // Clear any marks from a previous round 2276 verification_mark_bm()->clear_all(); 2277 assert(verification_mark_stack()->isEmpty(), "markStack should be empty"); 2278 verify_work_stacks_empty(); 2279 2280 GenCollectedHeap* gch = GenCollectedHeap::heap(); 2281 gch->ensure_parsability(false); // fill TLABs, but no need to retire them 2282 // Update the saved marks which may affect the root scans. 2283 gch->save_marks(); 2284 2285 if (CMSRemarkVerifyVariant == 1) { 2286 // In this first variant of verification, we complete 2287 // all marking, then check if the new marks-vector is 2288 // a subset of the CMS marks-vector. 2289 verify_after_remark_work_1(); 2290 } else { 2291 guarantee(CMSRemarkVerifyVariant == 2, "Range checking for CMSRemarkVerifyVariant should guarantee 1 or 2"); 2292 // In this second variant of verification, we flag an error 2293 // (i.e. an object reachable in the new marks-vector not reachable 2294 // in the CMS marks-vector) immediately, also indicating the 2295 // identify of an object (A) that references the unmarked object (B) -- 2296 // presumably, a mutation to A failed to be picked up by preclean/remark? 2297 verify_after_remark_work_2(); 2298 } 2299 2300 return true; 2301 } 2302 2303 void CMSCollector::verify_after_remark_work_1() { 2304 ResourceMark rm; 2305 HandleMark hm; 2306 GenCollectedHeap* gch = GenCollectedHeap::heap(); 2307 2308 // Get a clear set of claim bits for the roots processing to work with. 2309 ClassLoaderDataGraph::clear_claimed_marks(); 2310 2311 // Mark from roots one level into CMS 2312 MarkRefsIntoClosure notOlder(_span, verification_mark_bm()); 2313 gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. 2314 2315 { 2316 StrongRootsScope srs(1); 2317 2318 gch->gen_process_roots(&srs, 2319 GenCollectedHeap::OldGen, |