< prev index next >

src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.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  *


1481   // collector, there may be references on the discovered
1482   // references lists.  Abandon those references, since some
1483   // of them may have become unreachable after concurrent
1484   // discovery; the STW compacting collector will redo discovery
1485   // more precisely, without being subject to floating garbage.
1486   // Leaving otherwise unreachable references in the discovered
1487   // lists would require special handling.
1488   ref_processor()->disable_discovery();
1489   ref_processor()->abandon_partial_discovery();
1490   ref_processor()->verify_no_references_recorded();
1491 
1492   if (first_state > Idling) {
1493     save_heap_summary();
1494   }
1495 
1496   do_compaction_work(clear_all_soft_refs);
1497 
1498   // Has the GC time limit been exceeded?
1499   size_t max_eden_size = _young_gen->max_eden_size();
1500   GCCause::Cause gc_cause = heap->gc_cause();
1501   size_policy()->check_gc_overhead_limit(_young_gen->used(),
1502                                          _young_gen->eden()->used(),
1503                                          _cmsGen->max_capacity(),
1504                                          max_eden_size,
1505                                          full,
1506                                          gc_cause,
1507                                          heap->soft_ref_policy());
1508 
1509   // Reset the expansion cause, now that we just completed
1510   // a collection cycle.
1511   clear_expansion_cause();
1512   _foregroundGCIsActive = false;
1513   return;
1514 }
1515 
1516 // Resize the tenured generation
1517 // after obtaining the free list locks for the
1518 // two generations.
1519 void CMSCollector::compute_new_size() {
1520   assert_locked_or_safepoint(Heap_lock);
1521   FreelistLocker z(this);
1522   MetaspaceGC::compute_new_size();


   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  *


1481   // collector, there may be references on the discovered
1482   // references lists.  Abandon those references, since some
1483   // of them may have become unreachable after concurrent
1484   // discovery; the STW compacting collector will redo discovery
1485   // more precisely, without being subject to floating garbage.
1486   // Leaving otherwise unreachable references in the discovered
1487   // lists would require special handling.
1488   ref_processor()->disable_discovery();
1489   ref_processor()->abandon_partial_discovery();
1490   ref_processor()->verify_no_references_recorded();
1491 
1492   if (first_state > Idling) {
1493     save_heap_summary();
1494   }
1495 
1496   do_compaction_work(clear_all_soft_refs);
1497 
1498   // Has the GC time limit been exceeded?
1499   size_t max_eden_size = _young_gen->max_eden_size();
1500   GCCause::Cause gc_cause = heap->gc_cause();
1501   size_policy()->check_gc_overhead_limit(_young_gen->eden()->used(),

1502                                          _cmsGen->max_capacity(),
1503                                          max_eden_size,
1504                                          full,
1505                                          gc_cause,
1506                                          heap->soft_ref_policy());
1507 
1508   // Reset the expansion cause, now that we just completed
1509   // a collection cycle.
1510   clear_expansion_cause();
1511   _foregroundGCIsActive = false;
1512   return;
1513 }
1514 
1515 // Resize the tenured generation
1516 // after obtaining the free list locks for the
1517 // two generations.
1518 void CMSCollector::compute_new_size() {
1519   assert_locked_or_safepoint(Heap_lock);
1520   FreelistLocker z(this);
1521   MetaspaceGC::compute_new_size();


< prev index next >