6684579: SoftReference processing can be made more efficient

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
This commit is contained in:
Y. Srinivas Ramakrishna 2008-11-20 16:56:09 -08:00
parent db6bef2c70
commit 7d7cf3f8af
18 changed files with 137 additions and 164 deletions

View file

@ -540,14 +540,6 @@ void DefNewGeneration::collect(bool full,
assert(gch->no_allocs_since_save_marks(0),
"save marks have not been newly set.");
// Weak refs.
// FIXME: Are these storage leaks, or are they resource objects?
#ifdef COMPILER2
ReferencePolicy *soft_ref_policy = new LRUMaxHeapPolicy();
#else
ReferencePolicy *soft_ref_policy = new LRUCurrentHeapPolicy();
#endif // COMPILER2
// Not very pretty.
CollectorPolicy* cp = gch->collector_policy();
@ -574,8 +566,10 @@ void DefNewGeneration::collect(bool full,
evacuate_followers.do_void();
FastKeepAliveClosure keep_alive(this, &scan_weak_ref);
ref_processor()->process_discovered_references(
soft_ref_policy, &is_alive, &keep_alive, &evacuate_followers, NULL);
ReferenceProcessor* rp = ref_processor();
rp->snap_policy(clear_all_soft_refs);
rp->process_discovered_references(&is_alive, &keep_alive, &evacuate_followers,
NULL);
if (!promotion_failed()) {
// Swap the survivor spaces.
eden()->clear(SpaceDecorator::Mangle);