1847 if (UseAdaptiveSizePolicy) {
1848 log_debug(gc, ergo)("AdaptiveSizeStart: collection: %d ", heap->total_collections());
1849 log_trace(gc, ergo)("old_gen_capacity: " SIZE_FORMAT " young_gen_capacity: " SIZE_FORMAT,
1850 old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
1851
1852 // Don't check if the size_policy is ready here. Let
1853 // the size_policy check that internally.
1854 if (UseAdaptiveGenerationSizePolicyAtMajorCollection &&
1855 AdaptiveSizePolicy::should_update_promo_stats(gc_cause)) {
1856 // Swap the survivor spaces if from_space is empty. The
1857 // resize_young_gen() called below is normally used after
1858 // a successful young GC and swapping of survivor spaces;
1859 // otherwise, it will fail to resize the young gen with
1860 // the current implementation.
1861 if (young_gen->from_space()->is_empty()) {
1862 young_gen->from_space()->clear(SpaceDecorator::Mangle);
1863 young_gen->swap_spaces();
1864 }
1865
1866 // Calculate optimal free space amounts
1867 assert(young_gen->max_size() >
1868 young_gen->from_space()->capacity_in_bytes() +
1869 young_gen->to_space()->capacity_in_bytes(),
1870 "Sizes of space in young gen are out-of-bounds");
1871
1872 size_t young_live = young_gen->used_in_bytes();
1873 size_t eden_live = young_gen->eden_space()->used_in_bytes();
1874 size_t old_live = old_gen->used_in_bytes();
1875 size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
1876 size_t max_old_gen_size = old_gen->max_gen_size();
1877 size_t max_eden_size = young_gen->max_size() -
1878 young_gen->from_space()->capacity_in_bytes() -
1879 young_gen->to_space()->capacity_in_bytes();
1880
1881 // Used for diagnostics
1882 size_policy->clear_generation_free_space_flags();
1883
1884 size_policy->compute_generations_free_space(young_live,
1885 eden_live,
1886 old_live,
1887 cur_eden,
1888 max_old_gen_size,
1889 max_eden_size,
1890 true /* full gc*/);
1891
1892 size_policy->check_gc_overhead_limit(eden_live,
1893 max_old_gen_size,
1894 max_eden_size,
1895 true /* full gc*/,
1896 gc_cause,
1897 heap->soft_ref_policy());
|
1847 if (UseAdaptiveSizePolicy) {
1848 log_debug(gc, ergo)("AdaptiveSizeStart: collection: %d ", heap->total_collections());
1849 log_trace(gc, ergo)("old_gen_capacity: " SIZE_FORMAT " young_gen_capacity: " SIZE_FORMAT,
1850 old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
1851
1852 // Don't check if the size_policy is ready here. Let
1853 // the size_policy check that internally.
1854 if (UseAdaptiveGenerationSizePolicyAtMajorCollection &&
1855 AdaptiveSizePolicy::should_update_promo_stats(gc_cause)) {
1856 // Swap the survivor spaces if from_space is empty. The
1857 // resize_young_gen() called below is normally used after
1858 // a successful young GC and swapping of survivor spaces;
1859 // otherwise, it will fail to resize the young gen with
1860 // the current implementation.
1861 if (young_gen->from_space()->is_empty()) {
1862 young_gen->from_space()->clear(SpaceDecorator::Mangle);
1863 young_gen->swap_spaces();
1864 }
1865
1866 // Calculate optimal free space amounts
1867 assert(young_gen->max_gen_size() >
1868 young_gen->from_space()->capacity_in_bytes() +
1869 young_gen->to_space()->capacity_in_bytes(),
1870 "Sizes of space in young gen are out-of-bounds");
1871
1872 size_t young_live = young_gen->used_in_bytes();
1873 size_t eden_live = young_gen->eden_space()->used_in_bytes();
1874 size_t old_live = old_gen->used_in_bytes();
1875 size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
1876 size_t max_old_gen_size = old_gen->max_gen_size();
1877 size_t max_eden_size = young_gen->max_gen_size() -
1878 young_gen->from_space()->capacity_in_bytes() -
1879 young_gen->to_space()->capacity_in_bytes();
1880
1881 // Used for diagnostics
1882 size_policy->clear_generation_free_space_flags();
1883
1884 size_policy->compute_generations_free_space(young_live,
1885 eden_live,
1886 old_live,
1887 cur_eden,
1888 max_old_gen_size,
1889 max_eden_size,
1890 true /* full gc*/);
1891
1892 size_policy->check_gc_overhead_limit(eden_live,
1893 max_old_gen_size,
1894 max_eden_size,
1895 true /* full gc*/,
1896 gc_cause,
1897 heap->soft_ref_policy());
|