40 G1CollectedHeap* _g1; 41 G1CollectorPolicy* _policy; 42 43 CollectionSetChooser* _cset_chooser; 44 45 uint _eden_region_length; 46 uint _survivor_region_length; 47 uint _old_region_length; 48 49 // The head of the list (via "next_in_collection_set()") representing the 50 // current collection set. Set from the incrementally built collection 51 // set at the start of the pause. 52 HeapRegion* _head; 53 54 // The number of bytes in the collection set before the pause. Set from 55 // the incrementally built collection set at the start of an evacuation 56 // pause, and incremented in finalize_old_part() when adding old regions 57 // (if any) to the collection set. 58 size_t _bytes_used_before; 59 60 size_t _recorded_rs_lengths; 61 62 // The associated information that is maintained while the incremental 63 // collection set is being built with young regions. Used to populate 64 // the recorded info for the evacuation pause. 65 66 enum CSetBuildType { 67 Active, // We are actively building the collection set 68 Inactive // We are not actively building the collection set 69 }; 70 71 CSetBuildType _inc_build_state; 72 73 // The head of the incrementally built collection set. 74 HeapRegion* _inc_head; 75 76 // The tail of the incrementally built collection set. 77 HeapRegion* _inc_tail; 78 79 // The number of bytes in the incrementally built collection set. 80 // Used to set _collection_set_bytes_used_before at the start of 81 // an evacuation pause. 82 size_t _inc_bytes_used_before; 83 84 // The RSet lengths recorded for regions in the CSet. It is updated 85 // by the thread that adds a new region to the CSet. We assume that 86 // only one thread can be allocating a new CSet region (currently, 87 // it does so after taking the Heap_lock) hence no need to 88 // synchronize updates to this field. 89 size_t _inc_recorded_rs_lengths; 90 91 // A concurrent refinement thread periodically samples the young 92 // region RSets and needs to update _inc_recorded_rs_lengths as 93 // the RSets grow. Instead of having to synchronize updates to that 94 // field we accumulate them in this field and add it to 95 // _inc_recorded_rs_lengths_diffs at the start of a GC. 96 ssize_t _inc_recorded_rs_lengths_diffs; 97 98 // The predicted elapsed time it will take to collect the regions in 99 // the CSet. This is updated by the thread that adds a new region to 100 // the CSet. See the comment for _inc_recorded_rs_lengths about 101 // MT-safety assumptions. 102 double _inc_predicted_elapsed_time_ms; 103 154 _inc_tail = NULL; 155 } 156 157 // Stop adding regions to the incremental collection set 158 void stop_incremental_building() { _inc_build_state = Inactive; } 159 160 // The head of the list (via "next_in_collection_set()") representing the 161 // current collection set. 162 HeapRegion* head() { return _head; } 163 164 void clear_head() { _head = NULL; } 165 166 size_t recorded_rs_lengths() { return _recorded_rs_lengths; } 167 168 size_t bytes_used_before() const { 169 return _bytes_used_before; 170 } 171 172 void reset_bytes_used_before() { 173 _bytes_used_before = 0; 174 } 175 176 // Choose a new collection set. Marks the chosen regions as being 177 // "in_collection_set", and links them together. The head and number of 178 // the collection set are available via access methods. 179 double finalize_young_part(double target_pause_time_ms); 180 void finalize_old_part(double time_remaining_ms); 181 182 // Add old region "hr" to the CSet. 183 void add_old_region(HeapRegion* hr); 184 185 // Update information about hr in the aggregated information for 186 // the incrementally built collection set. 187 void update_young_region_prediction(HeapRegion* hr, size_t new_rs_length); 188 189 // Add hr to the LHS of the incremental collection set. 190 void add_eden_region(HeapRegion* hr); 191 192 // Add hr to the RHS of the incremental collection set. 193 void add_survivor_regions(HeapRegion* hr); | 40 G1CollectedHeap* _g1; 41 G1CollectorPolicy* _policy; 42 43 CollectionSetChooser* _cset_chooser; 44 45 uint _eden_region_length; 46 uint _survivor_region_length; 47 uint _old_region_length; 48 49 // The head of the list (via "next_in_collection_set()") representing the 50 // current collection set. Set from the incrementally built collection 51 // set at the start of the pause. 52 HeapRegion* _head; 53 54 // The number of bytes in the collection set before the pause. Set from 55 // the incrementally built collection set at the start of an evacuation 56 // pause, and incremented in finalize_old_part() when adding old regions 57 // (if any) to the collection set. 58 size_t _bytes_used_before; 59 60 // The sum of live bytes in the collection set, set as described above. 61 size_t _bytes_live_before; 62 63 size_t _recorded_rs_lengths; 64 65 // The associated information that is maintained while the incremental 66 // collection set is being built with young regions. Used to populate 67 // the recorded info for the evacuation pause. 68 69 enum CSetBuildType { 70 Active, // We are actively building the collection set 71 Inactive // We are not actively building the collection set 72 }; 73 74 CSetBuildType _inc_build_state; 75 76 // The head of the incrementally built collection set. 77 HeapRegion* _inc_head; 78 79 // The tail of the incrementally built collection set. 80 HeapRegion* _inc_tail; 81 82 // The number of bytes in the incrementally built collection set. 83 // Used to set _collection_set_bytes_used_before at the start of 84 // an evacuation pause. 85 size_t _inc_bytes_used_before; 86 87 // The number of live bytes in the incrementally built collection set. 88 size_t _inc_bytes_live_before; 89 90 // The RSet lengths recorded for regions in the CSet. It is updated 91 // by the thread that adds a new region to the CSet. We assume that 92 // only one thread can be allocating a new CSet region (currently, 93 // it does so after taking the Heap_lock) hence no need to 94 // synchronize updates to this field. 95 size_t _inc_recorded_rs_lengths; 96 97 // A concurrent refinement thread periodically samples the young 98 // region RSets and needs to update _inc_recorded_rs_lengths as 99 // the RSets grow. Instead of having to synchronize updates to that 100 // field we accumulate them in this field and add it to 101 // _inc_recorded_rs_lengths_diffs at the start of a GC. 102 ssize_t _inc_recorded_rs_lengths_diffs; 103 104 // The predicted elapsed time it will take to collect the regions in 105 // the CSet. This is updated by the thread that adds a new region to 106 // the CSet. See the comment for _inc_recorded_rs_lengths about 107 // MT-safety assumptions. 108 double _inc_predicted_elapsed_time_ms; 109 160 _inc_tail = NULL; 161 } 162 163 // Stop adding regions to the incremental collection set 164 void stop_incremental_building() { _inc_build_state = Inactive; } 165 166 // The head of the list (via "next_in_collection_set()") representing the 167 // current collection set. 168 HeapRegion* head() { return _head; } 169 170 void clear_head() { _head = NULL; } 171 172 size_t recorded_rs_lengths() { return _recorded_rs_lengths; } 173 174 size_t bytes_used_before() const { 175 return _bytes_used_before; 176 } 177 178 void reset_bytes_used_before() { 179 _bytes_used_before = 0; 180 } 181 182 void reset_bytes_live_before() { 183 _bytes_live_before = 0; 184 } 185 186 // Choose a new collection set. Marks the chosen regions as being 187 // "in_collection_set", and links them together. The head and number of 188 // the collection set are available via access methods. 189 double finalize_young_part(double target_pause_time_ms); 190 void finalize_old_part(double time_remaining_ms); 191 192 // Add old region "hr" to the CSet. 193 void add_old_region(HeapRegion* hr); 194 195 // Update information about hr in the aggregated information for 196 // the incrementally built collection set. 197 void update_young_region_prediction(HeapRegion* hr, size_t new_rs_length); 198 199 // Add hr to the LHS of the incremental collection set. 200 void add_eden_region(HeapRegion* hr); 201 202 // Add hr to the RHS of the incremental collection set. 203 void add_survivor_regions(HeapRegion* hr); |