Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @ 20804:7848fc12602b
Merge with jdk8u40-b25
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Tue, 07 Apr 2015 14:58:49 +0200 |
parents | 52b4284cb496 b840813adfcc |
children |
comparison
equal
deleted
inserted
replaced
20184:84105dcdb05b | 20804:7848fc12602b |
---|---|
453 if (adaptive_young_list_length()) { | 453 if (adaptive_young_list_length()) { |
454 _young_list_fixed_length = 0; | 454 _young_list_fixed_length = 0; |
455 } else { | 455 } else { |
456 _young_list_fixed_length = _young_gen_sizer->min_desired_young_length(); | 456 _young_list_fixed_length = _young_gen_sizer->min_desired_young_length(); |
457 } | 457 } |
458 _free_regions_at_end_of_collection = _g1->free_regions(); | 458 _free_regions_at_end_of_collection = _g1->num_free_regions(); |
459 update_young_list_target_length(); | 459 update_young_list_target_length(); |
460 | 460 |
461 // We may immediately start allocating regions and placing them on the | 461 // We may immediately start allocating regions and placing them on the |
462 // collection set list. Initialize the per-collection set info | 462 // collection set list. Initialize the per-collection set info |
463 start_incremental_cset_building(); | 463 start_incremental_cset_building(); |
826 _short_lived_surv_rate_group->start_adding_regions(); | 826 _short_lived_surv_rate_group->start_adding_regions(); |
827 // also call this on any additional surv rate groups | 827 // also call this on any additional surv rate groups |
828 | 828 |
829 record_survivor_regions(0, NULL, NULL); | 829 record_survivor_regions(0, NULL, NULL); |
830 | 830 |
831 _free_regions_at_end_of_collection = _g1->free_regions(); | 831 _free_regions_at_end_of_collection = _g1->num_free_regions(); |
832 // Reset survivors SurvRateGroup. | 832 // Reset survivors SurvRateGroup. |
833 _survivor_surv_rate_group->reset(); | 833 _survivor_surv_rate_group->reset(); |
834 update_young_list_target_length(); | 834 update_young_list_target_length(); |
835 _collectionSetChooser->clear(); | 835 _collectionSetChooser->clear(); |
836 } | 836 } |
1044 } | 1044 } |
1045 } | 1045 } |
1046 | 1046 |
1047 bool new_in_marking_window = _in_marking_window; | 1047 bool new_in_marking_window = _in_marking_window; |
1048 bool new_in_marking_window_im = false; | 1048 bool new_in_marking_window_im = false; |
1049 if (during_initial_mark_pause()) { | 1049 if (last_pause_included_initial_mark) { |
1050 new_in_marking_window = true; | 1050 new_in_marking_window = true; |
1051 new_in_marking_window_im = true; | 1051 new_in_marking_window_im = true; |
1052 } | 1052 } |
1053 | 1053 |
1054 if (_last_young_gc) { | 1054 if (_last_young_gc) { |
1178 _rs_lengths_seq->add((double) _max_rs_lengths); | 1178 _rs_lengths_seq->add((double) _max_rs_lengths); |
1179 } | 1179 } |
1180 | 1180 |
1181 _in_marking_window = new_in_marking_window; | 1181 _in_marking_window = new_in_marking_window; |
1182 _in_marking_window_im = new_in_marking_window_im; | 1182 _in_marking_window_im = new_in_marking_window_im; |
1183 _free_regions_at_end_of_collection = _g1->free_regions(); | 1183 _free_regions_at_end_of_collection = _g1->num_free_regions(); |
1184 update_young_list_target_length(); | 1184 update_young_list_target_length(); |
1185 | 1185 |
1186 // Note that _mmu_tracker->max_gc_time() returns the time in seconds. | 1186 // Note that _mmu_tracker->max_gc_time() returns the time in seconds. |
1187 double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0; | 1187 double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0; |
1188 adjust_concurrent_refinement(phase_times()->average_last_update_rs_time(), | 1188 adjust_concurrent_refinement(phase_times()->average_last_update_rs_time(), |
1200 YoungList* young_list = _g1->young_list(); | 1200 YoungList* young_list = _g1->young_list(); |
1201 _eden_used_bytes_before_gc = young_list->eden_used_bytes(); | 1201 _eden_used_bytes_before_gc = young_list->eden_used_bytes(); |
1202 _survivor_used_bytes_before_gc = young_list->survivor_used_bytes(); | 1202 _survivor_used_bytes_before_gc = young_list->survivor_used_bytes(); |
1203 _heap_capacity_bytes_before_gc = _g1->capacity(); | 1203 _heap_capacity_bytes_before_gc = _g1->capacity(); |
1204 _heap_used_bytes_before_gc = _g1->used(); | 1204 _heap_used_bytes_before_gc = _g1->used(); |
1205 _cur_collection_pause_used_regions_at_start = _g1->used_regions(); | 1205 _cur_collection_pause_used_regions_at_start = _g1->num_used_regions(); |
1206 | 1206 |
1207 _eden_capacity_bytes_before_gc = | 1207 _eden_capacity_bytes_before_gc = |
1208 (_young_list_target_length * HeapRegion::GrainBytes) - _survivor_used_bytes_before_gc; | 1208 (_young_list_target_length * HeapRegion::GrainBytes) - _survivor_used_bytes_before_gc; |
1209 | 1209 |
1210 if (full) { | 1210 if (full) { |
1421 void G1CollectorPolicy::print_yg_surv_rate_info() const { | 1421 void G1CollectorPolicy::print_yg_surv_rate_info() const { |
1422 #ifndef PRODUCT | 1422 #ifndef PRODUCT |
1423 _short_lived_surv_rate_group->print_surv_rate_summary(); | 1423 _short_lived_surv_rate_group->print_surv_rate_summary(); |
1424 // add this call for any other surv rate groups | 1424 // add this call for any other surv rate groups |
1425 #endif // PRODUCT | 1425 #endif // PRODUCT |
1426 } | |
1427 | |
1428 bool G1CollectorPolicy::is_young_list_full() { | |
1429 uint young_list_length = _g1->young_list()->length(); | |
1430 uint young_list_target_length = _young_list_target_length; | |
1431 return young_list_length >= young_list_target_length; | |
1432 } | |
1433 | |
1434 bool G1CollectorPolicy::can_expand_young_list() { | |
1435 uint young_list_length = _g1->young_list()->length(); | |
1436 uint young_list_max_length = _young_list_max_length; | |
1437 return young_list_length < young_list_max_length; | |
1426 } | 1438 } |
1427 | 1439 |
1428 uint G1CollectorPolicy::max_regions(int purpose) { | 1440 uint G1CollectorPolicy::max_regions(int purpose) { |
1429 switch (purpose) { | 1441 switch (purpose) { |
1430 case GCAllocForSurvived: | 1442 case GCAllocForSurvived: |
1615 | 1627 |
1616 void | 1628 void |
1617 G1CollectorPolicy::record_concurrent_mark_cleanup_end(int no_of_gc_threads) { | 1629 G1CollectorPolicy::record_concurrent_mark_cleanup_end(int no_of_gc_threads) { |
1618 _collectionSetChooser->clear(); | 1630 _collectionSetChooser->clear(); |
1619 | 1631 |
1620 uint region_num = _g1->n_regions(); | 1632 uint region_num = _g1->num_regions(); |
1621 if (G1CollectedHeap::use_parallel_gc_threads()) { | 1633 if (G1CollectedHeap::use_parallel_gc_threads()) { |
1622 const uint OverpartitionFactor = 4; | 1634 const uint OverpartitionFactor = 4; |
1623 uint WorkUnit; | 1635 uint WorkUnit; |
1624 // The use of MinChunkSize = 8 in the original code | 1636 // The use of MinChunkSize = 8 in the original code |
1625 // causes some assertion failures when the total number of | 1637 // causes some assertion failures when the total number of |
1636 const uint MinWorkUnit = MAX2(region_num / (uint) ParallelGCThreads, 1U); | 1648 const uint MinWorkUnit = MAX2(region_num / (uint) ParallelGCThreads, 1U); |
1637 WorkUnit = | 1649 WorkUnit = |
1638 MAX2(region_num / (uint) (ParallelGCThreads * OverpartitionFactor), | 1650 MAX2(region_num / (uint) (ParallelGCThreads * OverpartitionFactor), |
1639 MinWorkUnit); | 1651 MinWorkUnit); |
1640 } | 1652 } |
1641 _collectionSetChooser->prepare_for_par_region_addition(_g1->n_regions(), | 1653 _collectionSetChooser->prepare_for_par_region_addition(_g1->num_regions(), |
1642 WorkUnit); | 1654 WorkUnit); |
1643 ParKnownGarbageTask parKnownGarbageTask(_collectionSetChooser, | 1655 ParKnownGarbageTask parKnownGarbageTask(_collectionSetChooser, |
1644 (int) WorkUnit); | 1656 (int) WorkUnit); |
1645 _g1->workers()->run_task(&parKnownGarbageTask); | 1657 _g1->workers()->run_task(&parKnownGarbageTask); |
1646 | 1658 |
1662 } | 1674 } |
1663 | 1675 |
1664 // Add the heap region at the head of the non-incremental collection set | 1676 // Add the heap region at the head of the non-incremental collection set |
1665 void G1CollectorPolicy::add_old_region_to_cset(HeapRegion* hr) { | 1677 void G1CollectorPolicy::add_old_region_to_cset(HeapRegion* hr) { |
1666 assert(_inc_cset_build_state == Active, "Precondition"); | 1678 assert(_inc_cset_build_state == Active, "Precondition"); |
1667 assert(!hr->is_young(), "non-incremental add of young region"); | 1679 assert(hr->is_old(), "the region should be old"); |
1668 | 1680 |
1669 assert(!hr->in_collection_set(), "should not already be in the CSet"); | 1681 assert(!hr->in_collection_set(), "should not already be in the CSet"); |
1670 hr->set_in_collection_set(true); | 1682 hr->set_in_collection_set(true); |
1671 hr->set_next_in_collection_set(_collection_set); | 1683 hr->set_next_in_collection_set(_collection_set); |
1672 _collection_set = hr; | 1684 _collection_set = hr; |
1808 } | 1820 } |
1809 | 1821 |
1810 // Add the region at the RHS of the incremental cset | 1822 // Add the region at the RHS of the incremental cset |
1811 void G1CollectorPolicy::add_region_to_incremental_cset_rhs(HeapRegion* hr) { | 1823 void G1CollectorPolicy::add_region_to_incremental_cset_rhs(HeapRegion* hr) { |
1812 // We should only ever be appending survivors at the end of a pause | 1824 // We should only ever be appending survivors at the end of a pause |
1813 assert( hr->is_survivor(), "Logic"); | 1825 assert(hr->is_survivor(), "Logic"); |
1814 | 1826 |
1815 // Do the 'common' stuff | 1827 // Do the 'common' stuff |
1816 add_region_to_incremental_cset_common(hr); | 1828 add_region_to_incremental_cset_common(hr); |
1817 | 1829 |
1818 // Now add the region at the right hand side | 1830 // Now add the region at the right hand side |
1826 } | 1838 } |
1827 | 1839 |
1828 // Add the region to the LHS of the incremental cset | 1840 // Add the region to the LHS of the incremental cset |
1829 void G1CollectorPolicy::add_region_to_incremental_cset_lhs(HeapRegion* hr) { | 1841 void G1CollectorPolicy::add_region_to_incremental_cset_lhs(HeapRegion* hr) { |
1830 // Survivors should be added to the RHS at the end of a pause | 1842 // Survivors should be added to the RHS at the end of a pause |
1831 assert(!hr->is_survivor(), "Logic"); | 1843 assert(hr->is_eden(), "Logic"); |
1832 | 1844 |
1833 // Do the 'common' stuff | 1845 // Do the 'common' stuff |
1834 add_region_to_incremental_cset_common(hr); | 1846 add_region_to_incremental_cset_common(hr); |
1835 | 1847 |
1836 // Add the region at the left hand side | 1848 // Add the region at the left hand side |
1933 // as a percentage of the heap size. I.e., it should bound the | 1945 // as a percentage of the heap size. I.e., it should bound the |
1934 // number of old regions added to the CSet irrespective of how many | 1946 // number of old regions added to the CSet irrespective of how many |
1935 // of them are available. | 1947 // of them are available. |
1936 | 1948 |
1937 G1CollectedHeap* g1h = G1CollectedHeap::heap(); | 1949 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
1938 const size_t region_num = g1h->n_regions(); | 1950 const size_t region_num = g1h->num_regions(); |
1939 const size_t perc = (size_t) G1OldCSetRegionThresholdPercent; | 1951 const size_t perc = (size_t) G1OldCSetRegionThresholdPercent; |
1940 size_t result = region_num * perc / 100; | 1952 size_t result = region_num * perc / 100; |
1941 // emulate ceiling | 1953 // emulate ceiling |
1942 if (100 * result < region_num * perc) { | 1954 if (100 * result < region_num * perc) { |
1943 result += 1; | 1955 result += 1; |
1986 init_cset_region_lengths(eden_region_length, survivor_region_length); | 1998 init_cset_region_lengths(eden_region_length, survivor_region_length); |
1987 | 1999 |
1988 HeapRegion* hr = young_list->first_survivor_region(); | 2000 HeapRegion* hr = young_list->first_survivor_region(); |
1989 while (hr != NULL) { | 2001 while (hr != NULL) { |
1990 assert(hr->is_survivor(), "badly formed young list"); | 2002 assert(hr->is_survivor(), "badly formed young list"); |
1991 hr->set_young(); | 2003 // There is a convention that all the young regions in the CSet |
2004 // are tagged as "eden", so we do this for the survivors here. We | |
2005 // use the special set_eden_pre_gc() as it doesn't check that the | |
2006 // region is free (which is not the case here). | |
2007 hr->set_eden_pre_gc(); | |
1992 hr = hr->get_next_young_region(); | 2008 hr = hr->get_next_young_region(); |
1993 } | 2009 } |
1994 | 2010 |
1995 // Clear the fields that point to the survivor list - they are all young now. | 2011 // Clear the fields that point to the survivor list - they are all young now. |
1996 young_list->clear_survivors(); | 2012 young_list->clear_survivors(); |