src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
Print this page
@@ -760,38 +760,29 @@
thread_state_set.pops()+thread_state_set.steals());
}
assert(thread_state_set.pushes() == thread_state_set.pops() + thread_state_set.steals(),
"Or else the queues are leaky.");
- // For now, process discovered weak refs sequentially.
-#ifdef COMPILER2
- ReferencePolicy *soft_ref_policy = new LRUMaxHeapPolicy();
-#else
- ReferencePolicy *soft_ref_policy = new LRUCurrentHeapPolicy();
-#endif // COMPILER2
-
// Process (weak) reference objects found during scavenge.
+ ReferenceProcessor* rp = ref_processor();
IsAliveClosure is_alive(this);
ScanWeakRefClosure scan_weak_ref(this);
KeepAliveClosure keep_alive(&scan_weak_ref);
ScanClosure scan_without_gc_barrier(this, false);
ScanClosureWithParBarrier scan_with_gc_barrier(this, true);
set_promo_failure_scan_stack_closure(&scan_without_gc_barrier);
EvacuateFollowersClosureGeneral evacuate_followers(gch, _level,
&scan_without_gc_barrier, &scan_with_gc_barrier);
- if (ref_processor()->processing_is_mt()) {
+ rp->snap_policy(clear_all_soft_refs);
+ if (rp->processing_is_mt()) {
ParNewRefProcTaskExecutor task_executor(*this, thread_state_set);
- ref_processor()->process_discovered_references(
- soft_ref_policy, &is_alive, &keep_alive, &evacuate_followers,
- &task_executor);
+ rp->process_discovered_references(&is_alive, &keep_alive, &evacuate_followers, &task_executor);
} else {
thread_state_set.flush();
gch->set_par_threads(0); // 0 ==> non-parallel.
gch->save_marks();
- ref_processor()->process_discovered_references(
- soft_ref_policy, &is_alive, &keep_alive, &evacuate_followers,
- NULL);
+ rp->process_discovered_references(&is_alive, &keep_alive, &evacuate_followers, NULL);
}
if (!promotion_failed()) {
// Swap the survivor spaces.
eden()->clear(SpaceDecorator::Mangle);
from()->clear(SpaceDecorator::Mangle);
@@ -849,18 +840,18 @@
update_time_of_last_gc(os::javaTimeMillis());
SpecializationStats::print();
- ref_processor()->set_enqueuing_is_done(true);
- if (ref_processor()->processing_is_mt()) {
+ rp->set_enqueuing_is_done(true);
+ if (rp->processing_is_mt()) {
ParNewRefProcTaskExecutor task_executor(*this, thread_state_set);
- ref_processor()->enqueue_discovered_references(&task_executor);
+ rp->enqueue_discovered_references(&task_executor);
} else {
- ref_processor()->enqueue_discovered_references(NULL);
+ rp->enqueue_discovered_references(NULL);
}
- ref_processor()->verify_no_references_recorded();
+ rp->verify_no_references_recorded();
}
static int sum;
void ParNewGeneration::waste_some_time() {
for (int i = 0; i < 100; i++) {