src/hotspot/share/gc/g1/collectionSetChooser.hpp
changeset 49605 784f3f2dea14
parent 47216 71c04702a3d5
child 49607 acffe6ff3ae7
equal deleted inserted replaced
49604:ca5978b8378b 49605:784f3f2dea14
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
     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.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    99 
    99 
   100   void push(HeapRegion* hr);
   100   void push(HeapRegion* hr);
   101 
   101 
   102   CollectionSetChooser();
   102   CollectionSetChooser();
   103 
   103 
       
   104   static size_t mixed_gc_live_threshold_bytes() {
       
   105     return HeapRegion::GrainBytes * (size_t) G1MixedGCLiveThresholdPercent / 100;
       
   106   }
       
   107 
       
   108   static bool region_occupancy_low_enough_for_evac(size_t live_bytes);
       
   109 
   104   void sort_regions();
   110   void sort_regions();
   105 
   111 
   106   // Determine whether to add the given region to the CSet chooser or
   112   // Determine whether to add the given region to the CSet chooser or
   107   // not. Currently, we skip pinned regions and regions whose live
   113   // not. Currently, we skip pinned regions and regions whose live
   108   // bytes are over the threshold. Humongous regions may be reclaimed during cleanup.
   114   // bytes are over the threshold. Humongous regions may be reclaimed during cleanup.
   109   bool should_add(HeapRegion* hr) {
   115   bool should_add(HeapRegion* hr) const;
   110     assert(hr->is_marked(), "pre-condition");
       
   111     assert(!hr->is_young(), "should never consider young regions");
       
   112     return !hr->is_pinned() &&
       
   113             hr->live_bytes() < _region_live_threshold_bytes;
       
   114   }
       
   115 
   116 
   116   // Returns the number candidate old regions added
   117   // Returns the number candidate old regions added
   117   uint length() { return _end; }
   118   uint length() { return _end; }
   118 
   119 
   119   // Serial version.
   120   // Serial version.
   130   // first if in parallel.
   131   // first if in parallel.
   131   void set_region(uint index, HeapRegion* hr);
   132   void set_region(uint index, HeapRegion* hr);
   132   // Atomically increment the number of added regions by region_num
   133   // Atomically increment the number of added regions by region_num
   133   // and the amount of reclaimable bytes by reclaimable_bytes.
   134   // and the amount of reclaimable bytes by reclaimable_bytes.
   134   void update_totals(uint region_num, size_t reclaimable_bytes);
   135   void update_totals(uint region_num, size_t reclaimable_bytes);
       
   136 
       
   137   // Iterate over all collection set candidate regions.
       
   138   void iterate(HeapRegionClosure* cl);
   135 
   139 
   136   void clear();
   140   void clear();
   137 
   141 
   138   void rebuild(WorkGang* workers, uint n_regions);
   142   void rebuild(WorkGang* workers, uint n_regions);
   139 
   143