< prev index next >

src/hotspot/share/gc/parallel/psMarkSweep.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) 2001, 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  *


 299         size_t young_live = young_gen->used_in_bytes();
 300         size_t eden_live = young_gen->eden_space()->used_in_bytes();
 301         size_t old_live = old_gen->used_in_bytes();
 302         size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
 303         size_t max_old_gen_size = old_gen->max_gen_size();
 304         size_t max_eden_size = young_gen->max_size() -
 305           young_gen->from_space()->capacity_in_bytes() -
 306           young_gen->to_space()->capacity_in_bytes();
 307 
 308         // Used for diagnostics
 309         size_policy->clear_generation_free_space_flags();
 310 
 311         size_policy->compute_generations_free_space(young_live,
 312                                                     eden_live,
 313                                                     old_live,
 314                                                     cur_eden,
 315                                                     max_old_gen_size,
 316                                                     max_eden_size,
 317                                                     true /* full gc*/);
 318 
 319         size_policy->check_gc_overhead_limit(young_live,
 320                                              eden_live,
 321                                              max_old_gen_size,
 322                                              max_eden_size,
 323                                              true /* full gc*/,
 324                                              gc_cause,
 325                                              heap->soft_ref_policy());
 326 
 327         size_policy->decay_supplemental_growth(true /* full gc*/);
 328 
 329         heap->resize_old_gen(size_policy->calculated_old_free_size_in_bytes());
 330 
 331         heap->resize_young_gen(size_policy->calculated_eden_size_in_bytes(),
 332                                size_policy->calculated_survivor_size_in_bytes());
 333       }
 334       log_debug(gc, ergo)("AdaptiveSizeStop: collection: %d ", heap->total_collections());
 335     }
 336 
 337     if (UsePerfData) {
 338       heap->gc_policy_counters()->update_counters();
 339       heap->gc_policy_counters()->update_old_capacity(
 340         old_gen->capacity_in_bytes());


   1 /*
   2  * Copyright (c) 2001, 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  *


 299         size_t young_live = young_gen->used_in_bytes();
 300         size_t eden_live = young_gen->eden_space()->used_in_bytes();
 301         size_t old_live = old_gen->used_in_bytes();
 302         size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
 303         size_t max_old_gen_size = old_gen->max_gen_size();
 304         size_t max_eden_size = young_gen->max_size() -
 305           young_gen->from_space()->capacity_in_bytes() -
 306           young_gen->to_space()->capacity_in_bytes();
 307 
 308         // Used for diagnostics
 309         size_policy->clear_generation_free_space_flags();
 310 
 311         size_policy->compute_generations_free_space(young_live,
 312                                                     eden_live,
 313                                                     old_live,
 314                                                     cur_eden,
 315                                                     max_old_gen_size,
 316                                                     max_eden_size,
 317                                                     true /* full gc*/);
 318 
 319         size_policy->check_gc_overhead_limit(eden_live,

 320                                              max_old_gen_size,
 321                                              max_eden_size,
 322                                              true /* full gc*/,
 323                                              gc_cause,
 324                                              heap->soft_ref_policy());
 325 
 326         size_policy->decay_supplemental_growth(true /* full gc*/);
 327 
 328         heap->resize_old_gen(size_policy->calculated_old_free_size_in_bytes());
 329 
 330         heap->resize_young_gen(size_policy->calculated_eden_size_in_bytes(),
 331                                size_policy->calculated_survivor_size_in_bytes());
 332       }
 333       log_debug(gc, ergo)("AdaptiveSizeStop: collection: %d ", heap->total_collections());
 334     }
 335 
 336     if (UsePerfData) {
 337       heap->gc_policy_counters()->update_counters();
 338       heap->gc_policy_counters()->update_old_capacity(
 339         old_gen->capacity_in_bytes());


< prev index next >