src/hotspot/share/gc/g1/g1CollectionSet.hpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54465 c4f16445675a
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
    34 class G1GCPhaseTimes;
    34 class G1GCPhaseTimes;
    35 class G1ParScanThreadStateSet;
    35 class G1ParScanThreadStateSet;
    36 class G1Policy;
    36 class G1Policy;
    37 class G1SurvivorRegions;
    37 class G1SurvivorRegions;
    38 class HeapRegion;
    38 class HeapRegion;
       
    39 class HeapRegionClaimer;
    39 class HeapRegionClosure;
    40 class HeapRegionClosure;
    40 
    41 
    41 // The collection set.
    42 // The collection set.
    42 //
    43 //
    43 // The set of regions that are evacuated during an evacuation pause.
    44 // The set of regions that are evacuated during an evacuation pause.
   161   size_t _bytes_used_before;
   162   size_t _bytes_used_before;
   162 
   163 
   163   // The number of cards in the remembered set in the collection set. Set from
   164   // The number of cards in the remembered set in the collection set. Set from
   164   // the incrementally built collection set at the start of an evacuation
   165   // the incrementally built collection set at the start of an evacuation
   165   // pause, and updated as more regions are added to the collection set.
   166   // pause, and updated as more regions are added to the collection set.
   166   size_t _recorded_rs_lengths;
   167   size_t _recorded_rs_length;
   167 
   168 
   168   enum CSetBuildType {
   169   enum CSetBuildType {
   169     Active,             // We are actively building the collection set
   170     Active,             // We are actively building the collection set
   170     Inactive            // We are not actively building the collection set
   171     Inactive            // We are not actively building the collection set
   171   };
   172   };
   185   // The RSet lengths recorded for regions in the CSet. It is updated
   186   // The RSet lengths recorded for regions in the CSet. It is updated
   186   // by the thread that adds a new region to the CSet. We assume that
   187   // by the thread that adds a new region to the CSet. We assume that
   187   // only one thread can be allocating a new CSet region (currently,
   188   // only one thread can be allocating a new CSet region (currently,
   188   // it does so after taking the Heap_lock) hence no need to
   189   // it does so after taking the Heap_lock) hence no need to
   189   // synchronize updates to this field.
   190   // synchronize updates to this field.
   190   size_t _inc_recorded_rs_lengths;
   191   size_t _inc_recorded_rs_length;
   191 
   192 
   192   // A concurrent refinement thread periodically samples the young
   193   // A concurrent refinement thread periodically samples the young
   193   // region RSets and needs to update _inc_recorded_rs_lengths as
   194   // region RSets and needs to update _inc_recorded_rs_length as
   194   // the RSets grow. Instead of having to synchronize updates to that
   195   // the RSets grow. Instead of having to synchronize updates to that
   195   // field we accumulate them in this field and add it to
   196   // field we accumulate them in this field and add it to
   196   // _inc_recorded_rs_lengths_diffs at the start of a GC.
   197   // _inc_recorded_rs_length_diff at the start of a GC.
   197   ssize_t _inc_recorded_rs_lengths_diffs;
   198   ssize_t _inc_recorded_rs_length_diff;
   198 
   199 
   199   // The predicted elapsed time it will take to collect the regions in
   200   // The predicted elapsed time it will take to collect the regions in
   200   // the CSet. This is updated by the thread that adds a new region to
   201   // the CSet. This is updated by the thread that adds a new region to
   201   // the CSet. See the comment for _inc_recorded_rs_lengths about
   202   // the CSet. See the comment for _inc_recorded_rs_length about
   202   // MT-safety assumptions.
   203   // MT-safety assumptions.
   203   double _inc_predicted_elapsed_time_ms;
   204   double _inc_predicted_elapsed_time_ms;
   204 
   205 
   205   // See the comment for _inc_recorded_rs_lengths_diffs.
   206   // See the comment for _inc_recorded_rs_length_diff.
   206   double _inc_predicted_elapsed_time_ms_diffs;
   207   double _inc_predicted_elapsed_time_ms_diff;
   207 
   208 
   208   void set_recorded_rs_lengths(size_t rs_lengths);
   209   void set_recorded_rs_length(size_t rs_length);
   209 
   210 
   210   G1CollectorState* collector_state();
   211   G1CollectorState* collector_state();
   211   G1GCPhaseTimes* phase_times();
   212   G1GCPhaseTimes* phase_times();
   212 
   213 
   213   void verify_young_cset_indices() const NOT_DEBUG_RETURN;
   214   void verify_young_cset_indices() const NOT_DEBUG_RETURN;
   277   // Stop adding regions to the current collection set increment.
   278   // Stop adding regions to the current collection set increment.
   278   void stop_incremental_building() { _inc_build_state = Inactive; }
   279   void stop_incremental_building() { _inc_build_state = Inactive; }
   279 
   280 
   280   // Iterate over the current collection set increment applying the given HeapRegionClosure
   281   // Iterate over the current collection set increment applying the given HeapRegionClosure
   281   // from a starting position determined by the given worker id.
   282   // from a starting position determined by the given worker id.
   282   void iterate_incremental_part_from(HeapRegionClosure* cl, uint worker_id, uint total_workers) const;
   283   void iterate_incremental_part_from(HeapRegionClosure* cl, HeapRegionClaimer* hr_claimer, uint worker_id, uint total_workers) const;
       
   284 
       
   285   // Returns the length of the current increment in number of regions.
       
   286   size_t increment_length() const { return _collection_set_cur_length - _inc_part_start; }
       
   287   // Returns the length of the whole current collection set in number of regions
       
   288   size_t cur_length() const { return _collection_set_cur_length; }
   283 
   289 
   284   // Iterate over the entire collection set (all increments calculated so far), applying
   290   // Iterate over the entire collection set (all increments calculated so far), applying
   285   // the given HeapRegionClosure on all of them.
   291   // the given HeapRegionClosure on all of them.
   286   void iterate(HeapRegionClosure* cl) const;
   292   void iterate(HeapRegionClosure* cl) const;
   287 
   293 
   288   void iterate_optional(HeapRegionClosure* cl) const;
   294   void iterate_optional(HeapRegionClosure* cl) const;
   289 
   295 
   290   size_t recorded_rs_lengths() { return _recorded_rs_lengths; }
   296   size_t recorded_rs_length() { return _recorded_rs_length; }
   291 
   297 
   292   size_t bytes_used_before() const {
   298   size_t bytes_used_before() const {
   293     return _bytes_used_before;
   299     return _bytes_used_before;
   294   }
   300   }
   295 
   301