Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp @ 453:c96030fff130
6684579: SoftReference processing can be made more efficient
Summary: For current soft-ref clearing policies, we can decide at marking time if a soft-reference will definitely not be cleared, postponing the decision of whether it will definitely be cleared to the final reference processing phase. This can be especially beneficial in the case of concurrent collectors where the marking is usually concurrent but reference processing is usually not.
Reviewed-by: jmasa
author | ysr |
---|---|
date | Thu, 20 Nov 2008 16:56:09 -0800 |
parents | eb28cf662f56 |
children | 27a80744a83b |
comparison
equal
deleted
inserted
replaced
452:00b023ae2d78 | 453:c96030fff130 |
---|---|
170 | 170 |
171 NOT_PRODUCT(ref_processor()->verify_no_references_recorded()); | 171 NOT_PRODUCT(ref_processor()->verify_no_references_recorded()); |
172 COMPILER2_PRESENT(DerivedPointerTable::clear()); | 172 COMPILER2_PRESENT(DerivedPointerTable::clear()); |
173 | 173 |
174 ref_processor()->enable_discovery(); | 174 ref_processor()->enable_discovery(); |
175 ref_processor()->snap_policy(clear_all_softrefs); | |
175 | 176 |
176 mark_sweep_phase1(clear_all_softrefs); | 177 mark_sweep_phase1(clear_all_softrefs); |
177 | 178 |
178 mark_sweep_phase2(); | 179 mark_sweep_phase2(); |
179 | 180 |
515 // Flush marking stack. | 516 // Flush marking stack. |
516 follow_stack(); | 517 follow_stack(); |
517 | 518 |
518 // Process reference objects found during marking | 519 // Process reference objects found during marking |
519 { | 520 { |
520 ReferencePolicy *soft_ref_policy; | 521 ref_processor()->snap_policy(clear_all_softrefs); |
521 if (clear_all_softrefs) { | |
522 soft_ref_policy = new AlwaysClearPolicy(); | |
523 } else { | |
524 #ifdef COMPILER2 | |
525 soft_ref_policy = new LRUMaxHeapPolicy(); | |
526 #else | |
527 soft_ref_policy = new LRUCurrentHeapPolicy(); | |
528 #endif // COMPILER2 | |
529 } | |
530 assert(soft_ref_policy != NULL,"No soft reference policy"); | |
531 ref_processor()->process_discovered_references( | 522 ref_processor()->process_discovered_references( |
532 soft_ref_policy, is_alive_closure(), mark_and_push_closure(), | 523 is_alive_closure(), mark_and_push_closure(), follow_stack_closure(), NULL); |
533 follow_stack_closure(), NULL); | |
534 } | 524 } |
535 | 525 |
536 // Follow system dictionary roots and unload classes | 526 // Follow system dictionary roots and unload classes |
537 bool purged_class = SystemDictionary::do_unloading(is_alive_closure()); | 527 bool purged_class = SystemDictionary::do_unloading(is_alive_closure()); |
538 | 528 |