< prev index next >

src/hotspot/share/gc/g1/g1CollectionSet.cpp

Print this page
rev 56992 : imported patch 8227739-merge-scan-rs-update-rs-cost


  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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/g1/g1CollectedHeap.inline.hpp"
  27 #include "gc/g1/g1CollectionSet.hpp"
  28 #include "gc/g1/g1CollectionSetCandidates.hpp"
  29 #include "gc/g1/g1CollectorState.hpp"

  30 #include "gc/g1/g1ParScanThreadState.hpp"
  31 #include "gc/g1/g1Policy.hpp"
  32 #include "gc/g1/heapRegion.inline.hpp"
  33 #include "gc/g1/heapRegionRemSet.hpp"
  34 #include "gc/g1/heapRegionSet.hpp"
  35 #include "logging/logStream.hpp"
  36 #include "utilities/debug.hpp"
  37 #include "utilities/globalDefinitions.hpp"
  38 #include "utilities/quickSort.hpp"
  39 
  40 G1CollectorState* G1CollectionSet::collector_state() {
  41   return _g1h->collector_state();
  42 }
  43 
  44 G1GCPhaseTimes* G1CollectionSet::phase_times() {
  45   return _policy->phase_times();
  46 }
  47 
  48 double G1CollectionSet::predict_region_elapsed_time_ms(HeapRegion* hr) {
  49   return _policy->predict_region_elapsed_time_ms(hr, collector_state()->in_young_only_phase());


 392     return false;
 393   }
 394 };
 395 
 396 void G1CollectionSet::print(outputStream* st) {
 397   st->print_cr("\nCollection_set:");
 398 
 399   G1PrintCollectionSetDetailClosure cl(st);
 400   iterate(&cl);
 401 }
 402 #endif // !PRODUCT
 403 
 404 double G1CollectionSet::finalize_young_part(double target_pause_time_ms, G1SurvivorRegions* survivors) {
 405   double young_start_time_sec = os::elapsedTime();
 406 
 407   finalize_incremental_building();
 408 
 409   guarantee(target_pause_time_ms > 0.0,
 410             "target_pause_time_ms = %1.6lf should be positive", target_pause_time_ms);
 411 
 412   size_t pending_cards = _policy->pending_cards_at_gc_start();
 413   double base_time_ms = _policy->predict_base_elapsed_time_ms(pending_cards);
 414   double time_remaining_ms = MAX2(target_pause_time_ms - base_time_ms, 0.0);
 415 
 416   log_trace(gc, ergo, cset)("Start choosing CSet. pending cards: " SIZE_FORMAT " predicted base time: %1.2fms remaining time: %1.2fms target pause time: %1.2fms",
 417                             pending_cards, base_time_ms, time_remaining_ms, target_pause_time_ms);
 418 
 419   // The young list is laid with the survivor regions from the previous
 420   // pause are appended to the RHS of the young list, i.e.
 421   //   [Newly Young Regions ++ Survivors from last pause].
 422 
 423   uint survivor_region_length = survivors->length();
 424   uint eden_region_length = _g1h->eden_regions_count();
 425   init_region_lengths(eden_region_length, survivor_region_length);
 426 
 427   verify_young_cset_indices();
 428 
 429   // Clear the fields that point to the survivor list - they are all young now.
 430   survivors->convert_to_eden();
 431 
 432   _bytes_used_before = _inc_bytes_used_before;




  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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/g1/g1CollectedHeap.inline.hpp"
  27 #include "gc/g1/g1CollectionSet.hpp"
  28 #include "gc/g1/g1CollectionSetCandidates.hpp"
  29 #include "gc/g1/g1CollectorState.hpp"
  30 #include "gc/g1/g1HotCardCache.hpp"
  31 #include "gc/g1/g1ParScanThreadState.hpp"
  32 #include "gc/g1/g1Policy.hpp"
  33 #include "gc/g1/heapRegion.inline.hpp"
  34 #include "gc/g1/heapRegionRemSet.hpp"
  35 #include "gc/g1/heapRegionSet.hpp"
  36 #include "logging/logStream.hpp"
  37 #include "utilities/debug.hpp"
  38 #include "utilities/globalDefinitions.hpp"
  39 #include "utilities/quickSort.hpp"
  40 
  41 G1CollectorState* G1CollectionSet::collector_state() {
  42   return _g1h->collector_state();
  43 }
  44 
  45 G1GCPhaseTimes* G1CollectionSet::phase_times() {
  46   return _policy->phase_times();
  47 }
  48 
  49 double G1CollectionSet::predict_region_elapsed_time_ms(HeapRegion* hr) {
  50   return _policy->predict_region_elapsed_time_ms(hr, collector_state()->in_young_only_phase());


 393     return false;
 394   }
 395 };
 396 
 397 void G1CollectionSet::print(outputStream* st) {
 398   st->print_cr("\nCollection_set:");
 399 
 400   G1PrintCollectionSetDetailClosure cl(st);
 401   iterate(&cl);
 402 }
 403 #endif // !PRODUCT
 404 
 405 double G1CollectionSet::finalize_young_part(double target_pause_time_ms, G1SurvivorRegions* survivors) {
 406   double young_start_time_sec = os::elapsedTime();
 407 
 408   finalize_incremental_building();
 409 
 410   guarantee(target_pause_time_ms > 0.0,
 411             "target_pause_time_ms = %1.6lf should be positive", target_pause_time_ms);
 412 
 413   size_t pending_cards = _policy->pending_cards_at_gc_start() + _g1h->hot_card_cache()->num_entries();
 414   double base_time_ms = _policy->predict_base_elapsed_time_ms(pending_cards);
 415   double time_remaining_ms = MAX2(target_pause_time_ms - base_time_ms, 0.0);
 416 
 417   log_trace(gc, ergo, cset)("Start choosing CSet. pending cards: " SIZE_FORMAT " predicted base time: %1.2fms remaining time: %1.2fms target pause time: %1.2fms",
 418                             pending_cards, base_time_ms, time_remaining_ms, target_pause_time_ms);
 419 
 420   // The young list is laid with the survivor regions from the previous
 421   // pause are appended to the RHS of the young list, i.e.
 422   //   [Newly Young Regions ++ Survivors from last pause].
 423 
 424   uint survivor_region_length = survivors->length();
 425   uint eden_region_length = _g1h->eden_regions_count();
 426   init_region_lengths(eden_region_length, survivor_region_length);
 427 
 428   verify_young_cset_indices();
 429 
 430   // Clear the fields that point to the survivor list - they are all young now.
 431   survivors->convert_to_eden();
 432 
 433   _bytes_used_before = _inc_bytes_used_before;


< prev index next >