< prev index next >

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


 526             young_gen->to_space()->capacity_in_bytes(),
 527             "Sizes of space in young gen are out-of-bounds");
 528 
 529           size_t young_live = young_gen->used_in_bytes();
 530           size_t eden_live = young_gen->eden_space()->used_in_bytes();
 531           size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
 532           size_t max_old_gen_size = old_gen->max_gen_size();
 533           size_t max_eden_size = max_young_size -
 534             young_gen->from_space()->capacity_in_bytes() -
 535             young_gen->to_space()->capacity_in_bytes();
 536 
 537           // Used for diagnostics
 538           size_policy->clear_generation_free_space_flags();
 539 
 540           size_policy->compute_eden_space_size(young_live,
 541                                                eden_live,
 542                                                cur_eden,
 543                                                max_eden_size,
 544                                                false /* not full gc*/);
 545 
 546           size_policy->check_gc_overhead_limit(young_live,
 547                                                eden_live,
 548                                                max_old_gen_size,
 549                                                max_eden_size,
 550                                                false /* not full gc*/,
 551                                                gc_cause,
 552                                                heap->soft_ref_policy());
 553 
 554           size_policy->decay_supplemental_growth(false /* not full gc*/);
 555         }
 556         // Resize the young generation at every collection
 557         // even if new sizes have not been calculated.  This is
 558         // to allow resizes that may have been inhibited by the
 559         // relative location of the "to" and "from" spaces.
 560 
 561         // Resizing the old gen at young collections can cause increases
 562         // that don't feed back to the generation sizing policy until
 563         // a full collection.  Don't resize the old gen here.
 564 
 565         heap->resize_young_gen(size_policy->calculated_eden_size_in_bytes(),
 566                         size_policy->calculated_survivor_size_in_bytes());
 567 


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


 526             young_gen->to_space()->capacity_in_bytes(),
 527             "Sizes of space in young gen are out-of-bounds");
 528 
 529           size_t young_live = young_gen->used_in_bytes();
 530           size_t eden_live = young_gen->eden_space()->used_in_bytes();
 531           size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
 532           size_t max_old_gen_size = old_gen->max_gen_size();
 533           size_t max_eden_size = max_young_size -
 534             young_gen->from_space()->capacity_in_bytes() -
 535             young_gen->to_space()->capacity_in_bytes();
 536 
 537           // Used for diagnostics
 538           size_policy->clear_generation_free_space_flags();
 539 
 540           size_policy->compute_eden_space_size(young_live,
 541                                                eden_live,
 542                                                cur_eden,
 543                                                max_eden_size,
 544                                                false /* not full gc*/);
 545 
 546           size_policy->check_gc_overhead_limit(eden_live,

 547                                                max_old_gen_size,
 548                                                max_eden_size,
 549                                                false /* not full gc*/,
 550                                                gc_cause,
 551                                                heap->soft_ref_policy());
 552 
 553           size_policy->decay_supplemental_growth(false /* not full gc*/);
 554         }
 555         // Resize the young generation at every collection
 556         // even if new sizes have not been calculated.  This is
 557         // to allow resizes that may have been inhibited by the
 558         // relative location of the "to" and "from" spaces.
 559 
 560         // Resizing the old gen at young collections can cause increases
 561         // that don't feed back to the generation sizing policy until
 562         // a full collection.  Don't resize the old gen here.
 563 
 564         heap->resize_young_gen(size_policy->calculated_eden_size_in_bytes(),
 565                         size_policy->calculated_survivor_size_in_bytes());
 566 


< prev index next >