< prev index next >

src/hotspot/share/gc/parallel/psParallelCompact.cpp

Print this page
rev 53341 : 8212206: Refactor AdaptiveSizePolicy to separate out code related to GC overhead
Summary: Move check_gc_overhead_limit() and related code to its own class
Reviewed-by:
   1 /*
   2  * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


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(young_live,
1893                                              eden_live,
1894                                              max_old_gen_size,
1895                                              max_eden_size,
1896                                              true /* full gc*/,
1897                                              gc_cause,
1898                                              heap->soft_ref_policy());
1899 
1900         size_policy->decay_supplemental_growth(true /* full gc*/);
1901 
1902         heap->resize_old_gen(
1903           size_policy->calculated_old_free_size_in_bytes());
1904 
1905         heap->resize_young_gen(size_policy->calculated_eden_size_in_bytes(),
1906                                size_policy->calculated_survivor_size_in_bytes());
1907       }
1908 
1909       log_debug(gc, ergo)("AdaptiveSizeStop: collection: %d ", heap->total_collections());
1910     }
1911 
1912     if (UsePerfData) {
1913       PSGCAdaptivePolicyCounters* const counters = heap->gc_policy_counters();


   1 /*
   2  * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


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());
1898 
1899         size_policy->decay_supplemental_growth(true /* full gc*/);
1900 
1901         heap->resize_old_gen(
1902           size_policy->calculated_old_free_size_in_bytes());
1903 
1904         heap->resize_young_gen(size_policy->calculated_eden_size_in_bytes(),
1905                                size_policy->calculated_survivor_size_in_bytes());
1906       }
1907 
1908       log_debug(gc, ergo)("AdaptiveSizeStop: collection: %d ", heap->total_collections());
1909     }
1910 
1911     if (UsePerfData) {
1912       PSGCAdaptivePolicyCounters* const counters = heap->gc_policy_counters();


< prev index next >