comparison src/share/vm/gc_implementation/parallelScavenge/psScavenge.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 850fdf70db2b
children 27a80744a83b
comparison
equal deleted inserted replaced
4:367525dcfbc2 5:8f42110e2a5b
328 328
329 NOT_PRODUCT(reference_processor()->verify_no_references_recorded()); 329 NOT_PRODUCT(reference_processor()->verify_no_references_recorded());
330 COMPILER2_PRESENT(DerivedPointerTable::clear()); 330 COMPILER2_PRESENT(DerivedPointerTable::clear());
331 331
332 reference_processor()->enable_discovery(); 332 reference_processor()->enable_discovery();
333 reference_processor()->snap_policy(false);
333 334
334 // We track how much was promoted to the next generation for 335 // We track how much was promoted to the next generation for
335 // the AdaptiveSizePolicy. 336 // the AdaptiveSizePolicy.
336 size_t old_gen_used_before = old_gen->used_in_bytes(); 337 size_t old_gen_used_before = old_gen->used_in_bytes();
337 338
392 393
393 scavenge_midpoint.update(); 394 scavenge_midpoint.update();
394 395
395 // Process reference objects discovered during scavenge 396 // Process reference objects discovered during scavenge
396 { 397 {
397 #ifdef COMPILER2 398 reference_processor()->snap_policy(false); // not always_clear
398 ReferencePolicy *soft_ref_policy = new LRUMaxHeapPolicy();
399 #else
400 ReferencePolicy *soft_ref_policy = new LRUCurrentHeapPolicy();
401 #endif // COMPILER2
402
403 PSKeepAliveClosure keep_alive(promotion_manager); 399 PSKeepAliveClosure keep_alive(promotion_manager);
404 PSEvacuateFollowersClosure evac_followers(promotion_manager); 400 PSEvacuateFollowersClosure evac_followers(promotion_manager);
405 assert(soft_ref_policy != NULL,"No soft reference policy");
406 if (reference_processor()->processing_is_mt()) { 401 if (reference_processor()->processing_is_mt()) {
407 PSRefProcTaskExecutor task_executor; 402 PSRefProcTaskExecutor task_executor;
408 reference_processor()->process_discovered_references( 403 reference_processor()->process_discovered_references(
409 soft_ref_policy, &_is_alive_closure, &keep_alive, &evac_followers, 404 &_is_alive_closure, &keep_alive, &evac_followers, &task_executor);
410 &task_executor);
411 } else { 405 } else {
412 reference_processor()->process_discovered_references( 406 reference_processor()->process_discovered_references(
413 soft_ref_policy, &_is_alive_closure, &keep_alive, &evac_followers, 407 &_is_alive_closure, &keep_alive, &evac_followers, NULL);
414 NULL);
415 } 408 }
416 } 409 }
417 410
418 // Enqueue reference objects discovered during scavenge. 411 // Enqueue reference objects discovered during scavenge.
419 if (reference_processor()->processing_is_mt()) { 412 if (reference_processor()->processing_is_mt()) {