405 gc_task_manager()->execute_and_wait(q); |
405 gc_task_manager()->execute_and_wait(q); |
406 } |
406 } |
407 |
407 |
408 scavenge_midpoint.update(); |
408 scavenge_midpoint.update(); |
409 |
409 |
410 PSKeepAliveClosure keep_alive(promotion_manager); |
|
411 PSEvacuateFollowersClosure evac_followers(promotion_manager); |
|
412 |
|
413 // Process reference objects discovered during scavenge |
410 // Process reference objects discovered during scavenge |
414 { |
411 { |
415 GCTraceTime(Debug, gc, phases) tm("Reference Processing", &_gc_timer); |
412 GCTraceTime(Debug, gc, phases) tm("Reference Processing", &_gc_timer); |
416 |
413 |
417 reference_processor()->setup_policy(false); // not always_clear |
414 reference_processor()->setup_policy(false); // not always_clear |
418 reference_processor()->set_active_mt_degree(active_workers); |
415 reference_processor()->set_active_mt_degree(active_workers); |
|
416 PSKeepAliveClosure keep_alive(promotion_manager); |
|
417 PSEvacuateFollowersClosure evac_followers(promotion_manager); |
419 ReferenceProcessorStats stats; |
418 ReferenceProcessorStats stats; |
420 ReferenceProcessorPhaseTimes pt(&_gc_timer, reference_processor()->num_q()); |
419 ReferenceProcessorPhaseTimes pt(&_gc_timer, reference_processor()->num_q()); |
421 if (reference_processor()->processing_is_mt()) { |
420 if (reference_processor()->processing_is_mt()) { |
422 PSRefProcTaskExecutor task_executor; |
421 PSRefProcTaskExecutor task_executor; |
423 stats = reference_processor()->process_discovered_references( |
422 stats = reference_processor()->process_discovered_references( |
440 } |
439 } |
441 |
440 |
442 pt.print_enqueue_phase(); |
441 pt.print_enqueue_phase(); |
443 } |
442 } |
444 |
443 |
|
444 assert(promotion_manager->stacks_empty(),"stacks should be empty at this point"); |
|
445 |
|
446 PSScavengeRootsClosure root_closure(promotion_manager); |
|
447 |
445 { |
448 { |
446 GCTraceTime(Debug, gc, phases) tm("Weak Processing", &_gc_timer); |
449 GCTraceTime(Debug, gc, phases) tm("Weak Processing", &_gc_timer); |
447 WeakProcessor::weak_oops_do(&_is_alive_closure, &keep_alive, &evac_followers); |
450 WeakProcessor::weak_oops_do(&_is_alive_closure, &root_closure); |
448 } |
451 } |
449 |
452 |
450 { |
453 { |
451 GCTraceTime(Debug, gc, phases) tm("Scrub String Table", &_gc_timer); |
454 GCTraceTime(Debug, gc, phases) tm("Scrub String Table", &_gc_timer); |
452 // Unlink any dead interned Strings and process the remaining live ones. |
455 // Unlink any dead interned Strings and process the remaining live ones. |
453 PSScavengeRootsClosure root_closure(promotion_manager); |
|
454 StringTable::unlink_or_oops_do(&_is_alive_closure, &root_closure); |
456 StringTable::unlink_or_oops_do(&_is_alive_closure, &root_closure); |
455 } |
457 } |
|
458 |
|
459 // Verify that usage of root_closure didn't copy any objects. |
|
460 assert(promotion_manager->stacks_empty(),"stacks should be empty at this point"); |
456 |
461 |
457 // Finally, flush the promotion_manager's labs, and deallocate its stacks. |
462 // Finally, flush the promotion_manager's labs, and deallocate its stacks. |
458 promotion_failure_occurred = PSPromotionManager::post_scavenge(_gc_tracer); |
463 promotion_failure_occurred = PSPromotionManager::post_scavenge(_gc_tracer); |
459 if (promotion_failure_occurred) { |
464 if (promotion_failure_occurred) { |
460 clean_up_failed_promotion(); |
465 clean_up_failed_promotion(); |