23 */ |
23 */ |
24 |
24 |
25 #ifndef SHARE_GC_G1_G1COLLECTIONSET_HPP |
25 #ifndef SHARE_GC_G1_G1COLLECTIONSET_HPP |
26 #define SHARE_GC_G1_G1COLLECTIONSET_HPP |
26 #define SHARE_GC_G1_G1COLLECTIONSET_HPP |
27 |
27 |
28 #include "gc/g1/collectionSetChooser.hpp" |
|
29 #include "utilities/debug.hpp" |
28 #include "utilities/debug.hpp" |
30 #include "utilities/globalDefinitions.hpp" |
29 #include "utilities/globalDefinitions.hpp" |
31 |
30 |
32 class G1CollectedHeap; |
31 class G1CollectedHeap; |
|
32 class G1CollectionSetCandidates; |
33 class G1CollectorState; |
33 class G1CollectorState; |
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 HeapRegionClosure; |
39 |
40 |
40 class G1CollectionSet { |
41 class G1CollectionSet { |
41 G1CollectedHeap* _g1h; |
42 G1CollectedHeap* _g1h; |
42 G1Policy* _policy; |
43 G1Policy* _policy; |
43 |
44 |
44 CollectionSetChooser* _cset_chooser; |
45 // All old gen collection set candidate regions for the current mixed gc phase. |
|
46 G1CollectionSetCandidates* _candidates; |
45 |
47 |
46 uint _eden_region_length; |
48 uint _eden_region_length; |
47 uint _survivor_region_length; |
49 uint _survivor_region_length; |
48 uint _old_region_length; |
50 uint _old_region_length; |
49 |
51 |
126 // Initializes the collection set giving the maximum possible length of the collection set. |
128 // Initializes the collection set giving the maximum possible length of the collection set. |
127 void initialize(uint max_region_length); |
129 void initialize(uint max_region_length); |
128 void initialize_optional(uint max_length); |
130 void initialize_optional(uint max_length); |
129 void free_optional_regions(); |
131 void free_optional_regions(); |
130 |
132 |
131 CollectionSetChooser* cset_chooser(); |
133 void clear_candidates(); |
|
134 |
|
135 void set_candidates(G1CollectionSetCandidates* candidates) { |
|
136 assert(_candidates == NULL, "Trying to replace collection set candidates."); |
|
137 _candidates = candidates; |
|
138 } |
|
139 G1CollectionSetCandidates* candidates() { return _candidates; } |
132 |
140 |
133 void init_region_lengths(uint eden_cset_region_length, |
141 void init_region_lengths(uint eden_cset_region_length, |
134 uint survivor_cset_region_length); |
142 uint survivor_cset_region_length); |
135 |
143 |
136 void set_recorded_rs_lengths(size_t rs_lengths); |
144 void set_recorded_rs_lengths(size_t rs_lengths); |
251 _pset(pset), |
259 _pset(pset), |
252 _current_index(0), |
260 _current_index(0), |
253 _current_limit(0), |
261 _current_limit(0), |
254 _prepare_failed(false), |
262 _prepare_failed(false), |
255 _evacuation_failed(false) { } |
263 _evacuation_failed(false) { } |
256 // The destructor returns regions to the cset-chooser and |
264 // The destructor returns regions to the collection set candidates set and |
257 // frees the optional structure in the cset. |
265 // frees the optional structure in the collection set. |
258 ~G1OptionalCSet(); |
266 ~G1OptionalCSet(); |
259 |
267 |
260 uint current_index() { return _current_index; } |
268 uint current_index() { return _current_index; } |
261 uint current_limit() { return _current_limit; } |
269 uint current_limit() { return _current_limit; } |
262 |
270 |