Mercurial > hg > truffle
comparison src/share/vm/memory/defNewGeneration.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 | 1ee8caae33af |
children | 27a80744a83b |
comparison
equal
deleted
inserted
replaced
452:00b023ae2d78 | 453:c96030fff130 |
---|---|
538 gch->rem_set()->prepare_for_younger_refs_iterate(false); | 538 gch->rem_set()->prepare_for_younger_refs_iterate(false); |
539 | 539 |
540 assert(gch->no_allocs_since_save_marks(0), | 540 assert(gch->no_allocs_since_save_marks(0), |
541 "save marks have not been newly set."); | 541 "save marks have not been newly set."); |
542 | 542 |
543 // Weak refs. | |
544 // FIXME: Are these storage leaks, or are they resource objects? | |
545 #ifdef COMPILER2 | |
546 ReferencePolicy *soft_ref_policy = new LRUMaxHeapPolicy(); | |
547 #else | |
548 ReferencePolicy *soft_ref_policy = new LRUCurrentHeapPolicy(); | |
549 #endif // COMPILER2 | |
550 | |
551 // Not very pretty. | 543 // Not very pretty. |
552 CollectorPolicy* cp = gch->collector_policy(); | 544 CollectorPolicy* cp = gch->collector_policy(); |
553 | 545 |
554 FastScanClosure fsc_with_no_gc_barrier(this, false); | 546 FastScanClosure fsc_with_no_gc_barrier(this, false); |
555 FastScanClosure fsc_with_gc_barrier(this, true); | 547 FastScanClosure fsc_with_gc_barrier(this, true); |
572 | 564 |
573 // "evacuate followers". | 565 // "evacuate followers". |
574 evacuate_followers.do_void(); | 566 evacuate_followers.do_void(); |
575 | 567 |
576 FastKeepAliveClosure keep_alive(this, &scan_weak_ref); | 568 FastKeepAliveClosure keep_alive(this, &scan_weak_ref); |
577 ref_processor()->process_discovered_references( | 569 ReferenceProcessor* rp = ref_processor(); |
578 soft_ref_policy, &is_alive, &keep_alive, &evacuate_followers, NULL); | 570 rp->snap_policy(clear_all_soft_refs); |
571 rp->process_discovered_references(&is_alive, &keep_alive, &evacuate_followers, | |
572 NULL); | |
579 if (!promotion_failed()) { | 573 if (!promotion_failed()) { |
580 // Swap the survivor spaces. | 574 // Swap the survivor spaces. |
581 eden()->clear(SpaceDecorator::Mangle); | 575 eden()->clear(SpaceDecorator::Mangle); |
582 from()->clear(SpaceDecorator::Mangle); | 576 from()->clear(SpaceDecorator::Mangle); |
583 if (ZapUnusedHeapArea) { | 577 if (ZapUnusedHeapArea) { |