Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.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 | 0166ac265d53 |
children | 27a80744a83b |
comparison
equal
deleted
inserted
replaced
452:00b023ae2d78 | 453:c96030fff130 |
---|---|
1576 | 1576 |
1577 NOT_PRODUCT(ref_processor()->verify_no_references_recorded()); | 1577 NOT_PRODUCT(ref_processor()->verify_no_references_recorded()); |
1578 COMPILER2_PRESENT(DerivedPointerTable::clear()); | 1578 COMPILER2_PRESENT(DerivedPointerTable::clear()); |
1579 | 1579 |
1580 ref_processor()->enable_discovery(); | 1580 ref_processor()->enable_discovery(); |
1581 ref_processor()->snap_policy(maximum_heap_compaction); | |
1581 | 1582 |
1582 bool marked_for_unloading = false; | 1583 bool marked_for_unloading = false; |
1583 | 1584 |
1584 marking_start.update(); | 1585 marking_start.update(); |
1585 marking_phase(vmthread_cm, maximum_heap_compaction); | 1586 marking_phase(vmthread_cm, maximum_heap_compaction); |
1892 } | 1893 } |
1893 | 1894 |
1894 // Process reference objects found during marking | 1895 // Process reference objects found during marking |
1895 { | 1896 { |
1896 TraceTime tm_r("reference processing", print_phases(), true, gclog_or_tty); | 1897 TraceTime tm_r("reference processing", print_phases(), true, gclog_or_tty); |
1897 ReferencePolicy *soft_ref_policy; | |
1898 if (maximum_heap_compaction) { | |
1899 soft_ref_policy = new AlwaysClearPolicy(); | |
1900 } else { | |
1901 #ifdef COMPILER2 | |
1902 soft_ref_policy = new LRUMaxHeapPolicy(); | |
1903 #else | |
1904 soft_ref_policy = new LRUCurrentHeapPolicy(); | |
1905 #endif // COMPILER2 | |
1906 } | |
1907 assert(soft_ref_policy != NULL, "No soft reference policy"); | |
1908 if (ref_processor()->processing_is_mt()) { | 1898 if (ref_processor()->processing_is_mt()) { |
1909 RefProcTaskExecutor task_executor; | 1899 RefProcTaskExecutor task_executor; |
1910 ref_processor()->process_discovered_references( | 1900 ref_processor()->process_discovered_references( |
1911 soft_ref_policy, is_alive_closure(), &mark_and_push_closure, | 1901 is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, |
1912 &follow_stack_closure, &task_executor); | 1902 &task_executor); |
1913 } else { | 1903 } else { |
1914 ref_processor()->process_discovered_references( | 1904 ref_processor()->process_discovered_references( |
1915 soft_ref_policy, is_alive_closure(), &mark_and_push_closure, | 1905 is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, NULL); |
1916 &follow_stack_closure, NULL); | |
1917 } | 1906 } |
1918 } | 1907 } |
1919 | 1908 |
1920 TraceTime tm_c("class unloading", print_phases(), true, gclog_or_tty); | 1909 TraceTime tm_c("class unloading", print_phases(), true, gclog_or_tty); |
1921 // Follow system dictionary roots and unload classes. | 1910 // Follow system dictionary roots and unload classes. |